Calibration¶
Functions for applying calibration to data.
import aare
# Load calibration data for a single JF module (512x1024 pixels)
calibration = aare.load_calibration('path/to/calibration/file.bin')
raw_data = ... # Load your raw data here
pedestal = ... # Load your pedestal data here
# Apply calibration to raw data to convert from raw ADC values to keV
data = aare.apply_calibration(raw_data, pd=pedestal, cal=calibration)
# If you pass a 2D pedestal and calibration only G0 will be used for the conversion
# Pixels that switched to G1 or G2 will be set to 0
data = aare.apply_calibration(raw_data, pd=pedestal[0], cal=calibration[0])
- aare.apply_calibration()¶
Apply the calibration to the raw data and return the result as a 3D array of doubles.
- Parameters:
raw_data (array_like) – 3D array of shape
(frames, rows, cols).pd (array_like) – Pedestal array.
cal (array_like) – Calibration array.
n_threads (int, optional) – Number of threads to use. Defaults to 4.
- aare.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.
- aare.calculate_pedestal()¶
Calculate the pedestal for all three gains and return the result as a 3D array of doubles.
- Parameters:
raw_data (array_like) – 3D array of shape (frames, rows, cols) to calculate the pedestal from. Needs to contain data for all three gains (G0, G1, G2).
n_threads (int) – The number of threads to use for the calculation.
- aare.calculate_pedestal_float()¶
Same as calculate_pedestal but returns a 3D array of floats.
- Parameters:
raw_data (array_like) – 3D array of shape (frames, rows, cols) to calculate the pedestal from. Needs to contain data for all three gains (G0, G1, G2).
n_threads (int) – The number of threads to use for the calculation.
- aare.calculate_pedestal_g0()¶
Calculate the pedestal for G0 and return the result as a 2D array of doubles. Pixels in G1 and G2 are ignored.
- Parameters:
raw_data (array_like) – 3D array of shape (frames, rows, cols) to calculate the pedestal from.
n_threads (int) – The number of threads to use for the calculation.
- aare.calculate_pedestal_g0_float()¶
Same as calculate_pedestal_g0 but returns a 2D array of floats.
- Parameters:
raw_data (array_like) – 3D array of shape (frames, rows, cols) to calculate the pedestal from.
n_threads (int) – The number of threads to use for the calculation.
- aare.count_switching_pixels()¶
Count the number of time each pixel switches to G1 or G2.
- Parameters:
raw_data (array_like) – 3D array of shape (frames, rows, cols) to count the switching pixels from.
n_threads (int) – The number of threads to use for the calculation.