Skip to content
Snippets Groups Projects

[AGIPD][CORRECT] Use calcat_interface and remove precorrection notebook

Merged Karim Ahmed requested to merge AGIPD_calcat_interface into master
1 file
+ 41
28
Compare changes
  • Side-by-side
  • Inline
+ 0
58
@@ -9,7 +9,6 @@ import zmq
from extra_data import open_run
from iCalibrationDB import Conditions, ConstantMetaData, Constants
from cal_tools.agipdlib import AgipdCorrections, CellRange
from cal_tools.plotting import show_processed_modules
from cal_tools.tools import (
creation_date_file_metadata,
@@ -29,9 +28,7 @@ from cal_tools.tools import (
ACQ_RATE = 1.1
BIAS_VOLTAGE = 300
GAIN_SETTING = 0
INTEGRATION_TIME = 12
MEM_CELLS = 352
PHOTON_ENERGY = 9.2
AGIPD_KARABO_ID = "SPB_DET_AGIPD1M-1"
WRONG_AGIPD_MODULE = "AGIPD_**"
@@ -406,61 +403,6 @@ def test_get_pdu_from_db(_agipd_const_cond):
"CAL_PHYSICAL_DETECTOR_UNIT-2_TEST"]
# TODO add a marker for accessing zmq end_point
@pytest.mark.requires_gpfs
@pytest.mark.requires_caldb
def test_initialize_from_db():
creation_time = datetime.strptime(
"2020-01-07 13:26:48.00", "%Y-%m-%d %H:%M:%S.%f")
agipd_corr = AgipdCorrections(
max_cells=MEM_CELLS,
cell_sel=CellRange([0, 500, 1], MEM_CELLS))
agipd_corr.allocate_constants(
modules=[0],
constant_shape=(3, MEM_CELLS, 512, 128))
dark_const_time_dict = agipd_corr.initialize_from_db(
karabo_id="TEST_DET_CAL_CI-1",
karabo_da="TEST_DET_CAL_DA1",
cal_db_interface=CAL_DB_INTERFACE,
creation_time=creation_time,
memory_cells=MEM_CELLS,
bias_voltage=BIAS_VOLTAGE,
photon_energy=PHOTON_ENERGY,
gain_setting=GAIN_SETTING,
acquisition_rate=ACQ_RATE,
integration_time=INTEGRATION_TIME,
module_idx=0,
only_dark=False,
)
assert dark_const_time_dict == {
"Offset": None,
"Noise": None,
"ThresholdsDark": None,
"BadPixelsDark": None,
}
dark_const_time_dict = agipd_corr.initialize_from_db(
karabo_id=AGIPD_KARABO_ID,
karabo_da="AGIPD00",
cal_db_interface=CAL_DB_INTERFACE,
creation_time=creation_time,
memory_cells=MEM_CELLS, bias_voltage=BIAS_VOLTAGE,
photon_energy=PHOTON_ENERGY, gain_setting=GAIN_SETTING,
integration_time=INTEGRATION_TIME,
acquisition_rate=ACQ_RATE, module_idx=0,
only_dark=False,
)
# A retrieved constant has a value of datetime creation_time
assert isinstance(dark_const_time_dict["Offset"], datetime)
assert list(dark_const_time_dict.keys()) == [
"Offset", "Noise", "ThresholdsDark", "BadPixelsDark"]
def test_module_index_to_qm():
assert module_index_to_qm(0) == 'Q1M1'
Loading