Files
aare/python/tests/test_RawMasterFile.py
T
mazzol_aandErik Fröjdh 86db375948
Build on RHEL9 / build (push) Successful in 2m40s
Build on RHEL8 / build (push) Successful in 3m15s
Run tests using data on local RHEL8 / build (push) Successful in 4m15s
Build on local RHEL8 / build (push) Successful in 2m56s
python repr for Eta, Cluster (#367)
- python string repr for Cluster and Eta
- Context manager for RawMasterFile 
- slice operator for ROI

---------

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

39 lines
1.1 KiB
Python

import json
import pytest
from aare import RawMasterFile, ReadoutMode, DetectorType
@pytest.mark.withdata
def test_read_rawfile_quad_eiger_and_compare_to_numpy(test_data_path):
file_name = test_data_path/'raw/jungfrau/jungfrau_single_master_0.json'
f = RawMasterFile(file_name)
assert(f.reading_mode == ReadoutMode.UNKNOWN)
assert(f.detector_type == DetectorType.Jungfrau)
def test_raw_master_file_context_manager(tmp_path):
file_name = tmp_path / "run_master_0.json"
file_name.write_text(json.dumps({
"Version": 7.2,
"Detector Type": "Jungfrau",
"Timing Mode": "auto",
"Geometry": {"x": 1, "y": 1},
"Image Size in bytes": 12,
"Pixels": {"x": 3, "y": 2},
"Max Frames Per File": 1,
"Total Frames": 2,
"Frames in File": 2,
"Frame Padding": 1,
"Frame Discard Policy": "nodiscard",
}))
with RawMasterFile(file_name) as context_file:
assert context_file.reading_mode == ReadoutMode.UNKNOWN
assert context_file.detector_type == DetectorType.Jungfrau