Skip to content
Snippets Groups Projects

[AGIPD] [DARK] Add support for AGIPD mini half in dark calibration

Merged Cyril Danilevski requested to merge feat/AGIPD_mini_half_darks into master
2 files
+ 64
28
Compare changes
  • Side-by-side
  • Inline
Files
2
``` python
``` python
cluster_profile = "noDB" # The ipcluster profile to use
cluster_profile = "noDB" # The ipcluster profile to use
in_folder = "/gpfs/exfel/d/raw/SPB/202030/p900138" # path to input data, required
in_folder = "/gpfs/exfel/d/raw/DETLAB/202031/p900172/" # path to input data, required
out_folder = "/gpfs/exfel/data/scratch/ahmedk/test/AGIPDbad_sep64" # path to output to, required
out_folder = "/gpfs/exfel/data/scratch/ahmedk/test/miniHalfAGIPD" # path to output to, required
sequences = [0] # sequence files to evaluate.
sequences = [0] # sequence files to evaluate.
modules = [-1] # list of modules to evaluate, RANGE ALLOWED
modules = [-1] # list of modules to evaluate, RANGE ALLOWED
run_high = 167 # run number in which high gain data was recorded, required
run_high = 84 # run number in which high gain data was recorded, required
run_med = 168 # run number in which medium gain data was recorded, required
run_med = 87 # run number in which medium gain data was recorded, required
run_low = 169 # run number in which low gain data was recorded, required
run_low = 88 # run number in which low gain data was recorded, required
karabo_id = "SPB_DET_AGIPD1M-1" # karabo karabo_id
karabo_id = "DETLAB_DET_AGIPD500K2G" # karabo karabo_id
karabo_da = ['-1'] # a list of data aggregators names, Default [-1] for selecting all data aggregators
karabo_da = ['-1'] # a list of data aggregators names, Default [-1] for selecting all data aggregators
receiver_id = "{}CH0" # inset for receiver devices
receiver_id = "{}CH0" # inset for receiver devices
path_template = 'RAW-R{:04d}-{}-S{:05d}.h5' # the template to use to access data
path_template = 'RAW-R{:04d}-{}-S{:05d}.h5' # the template to use to access data
mem_cells = 0 # number of memory cells used, set to 0 to automatically infer
mem_cells = 0 # number of memory cells used, set to 0 to automatically infer
bias_voltage = 300 # detector bias voltage
bias_voltage = 300 # detector bias voltage
gain_setting = 0.1 # the gain setting, use 0.1 to try to auto-determine
gain_setting = 0.0 # the gain setting, use 0.1 to try to auto-determine
acq_rate = 0. # the detector acquisition rate, use 0 to try to auto-determine
acq_rate = 1.1 # the detector acquisition rate, use 0 to try to auto-determine
interlaced = False # assume interlaced data format, for data prior to Dec. 2017
interlaced = False # assume interlaced data format, for data prior to Dec. 2017
rawversion = 2 # RAW file format version
rawversion = 2 # RAW file format version
cal_db_interface = get_random_db_interface(cal_db_interface)
cal_db_interface = get_random_db_interface(cal_db_interface)
print(f'Calibration database interface: {cal_db_interface}')
print(f'Calibration database interface: {cal_db_interface}')
loc = None
instrument = karabo_id.split("_")[0]
instrument = karabo_id.split("_")[0]
 
if instrument == "SPB":
if instrument == "SPB":
dinstance = "AGIPD1M1"
dinstance = "AGIPD1M1"
else:
nmods = 16
 
elif instrument == "MID":
dinstance = "AGIPD1M2"
dinstance = "AGIPD1M2"
 
nmods = 16
 
# TODO: Remove DETLAB
 
elif instrument == "HED" or instrument == "DETLAB":
 
dinstance = "AGIPD500K"
 
nmods = 8
control_names = ['{}/r{:04d}/RAW-R{:04d}-{}-S00000.h5'.format(in_folder, r, r, karabo_da_control)
control_names = ['{}/r{:04d}/RAW-R{:04d}-{}-S00000.h5'.format(in_folder, r, r, karabo_da_control)
for r in (run_high, run_med, run_low)]
for r in (run_high, run_med, run_low)]
``` python
``` python
gain_names = ['High', 'Medium', 'Low']
runs = [run_high, run_med, run_low]
runs = [run_high, run_med, run_low]
if "{" in h5path_ctrl:
if "{" in h5path_ctrl:
``` python
``` python
if karabo_da[0] == '-1':
if karabo_da[0] == '-1':
if modules[0] == -1:
if modules[0] == -1:
modules = list(range(16))
modules = list(range(nmods))
karabo_da = ["AGIPD{:02d}".format(i) for i in modules]
karabo_da = ["AGIPD{:02d}".format(i) for i in modules]
else:
else:
modules = [int(x[-2:]) for x in karabo_da]
modules = [int(x[-2:]) for x in karabo_da]
acq_rate: float,
acq_rate: float,
h5path: str,
h5path: str,
h5path_idx: str,
h5path_idx: str,
 
control_names: List[str],
 
karabo_id_control: str,
inp: Tuple[str, int, int]) -> Tuple[np.array, np.array, np.array, np.array, int, np.array, int, float]:
inp: Tuple[str, int, int]) -> Tuple[np.array, np.array, np.array, np.array, int, np.array, int, float]:
import numpy as np
import numpy as np
import copy
import copy
p = partial(characterize_module, IL_MODE, max_cells,
p = partial(characterize_module, IL_MODE, max_cells,
(thresholds_offset_hard, thresholds_offset_sigma,
(thresholds_offset_hard, thresholds_offset_sigma,
thresholds_noise_hard, thresholds_noise_sigma),
thresholds_noise_hard, thresholds_noise_sigma),
rawversion, karabo_id, acq_rate, h5path, h5path_idx)
rawversion, karabo_id, acq_rate, h5path, h5path_idx,
 
control_names, karabo_id_control)
# Don't remove. Used for Debugging.
# Don't remove. Used for Debugging.
#results = list(map(p, inp))
#results = list(map(p, inp))
``` python
``` python
mnames=[]
# TODO: add show_processed_modules diagram for Mini-Half AGIPD
for i in modules:
if dinstance != "AGIPD500K":
qm = f"Q{i//4+1}M{i % 4+1}"
mnames=[]
mnames.append(qm)
for i in modules:
display(Markdown(f'## Position of the module {qm} and it\'s ASICs##'))
qm = f"Q{i//4+1}M{i % 4+1}"
show_processed_modules(dinstance, constants=None, mnames=mnames, mode="position")
mnames.append(qm)
 
display(Markdown(f'## Position of the module {qm} and it\'s ASICs##'))
 
show_processed_modules(dinstance, constants=None, mnames=mnames, mode="position")
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Loading