Skip to content

SVM-Based Glitch Detection and Removal#97

Merged
katefoyle merged 7 commits into
mainfrom
newMLbranch
Aug 8, 2025
Merged

SVM-Based Glitch Detection and Removal#97
katefoyle merged 7 commits into
mainfrom
newMLbranch

Conversation

@katefoyle

@katefoyle katefoyle commented Aug 2, 2025

Copy link
Copy Markdown
Contributor

This pull request transforms the glitch detection pipeline into a machine learning approach (with an SVM classifier) capable of finding instrumental glitches at lower S/N thresholds and removing only those with glitch likelihoods exceeding a specified threshold (set to .45).

Key Changes

Added SVM glitch detection:

  • Added SVM_dpi_eval function to analyze 64ms DPI segments and flag likely glitches
  • Lowered SNR candidate thresholds ((stds > 6) and (stds / np.abs(stds2)) > 2) (previously hard-coded to 10 and 3) and passed them as changeable arguments
  • Glitch probabilities of candidates logged in data_setup.log
  • Intervals with glitch likelihood > .45 get returned and removed from event GTI

Interval handling:

  • Updated get_btis_for_glitches to allow customizable S/N thresholds
  • t_min, t_max tuples are returned and used to update GTI with true SVM-classified btis

Why?

  • Lowering the heat pipe glitch parameters allows the SVM to detect more glitches, which has proven effective in distinguishing these types of glitches from GRBs, SGRs, and background.
  • Increased glitch rejection lowers overall noise at any S/N, improving sensitivity to GRBs in ground-based searches.
  • Decreases noise from undetected glitches caused by previously strict, hard-coded glitch parameters.

Testing:

  • The hk mask, event, and attitude pat.fits files were ran through do_data_setup.py for event obsid 00013856003 (a high-probability glitch as found by the SVM)
    • data_setup.log printed its glitch probability and returned two bad time intervals that overlapped.
    • GTI was updated with the combined bad time interval now removed.
  • The above was repeated for an event obsid that did not return any significant glitch probability (00012872142) with initial SVM testing
    • No glitch probability was printed and entire GTI remained intact since no glitch was found.

@jjd330 jjd330 self-requested a review August 5, 2025 16:44
@jjd330

jjd330 commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

Add what you did to test this code

Comment thread nitrates/lib/gti_funcs.py Outdated
Comment thread nitrates/lib/gti_funcs.py Outdated
Comment thread nitrates/data_prep/do_data_setup.py Outdated
Comment thread nitrates/lib/gti_funcs.py
left "for bti in glitch_btis" as bti...only swapped glitch_btis
Comment thread nitrates/data_prep/do_data_setup.py Outdated
Comment thread nitrates/lib/gti_funcs.py
@jjd330

jjd330 commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

Once you change evdata to evdata0, can you run through one of the test cases one more time?

Also can you make this pull request not a draft?

@katefoyle katefoyle marked this pull request as ready for review August 6, 2025 21:16
Comment thread nitrates/data_prep/do_data_setup.py Outdated
Comment thread nitrates/data_prep/do_data_setup.py

@jjd330 jjd330 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me now!

@katefoyle katefoyle merged commit 794d117 into main Aug 8, 2025
4 checks passed
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