" print(f\"Calibration constant {const} is stored locally.\\n\")\n",
" \n",
...
...
%% Cell type:markdown id: tags:
# DSSC Characterize Dark Images #
Author: S. Hauf, Version: 0.1
The following code analyzes a set of dark images taken with the DSSC detector to deduce detector offsets and noise. Data for the detector is presented in one run and don't acquire multiple gain stages.
The notebook explicitely does what pyDetLib provides in its offset calculation method for streaming data.
%% Cell type:code id: tags:
``` python
cluster_profile="noDB"# The ipcluster profile to use
in_folder="/gpfs/exfel/exp/SCS/202031/p900170/raw"# path to input data, required
out_folder="/gpfs/exfel/data/scratch/samartse/data/DSSC"# path to output to, required
sequences=[0]# sequence files to evaluate.
modules=[-1]# modules to run for
run=223#run number in which data was recorded, required
karabo_id="SCS_DET_DSSC1M-1"# karabo karabo_id
karabo_da=['-1']# a list of data aggregators names, Default [-1] for selecting all data aggregators
receiver_id="{}CH0"# inset for receiver devices
path_template='RAW-R{:04d}-{}-S{:05d}.h5'# the template to use to access data
h5path='/INSTRUMENT/{}/DET/{}:xtdf/image'# path in the HDF5 file to images
h5path_idx='/INDEX/{}/DET/{}:xtdf/image'# path in the HDF5 file to images
slow_data_pattern='RAW-R{}-DA{}-S00000.h5'
use_dir_creation_date=True# use the dir creation date for determining the creation time
cal_db_interface="tcp://max-exfl016:8020"# the database interface to use
cal_db_timeout=3000000# timeout on caldb requests"
local_output=True# output constants locally
db_output=False# output constants to database
mem_cells=0# number of memory cells used, set to 0 to automatically infer
bias_voltage=100# detector bias voltage
rawversion=2# RAW file format version
thresholds_offset_sigma=3.# thresholds in terms of n sigma noise for offset deduced bad pixels
thresholds_offset_hard=[4,125]# thresholds in absolute ADU terms for offset deduced bad pixels,
# minimal threshold at 4 is set at hardware level, DSSC full range 0-511
thresholds_noise_sigma=3.# thresholds in terms of n sigma noise for offset deduced bad pixels
thresholds_noise_hard=[0.001,3]# thresholds in absolute ADU terms for offset deduced bad pixels
offset_numpy_algorithm="mean"
instrument="SCS"# the instrument
high_res_badpix_3d=False# set this to True if you need high-resolution 3d bad pixel plots. Runtime: ~ 1h
print(f"Will process a total of {total_sequences} file.")
```
%% Cell type:markdown id: tags:
## Calculate Offsets, Noise and Thresholds ##
The calculation is performed per-pixel and per-memory-cell. Offsets are simply the median value for a set of dark data taken at a given gain, noise the standard deviation, and gain-bit values the medians of the gain array.
Single cell overviews allow to identify potential effects on all memory cells, e.g. on sensor level. Additionally, they should serve as a first sanity check on expected behaviour, e.g. if structuring on the ASIC level is visible in the offsets, but otherwise no immediate artifacts are visible.
The following tables show summary information for the evaluated module. Values for currently evaluated constants are compared with values for pre-existing constants retrieved from the calibration database.