Skip to content

Commit

Permalink
Fix cutoff radius
Browse files Browse the repository at this point in the history
  • Loading branch information
tovrstra committed Feb 26, 2024
1 parent 575c3f5 commit 0182d1a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/denspart/mbis.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,25 @@ def population_derivatives(self):
return np.array([1.0, 0.0])

def get_cutoff_radius(self, density_cutoff):
"""Cutoff radius at which the exponential function becomes smaller than the given cutoff.
Parameter
---------
density_cutoff
The threshold value for the density
Returns
-------
radius
The distance from the center where the exponential function
becomes smaller than the density_cutoff.
"""
if density_cutoff <= 0.0:
return np.inf
population, exponent = self.pars
return (np.log(population) - np.log(density_cutoff)) / exponent
return (
np.log(population) + 3 * np.log(exponent) - np.log(8 * np.pi) - np.log(density_cutoff)
) / exponent

def _compute_dists(self, points, cache=None):
return compute_cached(
Expand Down

0 comments on commit 0182d1a

Please sign in to comment.