"creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. \"2022-06-28 13:00:00\"\n",
"g_map_old = '' # '/gpfs/exfel/data/user/mramilli/jungfrau/module_PSI_gainmaps/M302/gainMaps_M302_2022-02-23.h5' # old gain map file path to calculate gain ratios G0/G1 and G1/G2. Set to \"\" to get last gain constant from the database.\n",
"old_gain_dataset_name = 'gain_map_g0' # name of the data structure in the old gain map\n",
"correct_offset = True # correct the photon peak value with a pedestal fit position\n",
"correct_offset = False # correct the photon peak value with a pedestal fit position\n",
"db_output = False\n",
"local_output = True\n",
"send_bpix = False # TODO: check why separate BPx from Gain.\n",
...
...
%% Cell type:markdown id: tags:
# Create Gain Map
Author: European XFEL Detector Group, Version: 1.0
Converts the map with fit value of the photon peak into a gain conversion factor map.
Calculates the bad pixels map according to:
- Failed fit
- Not enough entries in the fit
- Gain value deviation too high
%% Cell type:code id: tags:
``` python
in_folder='/gpfs/exfel/exp/MID/202330/p900322/raw'# RAW data path, required
out_folder="/gpfs/exfel/data/scratch/ahmedk/test/jf_ff/gain_maps"# Output path for gain data, required
metadata_folder=''# Directory containing calibration_metadata.yml when run by xfel-calibrate
runs=[94]# Number of high gain
karabo_id='MID_EXP_JF500K2'# karabo prefix of Jungfrau devices
karabo_da=['']
_fit_func='CHARGE_SHARING'# function used to fit the single photon peak
gains=[0,1,2]
# Parameter conditions
bias_voltage=-1# detector bias voltage
integration_time=-1.# the detector acquisition rate, use 0 to try to auto-determine
creation_time=""# To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. "2022-06-28 13:00:00"
g_map_old=''# '/gpfs/exfel/data/user/mramilli/jungfrau/module_PSI_gainmaps/M302/gainMaps_M302_2022-02-23.h5' # old gain map file path to calculate gain ratios G0/G1 and G1/G2. Set to "" to get last gain constant from the database.
old_gain_dataset_name='gain_map_g0'# name of the data structure in the old gain map
correct_offset=True# correct the photon peak value with a pedestal fit position
correct_offset=False# correct the photon peak value with a pedestal fit position
db_output=False
local_output=True
send_bpix=False# TODO: check why separate BPx from Gain.
g0_fit_dataset='gainMap_fit'# name of the data structure in the fit files
E_ph=8.048# photon energy of the peak fitted
badpixel_threshold_sigma=3.# number of std in gain distribution to mark bad pixels
_roi=[0,1024,0,256]# ROI to consider to evaluate gain distribution (for bad pixels evaluation)
control_src_template='{}/DET/CONTROL'
# CALCAT API parameters
cal_db_interface="tcp://max-exfl-cal-001:8020"# the database interface to use
Currently only the high gain map can be generated. To calculate the new medium and low gain maps, we depend on the past gain maps to calculate both gain maps from the ratio on G0/G1 and G1/G2. If we can't use any old gain maps, it would be impossible to calculate gain maps for medium and low gain at the moment.
%% Cell type:code id: tags:
``` python
jf_cal=JUNGFRAU_CalibrationData(
detector_name=karabo_id,
sensor_bias_voltage=bias_voltage,
event_at=None,
modules=karabo_da,
memory_cells=memory_cells,
integration_time=integration_time,
gain_setting=0,# TODO: No gain setting 1? I use 0 for now as I don't see gain_setting used anywhere for the 3 notebooks.