From e966e15881700a7b0c11ee75961cf54649d6721e Mon Sep 17 00:00:00 2001 From: Leo Browning Date: Tue, 27 Mar 2018 12:33:51 +1300 Subject: [PATCH] cleaned up function names --- percolation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/percolation.py b/percolation.py index baeb901..8da6161 100644 --- a/percolation.py +++ b/percolation.py @@ -16,7 +16,7 @@ class StickCollection(object): def __init__(self,n,l,sticks=None,pm=0,scaling=1): if sticks: self.sticks, self.intersects = self.make_clusters(sticks) - self.sticks, self.intersects = self.make_clusters_kdtree(self.make_sticks(n,l=l,pm=pm,scaling=scaling)) + self.sticks, self.intersects = self.make_intersects_kdtree(self.make_sticks(n,l=l,pm=pm,scaling=scaling)) self.make_cnet() def check_intersect(self, s1,s2): #assert that x intervals overlap @@ -72,7 +72,7 @@ def make_sticks(self, n,**kwargs): - def make_clusters_kdtree(self,sticks): + def make_intersects_kdtree(self,sticks): sticks['cluster']=sticks.index sticks.sort_values('length',inplace=True,ascending=False) sticks.reset_index(drop=True,inplace=True) @@ -107,7 +107,7 @@ def make_trivial_sticks(self): st4=[0.5, 0.5,np.pi/4,0.1,'s'] st4.append(self.get_ends(st4)) sticks=pd.DataFrame([source]+[st1]+[st2]+[st3]+[st4]+[drain],columns=[ "xc", "yc", "angle", "length",'kind', "endarray"]) - self.sticks, self.intersects = self.make_clusters_kdtree(sticks) + self.sticks, self.intersects = self.make_intersects_kdtree(sticks) self.make_cnet() @@ -168,6 +168,7 @@ def show_system(self,clustering=True,junctions=True,conduction=True): if conduction and self.percolating: self.cnet.show_device(ax=axes[2]) plt.show() + def show_clusters(self,intersects=True,ax=False): sticks=self.sticks if not(ax): @@ -201,7 +202,7 @@ def show_sticks(self,sticks,intersects,ax=False): plt.show() -# show_sticks(make_sticks(10,l=1)) + def time_collection(n, iterations=5,scaling=5):