Author: European XFEL Detector Group, Version: 2.0
Analyzes Jungfrau dark image data to deduce offset, noise and resulting bad pixel maps
%% Cell type:code id: tags:
``` python
in_folder='/gpfs/exfel/exp/SPB/202130/p900204/raw/'# folder under which runs are located, required
out_folder='/gpfs/exfel/data/scratch/ahmedk/test/remove'# path to place reports at, required
metadata_folder=''# Directory containing calibration_metadata.yml when run by xfel-calibrate
run_high=141# run number for G0 dark run, required
run_med=142# run number for G1 dark run, required
run_low=143# run number for G2 dark run, required
# Parameters used to access raw data.
karabo_da=['JNGFR01','JNGFR02','JNGFR03','JNGFR04','JNGFR05','JNGFR06','JNGFR07','JNGFR08']# list of data aggregators, which corresponds to different JF modules
karabo_id='SPB_IRDA_JF4M'# karabo_id (detector identifier) prefix of Jungfrau detector to process.
karabo_id_control=''# if control is on a different ID, set to empty string if it is the same a karabo-id
receiver_template='JNGFR{:02}'# inset for receiver devices
instrument_source_template='{}/DET/{}:daqOutput'# template for instrument source name (filled with karabo_id & receiver_id). e.g. 'SPB_IRDA_JF4M/DET/JNGFR01:daqOutput'
ctrl_source_template='{}/DET/CONTROL'# template for control source name (filled with karabo_id_control)
# Parameters for calibration database and storing constants.
use_dir_creation_date=True# use dir creation date
cal_db_interface='tcp://max-exfl016:8016'# calibrate db interface to connect to
cal_db_timeout=300000# timeout on caldb requests
local_output=True# output constants locally
db_output=False# output constants to database
# Parameters affecting creating dark calibration constants.
badpixel_threshold_sigma=5.# bad pixels defined by values outside n times this std from median
offset_abs_threshold_low=[1000,10000,10000]# absolute bad pixel threshold in terms of offset, lower values
offset_abs_threshold_high=[8000,15000,15000]# absolute bad pixel threshold in terms of offset, upper values
max_trains=0# Maximum trains to process darks. Set to 0 to process all available train images.
min_trains=1# Minimum number of trains that should be available to process dark constants. Default 1.
manual_slow_data=False# if true, use manually entered bias_voltage and integration_time values
time_limits=0.025# to find calibration constants later on, the integration time is allowed to vary by 0.5 us
# Parameters to be used for injecting dark calibration constants.
integration_time=1000# integration time in us, will be overwritten by value in file
gain_setting=0# 0 for dynamic, forceswitchg1, forceswitchg2, 1 for dynamichg0, fixgain1, fixgain2. Will be overwritten by value in file
gain_mode=0# 1 if medium and low runs are fixgain1 and fixgain2, otherwise 0. It will be overwritten by value in file, if manual_slow_data
bias_voltage=90# sensor bias voltage in V, will be overwritten by value in file
memory_cells=16# number of memory cells
# TODO: this is used for only Warning check at AGIPD dark.
# Need to rethink if it makes sense to use it here as well.
# Only for dynamic medium and low gain runs [forceswitchg1, forceswitchg2] in burst mode.
ifgain_mode==0andgain>0andmemory_cells==16:
# 255 similar to the receiver which uses the 255
# value to indicate a cell without an image.
# image shape for forceswitchg1 and forceswitchg2 = (1024, 512, 2, trains)
# compared to expected shape of (1024, 512, 16, trains) for high gain run.
acelltable[1:]=255
# Calculate offset and noise maps
context.map(process_cell,range(memory_cells))
step_timer.done_step(f'Creating Offset and noise constants for a module.')
```
%% Cell type:markdown id: tags:
## Offset and Noise Maps ##
Below offset and noise maps for the high ($g_0$) gain stage are shown, alongside the distribution of these values. One expects block-like structures mapping to the ASICs of the detector
%% Cell type:code id: tags:
``` python
g_name=['G0','G1','G2']
g_range=[(0,8000),(8000,16000),(8000,16000)]
n_range=[(0.,50.),(0.,50.),(0.,50.)]
unit='[ADCu]'
```
%% Cell type:code id: tags:
``` python
# TODO: Fix plots arrangment and speed for Jungfrau burst mode.