Calculate irradiance#91
Conversation
There was a problem hiding this comment.
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) fromtau_bestandsigma_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.
| 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). |
There was a problem hiding this comment.
I would specify the parameters in (*) explicitly here. That is a best practive.
| sigma_hat = float(np.asarray(sigma_out["sigma_hat"].values)) | ||
| tau_best = float(np.asarray(sigma_out["tau_best"].values)) |
| linewidth=2.0, | ||
| label=r"Normalized incident irradiance $I(t)/I_0$", | ||
| ) |
There was a problem hiding this comment.
Co-pilot, normalization is scaling to the peak.....quit hallucinating.
| #event = 213 | ||
| event = 152 |
There was a problem hiding this comment.
Remove the commented out line here.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
rcjackson
left a comment
There was a problem hiding this comment.
See my comments responding to copilot.
| 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). |
There was a problem hiding this comment.
I would specify the parameters in (*) explicitly here. That is a best practive.
| #event = 213 | ||
| event = 152 |
There was a problem hiding this comment.
Remove the commented out line here.
| linewidth=2.0, | ||
| label=r"Normalized incident irradiance $I(t)/I_0$", | ||
| ) |
There was a problem hiding this comment.
Co-pilot, normalization is scaling to the peak.....quit hallucinating.
NOTE: the scaling will have to be modified for evaporative particles. currently, the scaling is purely for visualization purposes.