usnistgov / mass

Microcalorimeter pulse-analysis software
MIT License
6 stars 0 forks source link

The memmapping of LJH files breaks the `invert_data` feature #286

Closed joefowler closed 3 months ago

joefowler commented 3 months ago

@ggggggggg says LCLS-II has inverted pulses and relies on invert_data to work.

Old way: when data were loaded from disk into a cache, one "segment" at a time, it was easy to sign-flip any data if invert_data was true. So we did that.

New way: we memmap the entire LJH binary area, and there are no segments. We read data to memory only on demand and have no access to sign-flip it. How can we invert data these days?

  1. Probably need to check that each channel's MicrocalDataSet is constructed with a invert_data=False default, instead of being created only when needed.
  2. The summarize_data method needs to use the invert_data flag for certain of its computations. Some numbers simply need to get inverted after being computed as normal (such as p_pulse_average), but others need to be computed with inversion in mind (e.g., p_postpeak_deriv). This is the main part of the work.
  3. The plot_traces could use that flag, to make plots that look more familiar.
  4. Check whether the complicated ATSFilter computation assumes pulse signs.
  5. Any other places?
  6. Add test. Maybe make a temporary LJH file that's inverted copy of one in the repo, and check that summary quantities come out the same?