Skip to content

Commit

Permalink
cleaned up function names
Browse files Browse the repository at this point in the history
  • Loading branch information
leobrowning92 committed Mar 26, 2018
1 parent 04f47d8 commit e966e15
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions percolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit e966e15

Please sign in to comment.