Skip to content

Commit

Permalink
Making positivity optional
Browse files Browse the repository at this point in the history
  • Loading branch information
cophus committed Nov 20, 2023
1 parent d823606 commit 9a03708
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion py4DSTEM/process/polar/polar_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def calculate_pair_dist_function(
r_max=20.0,
r_step=0.02,
damp_origin_fluctuations=True,
enforce_positivity=True,
density=None,
plot_background_fits=False,
plot_sf_estimate=False,
Expand Down Expand Up @@ -281,6 +282,8 @@ def calculate_pair_dist_function(
The value of the PDF approaching the origin should be zero, however numerical
instability may result in non-physical finite values there. This flag toggles
damping the value of the PDF to zero near the origin.
enforce_positivity:
Force all pdf values to be >0.
density : number or None
The density of the sample, if known. If this is not provided, only the
reduced PDF is calculated. If this value is provided, the PDF is also
Expand Down Expand Up @@ -416,7 +419,8 @@ def calculate_pair_dist_function(
# damp and clip values below zero
if damp_origin_fluctuations:
pdf *= r_mask
pdf = np.maximum(pdf, 0.0)
if enforce_positivity:
pdf = np.maximum(pdf, 0.0)

# store results
self.pdf = pdf
Expand Down

0 comments on commit 9a03708

Please sign in to comment.