Skip to content

Commit

Permalink
Update livetime correction add pileup parameter calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
samaloney committed Apr 30, 2024
1 parent b376ab4 commit 0fde7ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog/100.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update livetime correction parameter `eta`, `tau` and add code to calculate pileup 'beta' :func:`stixpy.calibration.livetime.pileup_correction_factor`.
File renamed without changes.
11 changes: 7 additions & 4 deletions stixpy/calibration/livetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ def pileup_correction_factor():

subc_str = read_subc_params()
large_pixel_area = (subc_str['L Pixel Xsize'] * subc_str['L Pixel Ysize'])[0]
detector_area = (subc_str['Detect Xsize'] * subc_str['Detect Xsize'])[0]
big_pixel_fraction = large_pixel_area/detector_area
prob_diff_pix = (2./big_pixel_fraction - 1.)/(2./big_pixel_fraction)
small_pixel_area = (subc_str['S Pixel Xsize'] * subc_str['S Pixel Ysize'])[0]
# half a small pixel overlaps each big pixel
large_pixel_area_corrected = large_pixel_area - 0.5 * small_pixel_area
detector_area = (subc_str['Detect Xsize'] * subc_str['Detect Ysize'])[0]
big_pixel_fraction = large_pixel_area_corrected/detector_area
prob_diff_pix = (2/big_pixel_fraction - 1)/(2/big_pixel_fraction)

return prob_diff_pix

Expand All @@ -108,7 +111,7 @@ def get_livetime_fraction(trigger_rate, *, eta=1.10 * u.us, tau=10.1 * u.us):
`float`, `float`, `float`:
The live time fraction
"""
beta = pileup_correction_factor()
beta = 0.94059104 # pileup_correction_factor()

photons_in = trigger_rate / (1.0 - trigger_rate * (tau + eta))
livetime_fraction = 1 / (1.0 + (tau + eta) * photons_in)
Expand Down
2 changes: 1 addition & 1 deletion stixpy/calibration/tests/test_livetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def test_pileup_correction_factor():
pileup_factor = pileup_correction_factor()
assert pileup_factor == 0.9346590909090909
assert pileup_factor == 0.9405910326086957


def test_get_livetime():
Expand Down

0 comments on commit 0fde7ea

Please sign in to comment.