Skip to content
Snippets Groups Projects

Add caldb_root as parameter for CalibrationData

Merged Thomas Kluyver requested to merge feat/calcatapi-root-dir into master
2 unresolved threads
@@ -375,6 +375,7 @@ class CalibrationData:
client=None,
event_at=None,
module_naming="da",
caldb_root=None,
):
"""Initialize a new CalibrationData object.
@@ -397,6 +398,8 @@ class CalibrationData:
integers in karabo_da.
`qm`: QxMx naming convention is used. Virtual names for
AGIPD, DSSC, and LPD.
caldb_root (str or None): Path to the root directory for caldb
files, finds folder for production caldb by default.
**condition_params: Operating condition parameters defined
on an instance level.
"""
@@ -406,6 +409,9 @@ class CalibrationData:
self.event_at = event_at
self.pdu_snapshot_at = event_at
self.module_naming = module_naming
if caldb_root is not None:
caldb_root = Path(caldb_root)
self._caldb_root = caldb_root
if client is None:
@@ -495,20 +501,18 @@ class CalibrationData:
None if not available.
"""
if not hasattr(CalibrationData, "_caldb_root"):
if self._caldb_root is None:
if getenv("SASE"):
# ONC
CalibrationData._caldb_root = Path("/common/cal/caldb_store")
self._caldb_root = Path("/common/cal/caldb_store")
elif re.match(r"^max-(.+)\.desy\.de$", socket.getfqdn()):
# Maxwell
CalibrationData._caldb_root = Path(
"/gpfs/exfel/d/cal/caldb_store"
)
self._caldb_root = Path("/gpfs/exfel/d/cal/caldb_store")
else:
# Probably unavailable
CalibrationData._caldb_root = None
self._caldb_root = False
return CalibrationData._caldb_root
return self._caldb_root or None
@property
def client(self):
@@ -947,6 +951,7 @@ class AGIPD_CalibrationData(SplitConditionCalibrationData):
gain_setting=None,
gain_mode=None,
module_naming="da",
caldb_root=None,
integration_time=12,
source_energy=9.2,
pixels_x=512,
@@ -958,6 +963,7 @@ class AGIPD_CalibrationData(SplitConditionCalibrationData):
client,
event_at,
module_naming,
caldb_root,
)
self.sensor_bias_voltage = sensor_bias_voltage
@@ -1021,6 +1027,7 @@ class LPD_CalibrationData(SplitConditionCalibrationData):
client=None,
event_at=None,
module_naming="da",
caldb_root=None,
):
super().__init__(
detector_name,
@@ -1028,6 +1035,7 @@ class LPD_CalibrationData(SplitConditionCalibrationData):
client,
event_at,
module_naming,
caldb_root,
)
self.sensor_bias_voltage = sensor_bias_voltage
@@ -1072,6 +1080,7 @@ class DSSC_CalibrationData(CalibrationData):
client=None,
event_at=None,
module_naming="da",
caldb_root=None,
):
super().__init__(
detector_name,
@@ -1079,6 +1088,7 @@ class DSSC_CalibrationData(CalibrationData):
client,
event_at,
module_naming,
caldb_root,
)
self.sensor_bias_voltage = sensor_bias_voltage
@@ -1126,6 +1136,7 @@ class JUNGFRAU_CalibrationData(CalibrationData):
client=None,
event_at=None,
module_naming="da",
caldb_root=None,
):
super().__init__(
detector_name,
@@ -1133,6 +1144,7 @@ class JUNGFRAU_CalibrationData(CalibrationData):
client,
event_at,
module_naming,
caldb_root,
)
self.sensor_bias_voltage = sensor_bias_voltage
@@ -1193,6 +1205,7 @@ class PNCCD_CalibrationData(SplitConditionCalibrationData):
client=None,
event_at=None,
module_naming="da",
caldb_root=None,
):
# Ignore modules for this detector.
super().__init__(
@@ -1201,6 +1214,7 @@ class PNCCD_CalibrationData(SplitConditionCalibrationData):
client,
event_at,
module_naming,
caldb_root,
)
self.sensor_bias_voltage = sensor_bias_voltage
@@ -1249,6 +1263,7 @@ class EPIX100_CalibrationData(SplitConditionCalibrationData):
client=None,
event_at=None,
module_naming="da",
caldb_root=None,
):
# Ignore modules for this detector.
super().__init__(
@@ -1257,6 +1272,7 @@ class EPIX100_CalibrationData(SplitConditionCalibrationData):
client,
event_at,
module_naming,
caldb_root,
)
self.sensor_bias_voltage = sensor_bias_voltage
@@ -1299,6 +1315,7 @@ class GOTTHARD2_CalibrationData(CalibrationData):
client=None,
event_at=None,
module_naming="da",
caldb_root=None,
):
# Ignore modules for this detector.
super().__init__(
@@ -1307,6 +1324,7 @@ class GOTTHARD2_CalibrationData(CalibrationData):
client,
event_at,
module_naming,
caldb_root,
)
self.sensor_bias_voltage = sensor_bias_voltage
Loading