Skip to content
Snippets Groups Projects
Commit 8c5bfd65 authored by Philipp Schmidt's avatar Philipp Schmidt
Browse files

Expose compressed image fields as parameters in AGIPD correct

parent ea1b0f06
No related branches found
No related tags found
1 merge request!657[AGIPD] Add support to round intensity to absolute photon numbers
......@@ -33,7 +33,7 @@
"ctrl_source_template = '{}/MDL/FPGA_COMP' # path to control information\n",
"karabo_id_control = \"SPB_IRU_AGIPD1M1\" # karabo-id for control device\n",
"\n",
"slopes_ff_from_files = \"\" # Path to locally stored SlopesFF and BadPixelsFF constants\n",
"slopes_ff_from_files = \"\" # Path to locally stored SlopesFF and BadPixelsFF constants, loaded in precorrection notebook\n",
"\n",
"use_dir_creation_date = True # use the creation data of the input dir for database queries\n",
"cal_db_interface = \"tcp://max-exfl016:8015#8045\" # the database interface to use\n",
......@@ -88,11 +88,14 @@
"use_litframe_device = '' # Device ID for a lit frame finder device to only process illuminated frames, empty string to disable\n",
"energy_threshold = -1000 # The low limit for the energy (uJ) exposed by frames subject to processing. If -1000, selection by pulse energy is disabled\n",
"\n",
"# Output parameters\n",
"compress_fields = ['gain', 'mask'] # Datasets in image group to compress.\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",
"\n",
"# Paralellization parameters\n",
"# Parallelization parameters\n",
"chunk_size = 1000 # Size of chunk for image-wise correction\n",
"n_cores_correct = 16 # Number of chunks to be processed in parallel\n",
"n_cores_files = 4 # Number of files to be processed in parallel\n",
......@@ -491,7 +494,9 @@
"agipd_corr.cm_dark_fraction = cm_dark_fraction\n",
"agipd_corr.cm_n_itr = cm_n_itr\n",
"agipd_corr.noisy_adc_threshold = noisy_adc_threshold\n",
"agipd_corr.ff_gain = ff_gain"
"agipd_corr.ff_gain = ff_gain\n",
"\n",
"agipd_corr.compress_fields = compress_fields",
]
},
{
......@@ -668,6 +673,7 @@
"\n",
" img_counts = pool.map(agipd_corr.apply_selected_pulses, range(len(file_batch)))\n",
" step_timer.done_step(\"Applying selected cells after common mode correction\")\n",
" \n",
" # Perform image-wise correction\"\n",
" pool.starmap(agipd_corr.gain_correction, imagewise_chunks(img_counts))\n",
" step_timer.done_step(\"Gain corrections\")\n",
......
......@@ -343,6 +343,9 @@ class AgipdCorrections:
self.noisy_adc_threshold = 0.25
self.ff_gain = 1
# Output parameters
self.compress_fields = ['gain', 'mask']
# Shared variables for data and constants
self.shared_dict = []
self.offset = {}
......@@ -474,7 +477,6 @@ class AgipdCorrections:
image_fields = [
'trainId', 'pulseId', 'cellId', 'data', 'gain', 'mask', 'blShift',
]
compress_fields = ['gain', 'mask']
n_img = data_dict['nImg'][0]
if n_img == 0:
......@@ -498,7 +500,7 @@ class AgipdCorrections:
# so it's efficient to examine the file structure.
for field in image_fields:
arr = data_dict[field][:n_img]
if field in compress_fields:
if field in self.compress_fields:
# gain/mask compressed with gzip level 1, but not
# checksummed as we would have to implement this.
kw = dict(
......@@ -517,7 +519,7 @@ class AgipdCorrections:
# Write the corrected data
for field in image_fields:
if field in compress_fields:
if field in self.compress_fields:
self._write_compressed_frames(
image_grp[field], data_dict[field][:n_img],
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment