legend-exp / pygama

Python package for data processing and analysis
https://pygama.readthedocs.io
GNU General Public License v3.0
18 stars 56 forks source link

Added DPZ extractor to pargen #558

Open SamuelBorden opened 8 months ago

SamuelBorden commented 8 months ago

The function get_dpz_decay_constants works to get the constants needed for the double pole zero filter in three steps:

  1. A guess for the long and short time constants are obtained by taking linear fits to the logarithm of a superpulse
  2. These guesses are used to seed a least squares fit
  3. The least squares values are then used in a dsp chain that optimizes the flatness of the decaying tails of waveforms

This is a first pass at the routine, so we should think maybe a bit more about where to put this in the dataflow. Right now this quickly interfaces with the single pole-zero dataflow script; to do that, the superpulse is created inside the function get_dpz_decay_constants. But we might want to make get_dpz_decay_constants a bit more general and instead create the superpulse in the dataflow.

There are other issues currently with the double pole zero filter, see https://github.com/legend-exp/dspeed/pull/52. So I am going to mark this as a draft PR

codecov[bot] commented 8 months ago

Codecov Report

Attention: Patch coverage is 62.98343% with 67 lines in your changes are missing coverage. Please review.

Project coverage is 25.51%. Comparing base (ae3752a) to head (7fdd904). Report is 50 commits behind head on main.

Files Patch % Lines
src/pygama/pargen/extract_tau.py 62.98% 67 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #558 +/- ## ========================================== + Coverage 22.82% 25.51% +2.68% ========================================== Files 42 42 Lines 8110 8220 +110 ========================================== + Hits 1851 2097 +246 + Misses 6259 6123 -136 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

gipert commented 6 months ago

@ggmarshall @SamuelBorden can this be merged to main or will mess up with the refactor?

SamuelBorden commented 6 months ago

I need to change some imports from the energy cal routines, but then it should be good to go. I'll work on synergizing this with the pargen refactor