Skip to content

Calculate irradiance#91

Open
jtgasparik wants to merge 4 commits into
ARM-DOE:mainfrom
jtgasparik:calculate_irradiance
Open

Calculate irradiance#91
jtgasparik wants to merge 4 commits into
ARM-DOE:mainfrom
jtgasparik:calculate_irradiance

Conversation

@jtgasparik

Copy link
Copy Markdown
Collaborator
  1. Function added to calculate the normalized incident irradiance from previously computed parameters $\tau$ and $\sigma$.
  2. Function to plot the normalized incident irradiance and scale according to peak irradiance.

NOTE: the scaling will have to be modified for evaporative particles. currently, the scaling is purely for visualization purposes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for computing and visualizing the (Gaussian-model) normalized incident irradiance derived from previously estimated Moteki & Kondo parameters (τ and σ), and extends the existing incident-irradiance plot to include an irradiance overlay.

Changes:

  • Added compute_normalized_incident_irradiance_moteki_kondo() to compute (I(t)/I_0) from tau_best and sigma_hat.
  • Updated plot_incident_irradiance() to plot a (scaled) incident-irradiance curve alongside the scattering signal.
  • Extended NDM tests to exercise the new irradiance computation and made small test tweaks in visualization tests.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
pysp2/util/normalized_derivative_method.py Adds the normalized irradiance computation helper and overlays the irradiance curve in the incident-irradiance plot.
tests/test_ndm.py Adds test coverage that exercises the new normalized irradiance helper against an example waveform.
tests/test_vis.py Minor tweaks to the visualization test setup (event selection comment/whitespace).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +988 to +995
h : float, optional
Sampling interval. Required if `t` is not provided.
t : array-like, optional
Explicit time axis to evaluate on. If provided, this is used directly.
n_samples : int, optional
If `t` is not provided, use this many samples starting at 0 with spacing `h`.
If omitted, and `fit_start` / `fit_stop` are present in sigma_out, the function
evaluates only over the fitted window [fit_start, fit_stop).

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 specify the parameters in (*) explicitly here. That is a best practive.

Comment thread pysp2/util/normalized_derivative_method.py Outdated
Comment on lines +1009 to +1010
sigma_hat = float(np.asarray(sigma_out["sigma_hat"].values))
tau_best = float(np.asarray(sigma_out["tau_best"].values))
Comment on lines +1193 to +1195
linewidth=2.0,
label=r"Normalized incident irradiance $I(t)/I_0$",
)

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.

Co-pilot, normalization is scaling to the peak.....quit hallucinating.

Comment thread tests/test_vis.py
Comment on lines +18 to 19
#event = 213
event = 152

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.

Remove the commented out line here.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@rcjackson rcjackson left a comment

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.

See my comments responding to copilot.

Comment on lines +988 to +995
h : float, optional
Sampling interval. Required if `t` is not provided.
t : array-like, optional
Explicit time axis to evaluate on. If provided, this is used directly.
n_samples : int, optional
If `t` is not provided, use this many samples starting at 0 with spacing `h`.
If omitted, and `fit_start` / `fit_stop` are present in sigma_out, the function
evaluates only over the fitted window [fit_start, fit_stop).

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 specify the parameters in (*) explicitly here. That is a best practive.

Comment thread tests/test_vis.py
Comment on lines +18 to 19
#event = 213
event = 152

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.

Remove the commented out line here.

Comment on lines +1193 to +1195
linewidth=2.0,
label=r"Normalized incident irradiance $I(t)/I_0$",
)

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.

Co-pilot, normalization is scaling to the peak.....quit hallucinating.

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.

3 participants