"count_lit_pixels = False # Count the number of pixels registering photons\n",
"spi_hitfinding = False # Find hits using lit-pixel counter\n",
"\n",
"# Optional auxiliary devices\n",
"use_ppu_device = '' # Device ID for a pulse picker device to only process picked trains, empty string to disable\n",
...
...
@@ -108,6 +109,16 @@
"recast_image_data = '' # Cast data to a different dtype before saving\n",
"compress_fields = ['gain', 'mask'] # Datasets in image group to compress.\n",
"\n",
"# SPI hit-finder parameters\n",
"spi_hf_modules = [3, 4, 8, 15] # Use specified modules for SPI hitfinding\n",
"spi_hf_mode = \"adaptive\" # The method to compute threshold for hitscores in SPI hitfinding: `fixed` or `adaptive`\n",
"spi_hf_snr = 4.0 # Siginal-to-noise ration for adaptive threshold in SPI hitfinding\n",
"spi_hf_min_scores = 100 # The minimal size of events to compute adaptive threshold in SPI hitfinding\n",
"spi_hf_fixed_threshold = 0 # The fixed threshold value\n",
"spi_hf_hitrate_window_size = 200 # The window size for runnig average of hitrate in trains\n",
"spi_hf_miss_fraction = 1 # The fraction of misses to select along with hits\n",
"spi_hf_miss_fraction_base = \"hit\" # The base to compute the number of misses to select: the number of hits (`hit`) or misses (`miss`)\n",
"\n",
"# Plotting parameters\n",
"skip_plots = False # exit after writing corrected files and metadata\n",
"cell_id_preview = 1 # cell Id used for preview in single-shot plots\n",
...
...
%% Cell type:markdown id: tags:
# AGIPD Offline Correction #
Author: European XFEL Detector Group, Version: 2.0
Offline Calibration for the AGIPD Detector
%% Cell type:code id: tags:
``` python
in_folder="/gpfs/exfel/exp/MID/202201/p002834/raw"# the folder to read data from, required
out_folder="/gpfs/exfel/data/scratch/esobolev/pycal_litfrm/p002834/r0225"# the folder to output to, required
metadata_folder=""# Directory containing calibration_metadata.yml when run by xfel-calibrate
sequences=[-1]# sequences to correct, set to -1 for all, range allowed
overwrite=False# IGNORED, NEEDED FOR COMPATIBILITY.
modules=[-1]# modules to correct, set to -1 for all, range allowed
train_ids=[-1]# train IDs to correct, set to -1 for all, range allowed
run=225# runs to process, required
karabo_id="MID_DET_AGIPD1M-1"# karabo karabo_id
karabo_da=['-1']# a list of data aggregators names, Default [-1] for selecting all data aggregators
receiver_template="{}CH0"# inset for receiver devices
path_template='RAW-R{:04d}-{}-S{:05d}.h5'# the template to use to access data
instrument_source_template='{}/DET/{}:xtdf'# path in the HDF5 file to images
index_source_template='INDEX/{}/DET/{}:xtdf/'# path in the HDF5 file to images
ctrl_source_template='{}/MDL/FPGA_COMP'# path to control information
karabo_id_control="MID_EXP_AGIPD1M1"# karabo-id for control device
slopes_ff_from_files=""# Path to locally stored SlopesFF and BadPixelsFF constants, loaded in precorrection notebook
creation_time=""# To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. "2022-06-28 13:00:00"
cal_db_interface="tcp://max-exfl-cal001:8015#8045"# the database interface to use
cal_db_timeout=30000# in milliseconds
creation_date_offset="00:00:00"# add an offset to creation date, e.g. to get different constants
cal_db_root=""# The calibration database root path to access constant files. e.g. accessing constants from the test database /gpfs/exfel/d/cal_tst/caldb_store.
mem_cells=-1# Number of memory cells used, set to 0 to automatically infer
bias_voltage=-1# bias voltage, set to 0 to use stored value in slow data.
acq_rate=-1.# the detector acquisition rate, use 0 to try to auto-determine
gain_setting=-1# the gain setting, use -1 to use value stored in slow data.
gain_mode=-1# gain mode (0: adaptive, 1-3 fixed high/med/low, -1: read from CONTROL data)
max_pulses=[0,352,1]# range list [st, end, step] of memory cell indices to be processed within a train. 3 allowed maximum list input elements.
mem_cells_db=-1# set to a value different than 0 to use this value for DB queries
integration_time=-1# integration time, negative values for auto-detection.
# Correction parameters
blc_noise_threshold=5000# above this mean signal intensity now baseline correction via noise is attempted
cm_dark_fraction=0.66# threshold for fraction of empty pixels to consider module enough dark to perform CM correction
cm_dark_range=[-50.,30]# range for signal value ADU for pixel to be consider as a dark pixel
cm_n_itr=4# number of iterations for common mode correction
hg_hard_threshold=1000# threshold to force medium gain offset subtracted pixel to high gain
mg_hard_threshold=1000# threshold to force medium gain offset subtracted pixel from low to medium gain
noisy_adc_threshold=0.25# threshold to mask complete adc
ff_gain=7.2# conversion gain for absolute FlatField constants, while applying xray_gain
photon_energy=-1.0# photon energy in keV, non-positive value for XGM autodetection
rounding_threshold=0.5# the fraction to round to down, 0.5 for standard rounding rule
cs_mg_adjust=7e3# Value to adjust medium gain when correcting with current source. This is used when `adjust_mg_baseline` is True.
# Correction Booleans
only_offset=False# Apply only Offset correction. if False, Offset is applied by Default. if True, Offset is only applied.
# TODO: Remove this boolean parameter an replace rel_gain_mode with it.
rel_gain=False
rel_gain_mode="off"# Select relative gain correction. Choices [`PC`, `CS`, `off`]. (`PC`: Pulse Capacitor, `CS`: Current Source, `off`: Disable relative gain correction). Default: off.
xray_gain=False# do relative gain correction based on xray data
blc_noise=False# if set, baseline correction via noise peak location is attempted
blc_stripes=False# if set, baseline corrected via stripes
blc_hmatch=False# if set, base line correction via histogram matching is attempted
match_asics=False# if set, inner ASIC borders are matched to the same signal level
adjust_mg_baseline=False# adjust medium gain baseline to match highest high gain value
zero_nans=False# set NaN values in corrected data to 0
zero_orange=False# set to 0 very negative and very large values in corrected data
blc_set_min=False# Shift to 0 negative medium gain pixels after offset corr
corr_asic_diag=False# if set, diagonal drop offs on ASICs are corrected
force_hg_if_below=False# set high gain if mg offset subtracted value is below hg_hard_threshold
force_mg_if_below=False# set medium gain if mg offset subtracted value is below mg_hard_threshold
mask_noisy_adc=False# Mask entire ADC if they are noise above a relative threshold
mask_zero_std=False# Mask pixels with zero standard deviation across train
low_medium_gap=False# 5 sigma separation in thresholding between low and medium gain
round_photons=False# Round to absolute number of photons, only use with gain corrections
# Additional processing
count_lit_pixels=False# Count the number of pixels registering photons
spi_hitfinding=False# Find hits using lit-pixel counter
# Optional auxiliary devices
use_ppu_device=''# Device ID for a pulse picker device to only process picked trains, empty string to disable
ppu_train_offset=0# When using the pulse picker, offset between the PPU's sequence start and actually picked train
require_ppu_trigger=False# Optional protection against running without PPU or without triggering trains.
use_litframe_finder='off'# Process only illuminated frames: 'off' - disable, 'device' - use online device data, 'offline' - use offline algorithm, 'auto' - choose online/offline source automatically (default)
litframe_device_id=''# Device ID for a lit frame finder device, empty string to auto detection
energy_threshold=-1000# The low limit for the energy (uJ) exposed by frames subject to processing. If -1000, selection by pulse energy is disabled
use_super_selection='cm'# Make a common selection for entire run: 'off' - disable, 'final' - enable for final selection, 'cm' - enable only for common mode correction
use_xgm_device=''# DoocsXGM device ID to obtain actual photon energy, operating condition else.
# Output parameters
recast_image_data=''# Cast data to a different dtype before saving
compress_fields=['gain','mask']# Datasets in image group to compress.
# SPI hit-finder parameters
spi_hf_modules=[3,4,8,15]# Use specified modules for SPI hitfinding
spi_hf_mode="adaptive"# The method to compute threshold for hitscores in SPI hitfinding: `fixed` or `adaptive`
spi_hf_snr=4.0# Siginal-to-noise ration for adaptive threshold in SPI hitfinding
spi_hf_min_scores=100# The minimal size of events to compute adaptive threshold in SPI hitfinding
spi_hf_fixed_threshold=0# The fixed threshold value
spi_hf_hitrate_window_size=200# The window size for runnig average of hitrate in trains
spi_hf_miss_fraction=1# The fraction of misses to select along with hits
spi_hf_miss_fraction_base="hit"# The base to compute the number of misses to select: the number of hits (`hit`) or misses (`miss`)
# Plotting parameters
skip_plots=False# exit after writing corrected files and metadata
cell_id_preview=1# cell Id used for preview in single-shot plots
cmap="viridis"# matplolib.colormap for almost all heatmap. Other options ['plasma', 'inferno', 'magma', 'cividis', 'jet', ...]
# Parallelization parameters
chunk_size=1000# Size of chunk for image-wise correction
n_cores_correct=16# Number of chunks to be processed in parallel
n_cores_files=4# Number of files to be processed in parallel
sequences_per_node=2# number of sequence files per cluster node if run as SLURM job, set to 0 to not run SLURM parallel
max_nodes=8# Maximum number of SLURM jobs to split correction work into
max_tasks_per_worker=1# the number of tasks a correction pool worker process can complete before it will exit and be replaced with a fresh worker process. Leave as -1 to keep worker alive as long as pool.