Skip to content

Compute d2#83

Merged
rcjackson merged 8 commits into
ARM-DOE:mainfrom
jtgasparik:compute_d2
May 4, 2026
Merged

Compute d2#83
rcjackson merged 8 commits into
ARM-DOE:mainfrom
jtgasparik:compute_d2

Conversation

@jtgasparik
Copy link
Copy Markdown
Collaborator

Function to compute the statistical distance ($d^2$) for an associated value of $\tau$. This PR contains:

  1. Added helper functions for the NDM module which consolidates the overlapping computations between the $\tau$ and $d^2$ functions.
  2. Function to compute the $d^2$ value used to determine the best $\tau$ value in the non-evaporative region.
  3. Tests to compare the calculated $\tau$ value based on the best $d^2$ value and compare to true values from purely scattering particles.
  4. One test to compare the best $\tau$ value for an absorbing particle and compare to the true value from the purely scattering particle (this is an approximate way to test because $\tau$ values should not vary significantly within a single population). Testing tolerance slightly higher to accommodate the evaporative particle.
  5. Added an optional flag to the plot_normalized_derivative function to plot the scattering signal on the same plot as the normalized derivative for comparison purposes.

@jtgasparik jtgasparik requested a review from rcjackson April 16, 2026 19:21
inp_data = xr.Dataset(inp_data)
#inp_data['Data_ch' + str(chn)] = xr.DataArray(
# spectra['Data_ch' + str(chn)].values[np.newaxis, :],
# dims=['time', 'bins'])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have code commented out I would remove it from your final version. This helps the code be more readable.

L : np.ndarray or None
Cholesky factor of Sigma, if Sigma is positive definite.
d2 : float or None
Statistical distance squared [Eq. (A.11)].
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a references section to this docstring showing the citation for the Moteki & Kondo paper?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a single reference and description at the top of the module. If you would rather keep the reference in the docstring for each function, I can move it there.

) -> xr.DataArray:
"""
Compute d^2(k) for one selected event using the Moteki & Kondo statistical distance.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add the same reference to MK in this docstring as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous comment

Copy link
Copy Markdown
Collaborator

@rcjackson rcjackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small changes!

@jtgasparik jtgasparik requested a review from rcjackson May 4, 2026 18:00
@rcjackson rcjackson merged commit ecb6eeb into ARM-DOE:main May 4, 2026
20 checks passed
@jtgasparik jtgasparik deleted the compute_d2 branch May 4, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants