Files
aare/python/aare/calibration.py
T
mazzol_aandErik Fröjdh 97ddf6e7c1
Build on RHEL9 / build (push) Successful in 2m43s
Build on RHEL8 / build (push) Successful in 3m23s
Run tests using data on local RHEL8 / build (push) Successful in 4m31s
Build on local RHEL8 / build (push) Successful in 3m5s
error when compiling with warnings (#376)
- error upon warning when building documentation (warnings often
indicate malrendered documentation)
- fixed some warnings

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-09-17 09:27:05 +02:00

25 lines
665 B
Python

# SPDX-License-Identifier: MPL-2.0
#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