Skip to content

Commit

Permalink
432 new feature willard chandler density parameter (#433)
Browse files Browse the repository at this point in the history
* Add density cutoff argument to Willard Chandler
* Delete .travis.yml.  (Invalid file name causes cloning to fail on Windows)

---------

Co-authored-by: Alex Moriarty <25207558+a-ws-m@users.noreply.github.com>
Co-authored-by: a-ws-m <amoriarty14@gmail.com>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent e975d76 commit 546ad85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 62 deletions.
61 changes: 0 additions & 61 deletions .travis.yml.

This file was deleted.

7 changes: 6 additions & 1 deletion pytim/willard_chandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class WillardChandler(Interface):
this group
:param float alpha: The width of the Gaussian kernel
:param float mesh: The grid spacing for the density calculation
:param float density_cutoff: The density value used to define the
isosurface. `None` (default) uses the average
of the minimum and maximum density.
:param AtomGroup group: Compute the density using this group
:param dict radii_dict: Dictionary with the atomic radii of
the elements in the group.
Expand Down Expand Up @@ -127,10 +130,12 @@ def __init__(self,
centered=False,
warnings=False,
autoassign=True,
density_cutoff=None,
**kargs):

self.autoassign, self.do_center = autoassign, centered
self.include_zero_radius = include_zero_radius
self.density_cutoff = density_cutoff
sanity = SanityCheck(self, warnings=warnings)
sanity.assign_universe(universe, group)
sanity.assign_alpha(alpha)
Expand Down Expand Up @@ -245,7 +250,7 @@ def _assign_layers(self):
volume = self.density_field.reshape(
tuple(np.array(ngrid[::-1]).astype(int)))
verts, faces, normals, values = marching_cubes(
volume, None, spacing=tuple(spacing))
volume, self.density_cutoff, spacing=tuple(spacing))
# note that len(normals) == len(verts): they are normals
# at the vertices, and not normals of the faces
# verts and normals have x and z flipped because skimage uses zyx ordering
Expand Down

0 comments on commit 546ad85

Please sign in to comment.