-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitim fix #350
base: master
Are you sure you want to change the base?
Gitim fix #350
Conversation
pytim/gitim.py
Outdated
for atomid in simplices[i]: | ||
close = tree_neighs.query_ball_point(_points[atomid],radii[atomid] 2*self.alpha radii[real_neighs]) | ||
if len(close)>0: | ||
cond2[i] = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
pytim/gitim.py
Outdated
# if their centers distance d < 2 alpha r_s r_n | ||
for atomid in simplices[i]: | ||
close = tree_neighs.query_ball_point(_points[atomid],radii[atomid] 2*self.alpha radii[real_neighs]) | ||
if len(close)>0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
missing whitespace around operator
pytim/gitim.py
Outdated
# will be close to a putative surface one 's' (part of the simplex) | ||
# if their centers distance d < 2 alpha r_s r_n | ||
for atomid in simplices[i]: | ||
close = tree_neighs.query_ball_point(_points[atomid],radii[atomid] 2*self.alpha radii[real_neighs]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
line too long (122 > 79 characters)
missing whitespace after ','
pytim/gitim.py
Outdated
# An atom 'n' in the neighborhood of the kissing sphere's center | ||
# will be close to a putative surface one 's' (part of the simplex) | ||
# if their centers distance d < 2 alpha r_s r_n | ||
for atomid in simplices[i]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
pytim/gitim.py
Outdated
# specify a distance that depends on the radius of the particle. | ||
# An atom 'n' in the neighborhood of the kissing sphere's center | ||
# will be close to a putative surface one 's' (part of the simplex) | ||
# if their centers distance d < 2 alpha r_s r_n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four (comment)
pytim/gitim.py
Outdated
# we will now search for those which are also close to the simplex | ||
for i,neighbors in enumerate(neigborhoods): | ||
if len(neighbors) > 0: | ||
real_neighs = list(set(neighbors) - set(simplices[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
pytim/gitim.py
Outdated
# find all atoms within the kissing sphere to each of the simplices | ||
neighborhoods = tree.query_ball_point(x=cc[cond],r=cr[cond]) | ||
# we will now search for those which are also close to the simplex | ||
for i,neighbors in enumerate(neigborhoods): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
undefined name 'neigborhoods'
pytim/gitim.py
Outdated
tree = cKDTree(extrapoints[:-8]) | ||
cond2 = cond | True # all True, will set them false below | ||
# find all atoms within the kissing sphere to each of the simplices | ||
neighborhoods = tree.query_ball_point(x=cc[cond],r=cr[cond]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local variable 'neighborhoods' is assigned to but never used
missing whitespace after ','
tree = cKDTree(extrapoints) | ||
else: | ||
tree = cKDTree(extrapoints[:-8]) | ||
cond2 = cond | True # all True, will set them false below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least two spaces before inline comment
multiple spaces after operator
if self._noextrapoints: | ||
tree = cKDTree(extrapoints) | ||
else: | ||
tree = cKDTree(extrapoints[:-8]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined name 'cKDTree'
65152a5
to
e337670
Compare
pytim/gitim.py
Outdated
for atomid in real_neighs: | ||
d = linalgnorm(_points[simplices[i]]-tree.data[atomid],axis=1) | ||
if np.count_nonzero(d-radii[atomid]-radii[simplices[i]] - 2.*self.alpha<0) > 1: | ||
cond2[i] = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over-indented
pytim/gitim.py
Outdated
real_neighs = list(set(neighbors) -set(neighborhoods2[i])- set(simplices[i])) | ||
for atomid in real_neighs: | ||
d = linalgnorm(_points[simplices[i]]-tree.data[atomid],axis=1) | ||
if np.count_nonzero(d-radii[atomid]-radii[simplices[i]] - 2.*self.alpha<0) > 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (95 > 79 characters)
missing whitespace around operator
pytim/gitim.py
Outdated
# To be sure, we alse remove points belonging to the kissed simplex as well. | ||
real_neighs = list(set(neighbors) -set(neighborhoods2[i])- set(simplices[i])) | ||
for atomid in real_neighs: | ||
d = linalgnorm(_points[simplices[i]]-tree.data[atomid],axis=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
for i,neighbors in enumerate(neighborhoods1): | ||
# we are not interested in points either too far away from the sphere border. | ||
# To be sure, we alse remove points belonging to the kissed simplex as well. | ||
real_neighs = list(set(neighbors) -set(neighborhoods2[i])- set(simplices[i])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (89 > 79 characters)
missing whitespace around operator
# we will now search for those which are also close to the simplex | ||
for i,neighbors in enumerate(neighborhoods1): | ||
# we are not interested in points either too far away from the sphere border. | ||
# To be sure, we alse remove points belonging to the kissed simplex as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (88 > 79 characters)
neighborhoods1 = tree.query_ball_point(x=cc[cond],r=cr[cond]) | ||
radii2 = cr[cond]-2*self.alpha | ||
radii2[radii2<0] = 0.0 # query_ball_point treats negative radii as positive... | ||
# if they are within the kissing sphere, but further than 2*alpha from its |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (82 > 79 characters)
# find all atoms within the kissing sphere to each of the simplices | ||
neighborhoods1 = tree.query_ball_point(x=cc[cond],r=cr[cond]) | ||
radii2 = cr[cond]-2*self.alpha | ||
radii2[radii2<0] = 0.0 # query_ball_point treats negative radii as positive... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least two spaces before inline comment
line too long (86 > 79 characters)
missing whitespace around operator
tree = cKDTree(extrapoints[:-8]) | ||
cond2 = cond | True # all True, will set them false below | ||
# find all atoms within the kissing sphere to each of the simplices | ||
neighborhoods1 = tree.query_ball_point(x=cc[cond],r=cr[cond]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
@@ -221,10 223,36 @@ def alpha_shape(self, alpha, group, layer): | |||
except IndexError: | |||
raise IndexError("alpha_shape called using a wrong layer") | |||
|
|||
cr = circumradius(_points, radii, simplices) | |||
# radii and centers of the kissing spheres | |||
cr,cc = circumradius(_points, radii, simplices) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
pytim/utilities_dbscan.py
Outdated
neighborhoods = np.array([ | ||
np.array(neighbors) | ||
for neighbors in tree.query_ball_point(points, cluster_cut, n_jobs=-1) | ||
]) | ||
],dtype=object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
e337670
to
ffe83f7
Compare
@@ -279,6 319,8 @@ def _assign_layers(self): | |||
alpha_ids = self.alpha_shape(self.alpha, alpha_group, layer) | |||
|
|||
group = alpha_group[alpha_ids] | |||
if self.surface_cluster_cut is not None: | |||
group=self._filter_biggest_surface_cluster(group,self.surface_cluster_cut) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (90 > 79 characters)
missing whitespace after ','
missing whitespace around operator
for atomid in real_neighs: | ||
d = linalgnorm(_points[simplices[sid][0]]-tree.data[atomid],axis=1) | ||
if np.count_nonzero(d-radii[atomid]-radii[simplices[sid][0]] - 2.*self.alpha<0) > 1: | ||
cond2[sid] = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
over-indented
real_neighs = list(set(neighbors) -set(neighborhoods2[i])- set(simplices[i])) | ||
for atomid in real_neighs: | ||
d = linalgnorm(_points[simplices[sid][0]]-tree.data[atomid],axis=1) | ||
if np.count_nonzero(d-radii[atomid]-radii[simplices[sid][0]] - 2.*self.alpha<0) > 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (100 > 79 characters)
missing whitespace around operator
# To be sure, we alse remove points belonging to the kissed simplex as well. | ||
real_neighs = list(set(neighbors) -set(neighborhoods2[i])- set(simplices[i])) | ||
for atomid in real_neighs: | ||
d = linalgnorm(_points[simplices[sid][0]]-tree.data[atomid],axis=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (83 > 79 characters)
missing whitespace after ','
to filter out cavitating bubbles. | ||
:param float surface_cluster_cut: Filter surface atoms/molecules | ||
to include only those in the largest cluster | ||
of (initially detected) surface ones. Useful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (80 > 79 characters)
@@ -58,6 60,16 @@ class GITIM(Interface): | |||
:param bool biggest_cluster_only: Tag as surface atoms/molecules only | |||
those in the largest cluster. Need to | |||
specify also a :py:obj:`cluster_cut` value. | |||
:param bool biggest_surface_cluster_only: Filter surface atoms/molecules | |||
to include only those in the largest cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (80 > 79 characters)
@@ -58,6 60,16 @@ class GITIM(Interface): | |||
:param bool biggest_cluster_only: Tag as surface atoms/molecules only | |||
those in the largest cluster. Need to | |||
specify also a :py:obj:`cluster_cut` value. | |||
:param bool biggest_surface_cluster_only: Filter surface atoms/molecules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (80 > 79 characters)
trailing whitespace
l,c,n = utilities.do_cluster_analysis_dbscan( | ||
group, cut, | ||
molecular=False) | ||
return group[np.where(l == np.argmax(c))[0]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ambiguous variable name 'l'
@@ -145,6 145,12 @@ def _assign_symmetry(self, symmetry): | |||
raise ValueError(messages.WRONG_DIRECTION) | |||
self.symmetry = symmetry | |||
|
|||
def _filter_biggest_surface_cluster(self,group,cut): | |||
l,c,n = utilities.do_cluster_analysis_dbscan( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
@@ -145,6 145,12 @@ def _assign_symmetry(self, symmetry): | |||
raise ValueError(messages.WRONG_DIRECTION) | |||
self.symmetry = symmetry | |||
|
|||
def _filter_biggest_surface_cluster(self,group,cut): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
No description provided.