Apply calibration to Jungfrau raw data (#216)

- Added function to read calibration file
- Multi threaded pedestal subtraction and application of the calibration
This commit is contained in:
Erik Fröjdh
2025-07-18 10:19:14 +02:00
committed by GitHub
parent 1414d75320
commit abae2674a9
12 changed files with 236 additions and 87 deletions
+5
View File
@@ -30,3 +30,8 @@ from .utils import random_pixels, random_pixel, flat_list, add_colorbar
#make functions available in the top level API
from .func import *
from .calibration import *
from ._aare import apply_calibration
from ._aare import VarClusterFinder
+21
View File
@@ -0,0 +1,21 @@
#Calibration related functions
import numpy as np
def load_calibration(fname, hg0=False):
"""
Load calibration data from a file.
Parameters:
fname (str): Path to the calibration file.
hg0 (bool): If True, load HG0 calibration data instead of G0.
"""
gains = 3
rows = 512
cols = 1024
with open(fname, 'rb') as f:
cal = np.fromfile(f, count=gains * rows * cols, dtype=np.double).reshape(
gains, rows, cols
)
if hg0:
cal[0] = np.fromfile(f, count=rows * cols, dtype=np.double).reshape(rows, cols)
return cal