Skip to content

idex_l2a - target/IG fitting routine to be more robust and added fit constraints. #3152

Merged
lacoak21 merged 3 commits into
IMAP-Science-Operations-Center:devfrom
aldo9253:idex_l2a_fit_update
May 7, 2026
Merged

idex_l2a - target/IG fitting routine to be more robust and added fit constraints. #3152
lacoak21 merged 3 commits into
IMAP-Science-Operations-Center:devfrom
aldo9253:idex_l2a_fit_update

Conversation

@aldo9253
Copy link
Copy Markdown
Collaborator

@aldo9253 aldo9253 commented May 6, 2026

Updated idex_l2a.py - fit_impact() to produce more consistent fits.
closes #3115

Change Summary

Updated idex_l2a.py - fit_impact()

Overview

idex_l2a.py

File changes

Made the baseline more robust in fit_impact() and added constraints to the parameters of the fit.

Testing

Re-ran test_idex_l1a through 2b and visually inspected all fits.

@aldo9253
Copy link
Copy Markdown
Collaborator Author

aldo9253 commented May 7, 2026

@lacoak21 Would you be available to review this?

@lacoak21 lacoak21 assigned lacoak21 and aldo9253 and unassigned lacoak21 May 7, 2026
@lacoak21 lacoak21 requested review from Copilot and lacoak21 and removed request for Copilot May 7, 2026 14:45
@lacoak21 lacoak21 added the Ins: IDEX Related to the IDEX instrument label May 7, 2026
@lacoak21 lacoak21 added this to IMAP May 7, 2026
@lacoak21 lacoak21 requested a review from Copilot May 7, 2026 14:50
@lacoak21
Copy link
Copy Markdown
Contributor

lacoak21 commented May 7, 2026

Hey Alex this looks good.

For future PRs can you do the following?

  1. On the right hand side
    • Under reviewers add @lacoak21
    • Under assignees, choose yourself
    • Under labels, choose IDEX
    • Under project, choose IMAP
  2. In the PR description section at the top, add "closes IDEX - L2 - Waveform fits #3115" or whatever issue is linked. This will link the ticket and the PR together. It will also close the PR when it gets merged

(I did these for you this time)

In the actual issue:

  • under milestone, choose whichever month you think you will complete this work in. (I choose May for you already)

Comment thread imap_processing/idex/idex_l2a.py Outdated
Comment thread imap_processing/idex/idex_l2a.py
Comment thread imap_processing/idex/idex_l2a.py Outdated
Comment thread imap_processing/idex/idex_l2a.py
@lacoak21
Copy link
Copy Markdown
Contributor

lacoak21 commented May 7, 2026

Also the code coverage test is failing because there are if statement paths that are not covered in tests so you will need to add tests for those.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the IDEX L2A waveform-fitting path (estimate_dust_mass / fit_impact) to make baseline estimation and fit parameter constraints more robust, aiming to produce more consistent Target / Ion Grid waveform fits (Issue #3115).

Changes:

  • Passes the waveform/channel name into estimate_dust_mass to enable channel-specific fitting constraints.
  • Reworks baseline estimation and initial parameter guessing for the impact-charge fit.
  • Adds bounded optimization to curve_fit and changes how signal amplitude is computed (analytic extremum vs. discrete max).

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

Comment thread imap_processing/idex/idex_l2a.py
Comment thread imap_processing/idex/idex_l2a.py Outdated
Comment on lines +790 to +792
window_start = float(np.min(time))
window_stop = window_start + 5.0
good_mask = np.logical_and(time >= window_start, time <= window_stop)
Comment thread imap_processing/idex/idex_l2a.py Outdated
Comment on lines 750 to 756
def estimate_dust_mass(
low_sampling_time: xr.DataArray,
target_signal: xr.DataArray,
remove_noise: bool = True,
# remove_noise: bool = True,
remove_noise: bool = False,
waveform_name: str = "",
) -> tuple[NDArray, float, float, float, NDArray]:
Comment thread imap_processing/idex/idex_l2a.py
Comment thread imap_processing/idex/idex_l2a.py
Comment thread imap_processing/idex/idex_l2a.py
Comment thread imap_processing/idex/idex_l2a.py
@aldo9253 aldo9253 closed this May 7, 2026
@github-project-automation github-project-automation Bot moved this to Done in IMAP May 7, 2026
@aldo9253 aldo9253 reopened this May 7, 2026
@lacoak21 lacoak21 self-requested a review May 7, 2026 22:00
Copy link
Copy Markdown
Contributor

@lacoak21 lacoak21 left a comment

Choose a reason for hiding this comment

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

LGTM

@lacoak21 lacoak21 merged commit 526ba42 into IMAP-Science-Operations-Center:dev May 7, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ins: IDEX Related to the IDEX instrument

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

IDEX - L2 - Waveform fits

3 participants