iCalibrationDB package¶
Subpackages¶
Submodules¶
-
class
iCalibrationDB.calibration_constant.
CalibrationConstant
[source]¶ Bases:
iCalibrationDB.util.DictConvertable
A calibration constant bound to a detector type
-
auto_approve
¶ If the constant is auto-approved for good quality
-
data
¶ The constant data itself.
Should be a numpy array, usually of dimensions (x, y, memory cell)
-
description
¶ A description for the constant
-
device_type_name
¶ The device type the constant refers to.
Expects an object of type Detector.
-
mandatory
= ['flg_auto_approve', 'description', 'calibration_name', 'detector_type_name']¶
-
name
¶ The name of the constant
-
-
class
iCalibrationDB.constant_version.
ConstantVersion
[source]¶ Bases:
iCalibrationDB.util.DictConvertable
Calibration constant versions reflect evolution over time
-
begin_at
¶ When the constant was produced/injected
Expects a datetime object, e.g. datatime.now()
-
begin_validity_at
¶ When the validity of the constant begins at.
Expects a datetime object, e.g. datatime.now()
-
ccv_id
¶ Id number of the calibration constant version
-
description
¶ A description of this constant version
-
device_name
¶ Name of the device producing the constant
-
end_validity_at
¶ When the validity of the constant ends at.
Expects a datetime object, e.g. datatime.now()
-
file_name
¶ File name the constant is stored at - will be auto-filled
-
good_quality
¶ Flag indicating if the constant is of good quality (True)
-
karabo_da
¶ Name of the Karabo DA to identify the detector producing the constant
-
karabo_id
¶ Name of the Karabo ID to identify the detector producing the constant
-
mandatory
= ['karabo_id', 'file_name', 'flg_good_quality', 'begin_validity_at', 'end_validity_at', 'begin_at']¶
-
raw_data_location
¶ Location of the raw_data. Will be auto-set.
-
report_path
¶ Path of the report. Will be auto-set.
-
retrieve_optionals
= ['file_name']¶
-
-
class
iCalibrationDB.detector_condition.
DetectorCondition
[source]¶ Bases:
iCalibrationDB.util.DictConvertable
Detector condition’s group operating conditions and additional meta-data.
-
available
¶ Internal parameter, should be left at the default (True).
-
description
¶ A description for this detector condition.
-
mandatory
= ['name', 'flg_available', 'parameters']¶
-
name
¶ The name of the detector condition, will be used in data base
-
parameters
¶ The operating parameters of the detector at this condition.
Expects a list of OperatingConditions.
-
-
class
iCalibrationDB.detectors.
DetectorModule
(uuid=0, version=0)[source]¶ Bases:
object
-
detector_type
= None¶
-
detector_uuid
= None¶
-
device_name
¶
-
module_uuid
= None¶
-
owner
= None¶
-
type_name
¶
-
version
= None¶
-
-
class
iCalibrationDB.detectors.
DetectorTypes
[source]¶ Bases:
enum.Enum
An enumeration.
-
AGIPD
= 'AGIPD-Type'¶
-
DSSC
= 'DSSC-Type'¶
-
LPD
= 'LPD-Type'¶
-
ePix100
= 'ePix100-Type'¶
-
ePix10K
= 'ePix10K-Type'¶
-
fastCCD
= 'fastCCD-Type'¶
-
jungfrau
= 'jungfrau-Type'¶
-
pnCCD
= 'pnCCD-Type'¶
-
-
class
iCalibrationDB.known_constants.
BadPixels
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector bad pixel map
-
class
iCalibrationDB.known_constants.
Constants
[source]¶ Bases:
object
Predefined constants are provided in this class.
They are organized by detector type, and then constant name. This class is filled automatically at module load time. It is thus statically empty on purpose.
Special contants for a given detector are defined explicitly
-
class
AGIPD
[source]¶ Bases:
object
-
class
BadPixels
¶
-
class
BadPixelsCI
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from CI runs
-
class
BadPixelsDark
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from dark runs
-
class
BadPixelsFF
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from FF runs
-
class
BadPixelsPC
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from PC runs
-
class
Noise
¶
-
class
Offset
¶
-
class
RelativeGain
¶
-
class
SlopesCI
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain slopes derived from CI runs
-
class
SlopesFF
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain slopes derived from FF runs
-
class
SlopesPC
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain slopes derived from PC runs
-
class
ThresholdsCI
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain thresholds derived from CI run
-
class
ThresholdsDark
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain thresholds derived from dark images
-
class
ThresholdsPC
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain thresholds derived from PC runs
-
class
-
class
LPD
[source]¶ Bases:
object
-
class
BadPixels
¶
-
class
BadPixelsCI
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from CI runs
-
class
BadPixelsDark
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from dark runs
-
class
BadPixelsFF
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from FF runs
-
class
FFMap
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Flatfield map
-
class
GainAmpMap
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain amplification factor map
-
class
Noise
¶
-
class
Offset
¶
-
class
RelativeGain
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector relative gain.
-
class
SlopesCI
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain slopes derived from CI runs
-
class
SlopesFF
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Gain slopes derived from FF runs
-
class
-
class
ePix100
[source]¶ Bases:
object
-
class
BadPixels
¶
-
class
BadPixelsDark
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector Bad pixels
-
class
BadPixelsIlluminated
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector Bad pixels Illuminated
-
class
Noise
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector noise
-
class
Offset
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector offset/pedestal
-
class
RelativeGain
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector relative gain
-
class
-
class
ePix10K
[source]¶ Bases:
object
-
class
BadPixels
¶
-
class
BadPixelsDark
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector Bad pixels
-
class
BadPixelsIlluminated
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector Bad pixels Illuminated
-
class
Noise
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector noise
-
class
Offset
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector offset/pedestal
-
class
RelativeGain
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector relative gain
-
class
-
class
jungfrau
[source]¶ Bases:
object
-
class
BadPixels
¶
-
class
BadPixelsDark
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector Bad pixels
-
class
BadPixelsFF
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Bad pixels derived from FF runs
-
class
Noise
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector noise
-
class
Offset
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector offset/pedestal
-
class
RelativeGain
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector relative gain
-
class
-
class
-
class
iCalibrationDB.known_constants.
Noise
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector noise
-
class
iCalibrationDB.known_constants.
Offset
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector offset/pedestal
-
class
iCalibrationDB.known_constants.
RelativeGain
[source]¶ Bases:
iCalibrationDB.calibration_constant.CalibrationConstant
Detector relative gain
-
iCalibrationDB.known_constants.
cls
¶
-
iCalibrationDB.known_constants.
constant
¶
-
iCalibrationDB.known_constants.
dcls
¶
-
class
iCalibrationDB.known_detector_conditions.
AGIPDCondition
(memory_cells, bias_voltage, pixels_x=512, pixels_y=128, acquisition_rate=None, gain_setting=None, gain_mode=None)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
Basic dark AGIPD detector condition.
-
class
iCalibrationDB.known_detector_conditions.
AGIPDIlluminatedCondition
(memory_cells, bias_voltage, photon_energy, pixels_x=512, pixels_y=128, beam_energy=None, acquisition_rate=None, gain_setting=None, gain_mode=None)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.IlluminatedCondition
,iCalibrationDB.known_detector_conditions.AGIPDCondition
Illuminated AGIPD detector condition.
-
class
iCalibrationDB.known_detector_conditions.
BaseDetectorCondition
(memory_cells=1, bias_voltage=None, pixels_x=None, pixels_y=None)[source]¶ Bases:
iCalibrationDB.detector_condition.DetectorCondition
A basic operating condition valid for all semi-conductor detectors
-
class
iCalibrationDB.known_detector_conditions.
CCDCondition
(bias_voltage, integration_time, gain_setting, pixels_x=1024, pixels_y=512, temperature=291, freq_threshold=None)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
,iCalibrationDB.known_detector_conditions.CCDMixinCondition
Basic CCDs detector condition.
-
class
iCalibrationDB.known_detector_conditions.
CCDIlluminatedCondition
(bias_voltage, photon_energy, integration_time, gain_setting, pixels_x=1024, pixels_y=512, beam_energy=None, temperature=291)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.IlluminatedCondition
,iCalibrationDB.known_detector_conditions.CCDMixinCondition
Illuminated CCDs detector condition.
-
class
iCalibrationDB.known_detector_conditions.
Conditions
[source]¶ Bases:
object
Predefined detector conditions are grouped in this class.
-
class
Dark
[source]¶ Bases:
object
Conditions for non-illuminated detector
-
AGIPD
¶ alias of
AGIPDCondition
-
CCD
¶ alias of
CCDCondition
-
DSSC
¶ alias of
DSSCCondition
-
LPD
¶ alias of
LPDCondition
-
ePix100
¶ alias of
EPix100Condition
-
ePix10K
¶ alias of
EPix10KCondition
-
jungfrau
¶ alias of
JungfrauCondition
-
-
class
Illuminated
[source]¶ Bases:
object
Conditions for an illuminated detector, which is additionally specified by photon energy in keV and optionally, beam energy in μJ
-
AGIPD
¶ alias of
AGIPDIlluminatedCondition
-
CCD
¶ alias of
CCDIlluminatedCondition
-
DSSC
¶ alias of
DSSCCondition
-
LPD
¶ alias of
LPDIlluminatedCondition
-
ePix100
¶ alias of
EPix100IlluminatedCondition
-
ePix10K
¶ alias of
EPix10KIlluminatedCondition
-
jungfrau
¶ alias of
JungfrauIlluminatedCondition
-
-
class
-
class
iCalibrationDB.known_detector_conditions.
DSSCCondition
(memory_cells, bias_voltage, pixels_x=512, pixels_y=128, pulseid_checksum=None, acquisition_rate=None, target_gain=None, encoded_gain=None)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
Basic DSSC detector condition.
-
class
iCalibrationDB.known_detector_conditions.
EPix100Condition
(bias_voltage, integration_time, in_vacuum, pixels_x=708, pixels_y=768, temperature=288)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
,iCalibrationDB.known_detector_conditions.JungfrauMixinCondition
Basic xPix100 detector condition.
-
class
iCalibrationDB.known_detector_conditions.
EPix100IlluminatedCondition
(bias_voltage, photon_energy, integration_time, in_vacuum, pixels_x=708, pixels_y=768, beam_energy=None, temperature=288)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.IlluminatedCondition
,iCalibrationDB.known_detector_conditions.JungfrauMixinCondition
Illuminated xPix100 detector condition.
-
class
iCalibrationDB.known_detector_conditions.
EPix10KCondition
(bias_voltage, integration_time, in_vacuum, pixels_x=356, pixels_y=384, temperature=253, gain_setting=0)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
,iCalibrationDB.known_detector_conditions.JungfrauMixinCondition
Basic xPix100 detector condition.
-
class
iCalibrationDB.known_detector_conditions.
EPix10KIlluminatedCondition
(bias_voltage, photon_energy, integration_time, in_vacuum, pixels_x=356, pixels_y=384, beam_energy=None, temperature=253, gain_setting=0)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.IlluminatedCondition
,iCalibrationDB.known_detector_conditions.JungfrauMixinCondition
Illuminated xPix100 detector condition.
-
class
iCalibrationDB.known_detector_conditions.
IlluminatedCondition
(photon_energy=None, beam_energy=None, memory_cells=1, bias_voltage=None, pixels_x=None, pixels_y=None)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
A basic operating condition valid for detectors illuminated with photons.
-
class
iCalibrationDB.known_detector_conditions.
JungfrauCondition
(memory_cells, bias_voltage, integration_time, pixels_x=1024, pixels_y=512, temperature=291, gain_setting=0)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
,iCalibrationDB.known_detector_conditions.JungfrauMixinCondition
Basic Jungfrau detector condition.
-
class
iCalibrationDB.known_detector_conditions.
JungfrauIlluminatedCondition
(memory_cells, bias_voltage, photon_energy, integration_time, pixels_x=1024, pixels_y=512, beam_energy=None, temperature=291, gain_setting=0)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.IlluminatedCondition
,iCalibrationDB.known_detector_conditions.JungfrauMixinCondition
Illuminated Jungfrau detector condition.
-
class
iCalibrationDB.known_detector_conditions.
LPDCondition
(memory_cells, bias_voltage, pixels_x=256, pixels_y=256, capacitor='5pF')[source]¶ Bases:
iCalibrationDB.known_detector_conditions.BaseDetectorCondition
Basic LPD detector condition.
-
class
iCalibrationDB.known_detector_conditions.
LPDIlluminatedCondition
(memory_cells, bias_voltage, photon_energy, pixels_x=256, pixels_y=256, beam_energy=None, capacitor='5pf', category=0)[source]¶ Bases:
iCalibrationDB.known_detector_conditions.IlluminatedCondition
Illuminated LPD detector condition.
-
class
iCalibrationDB.known_versions.
Versions
[source]¶ Bases:
object
-
class
FromFile
(file_path, end=None)¶
-
class
Now
(end=None)¶
-
class
Timespan
(start, end=None)¶
-
class
-
class
iCalibrationDB.meta_data.
ConstantMetaData
[source]¶ Bases:
iCalibrationDB.util.DictConvertable
-
calibration_constant
¶ The calibration constant this meta data refers to.
An object of type CalibrationConstant is expected. A selection of predefined constants is available in the known_constants module.
-
calibration_constant_version
¶ The version of the constant this meta data refers to.
An object of type ConstantVersion is expected. A selection of predefined versions is available in the known_versions module.
-
calibration_hash_schema_version
¶ Version of the injection Hash schema to use.
The default version is usually appropriate.
-
detector_condition
¶ The detector operating condition the constant is valid for/ is requested for.
An object of type DetectorCondition is expected. A selection of predefined operating conditions is available in the
-
get_from_version_info
(ccv)[source]¶ - Return a constant from a dictionary descriptor returned by `retrieve(…, version_info=True)
Parameters: ccv – calibration constant version
-
mandatory
= ['detector_condition', 'calibration_constant_version', 'calibration_constant', 'producing_device']¶
-
producing_device
¶ (Karabo) device producing this constant. Defaults to “interactive”.
-
retrieve
(receiver: str, when: Optional[str] = None, silent: Optional[bool] = True, timeout: Optional[int] = 30000, meta_only: Optional[bool] = False, version_info: Optional[bool] = False, strategy: Optional[str] = 'pdu_closest_by_time')[source]¶ Retrieve a constant and its meta data from the database at receiver.
Receiver should be ZMQ address of of the form tcp://localhost:5050. The when parameter defaults to None: in this case the most current constant version will be requested. To request a version for a specific time, set when an iso-formatted time string, e.g. using datetime.now().isoformat().
If a constant is successfully returned, the requesting ConstantMetaData object updates itself to reflect the parameter conditions of the constant.
The constant itself can then be found at self.calibration_constant.data.
If meta_only is set, then no constant data is transferred. Instead constants are read from a .h5 file by the client. The variable meta_only is overwritten by the environmental variable CAL_DB_METAONLY, if it is defined.
if version_info flag is True, then function returns a list of meta-data for constant-versions. The meta_only flag in this case is not used. :param receiver: ZMQ address, e. g. tcp://localhost:5050 :param timeout: Timeout for zmq request :param strategy: Default pdu_closest_by_time, options:
- pdu_closest_by_time: use physical detector unit to
- retrieve CCV closest to measured-at
- detector_closest_by_time: use karabo-id and karabo-da to
- retrieve CCV closest to measured-time
- pdu_prior_in_time: use PDU to retrieve CCV prior on time
- only to measured-at
Raises: A RuntimeError if database communication fails or no matching constant is found.
-
retrieve_from_version_info
(ccv)[source]¶ - Retrieve a constant and meta data from a dictionary descriptor returned by `retrieve(…, version_info=True)
Parameters: ccv – calibration constant version
-
retrieve_pdus_for_detector
(receiver: str, karabo_id: str, snapshot_at: Optional[str] = '', timeout: Optional[int] = 30000) → List[dict][source]¶ Retrieve physical detector units corresponding to a detector identifier
Parameters: - receiver – ZMQ address, e. g. tcp://localhost:5050
- karabo_id – The karabo id which is used as a detector identifier in CalCat
- snapshot_at – CalCat database snapshot
- timeout – Timeout for zmq request
Returns:
-
send
(receiver: str, silent: Optional[bool] = True, timeout: Optional[int] = 30000)[source]¶ Send a constant and its meta data to the database at receiver.
Receiver should be ZMQ address of of the form tcp://localhost:5050.
Raises: A RuntimeError if database communication fails or no matching conditions are found.
-
update_flg_good_quality
(receiver, cvv_id, flg_good_quality, silent=True, timeout=30000)[source]¶ Update flg_good_quality of the calibration constant version.
Parameters: - receiver – ZMQ address, e. g. tcp://localhost:5050
- cvv_id – calibration constant version if
- flg_good_quality – flg_good_quality to be set
- silent – Set to False to print information
- timeout – Timeout for zmq request
Returns: response message
Raises: A RuntimeError if database communication fails or update_keys are not set.
-
-
class
iCalibrationDB.operating_condition.
OperatingCondition
[source]¶ Bases:
iCalibrationDB.util.DictConvertable
A class describing a detector operating condition parameter.
It is mandatory to give a name and value.
Optionally, acceptable upper and lower deviations, and whether these are to be evaluated logarithmically can be specified.
-
available
¶ Internal parameter, should be kept at its default (True).
-
description
¶ A description of the property
-
logarithmic
¶ If set to True, deviations are evaluated as decades of a logarithm
-
lower_deviation
¶ Absolute deviation to lower values that is acceptable
-
mandatory
= ['flg_available', 'flg_logarithmic', 'parameter_name', 'value']¶
-
name
¶ The property described by this condition. May contain spaces
-
upper_deviation
¶ Absolute deviation to lower higher that is acceptable
-
value
¶ Value of the variable. Needs to be convertable to float.
-
-
class
iCalibrationDB.settings.
Settings
[source]¶ Bases:
object
-
base_path
= '/gpfs/exfel/d/cal/caldb_store/'¶
-
-
class
iCalibrationDB.util.
DictConvertable
[source]¶ Bases:
object
A class whose properties are convertible to a dict.
Overwrite the mandatory list in derived classes to specify mandatory properties.
Overwrite the retrieve_optionals in derived classes to specify which parameters out of mandatory are optional for retrieve queries.
-
mandatory
= []¶
-
retrieve_optionals
= []¶
-