Skip to content
Snippets Groups Projects

[Jungfrau][Dark] Feat: Skip first ntrains

Merged Karim Ahmed requested to merge feat/exclude_first_ntrains into master
1 unresolved thread
1 file
+ 10
6
Compare changes
  • Side-by-side
  • Inline
offset_abs_threshold_high = [8000, 15000, 15000] # absolute bad pixel threshold in terms of offset, upper values
offset_abs_threshold_high = [8000, 15000, 15000] # absolute bad pixel threshold in terms of offset, upper values
max_trains = 1000 # Maximum trains to process darks. Set to 0 to process all available train images. 1000 trains is enough resolution to create the dark constants
max_trains = 1000 # Maximum trains to process darks. Set to 0 to process all available train images. 1000 trains is enough resolution to create the dark constants
min_trains = 100 # Minimum number of trains to process dark constants. Raise a warning if the run has fewer trains.
min_trains = 100 # Minimum number of trains to process dark constants. Raise a warning if the run has fewer trains.
skip_ntrains = 0 # Skip first number of trains and don't include them in dark processing.
skip_first_ntrains = 0 # Skip first number of trains and don't include them in dark processing.
manual_slow_data = False # if true, use manually entered bias_voltage and integration_time values
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
time_limits = 0.025 # to find calibration constants later on, the integration time is allowed to vary by 0.5 us
creation_time = "" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. "2022-06-28 13:00:00"
creation_time = "" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. "2022-06-28 13:00:00"
n_trains = run_dc[instrument_src, "data.adc"].shape[0]
n_trains = run_dc[instrument_src, "data.adc"].shape[0]
# load number of data available, including trains with empty data.
# load number of data available, including trains with empty data.
all_trains = len(run_dc.train_ids)
all_trains = len(run_dc.train_ids)
instr_dc = run_dc.select(instrument_src, require_all=True)
empty_trains = all_trains - n_trains
empty_trains = all_trains - n_trains
if empty_trains != 0:
if empty_trains != 0:
print(f"{mod} has {empty_trains} empty trains out of {all_trains} trains")
print(f"{mod} has {empty_trains} empty trains out of {all_trains} trains")
 
 
if skip_first_ntrains:
 
print(f"Skip first {skip_first_ntrains} trains from processing as configured.")
 
 
instr_dc = run_dc.select(
 
instrument_src, require_all=True).select_trains(np.s_[skip_first_ntrains:])
 
if max_trains > 0:
if max_trains > 0:
n_trains = min(n_trains, max_trains)
n_trains = min(n_trains, max_trains)
print(f"Processing {n_trains} images.")
print(f"Processing {n_trains} images.")
if n_trains < min_trains:
if n_trains < min_trains:
warning(f"Less than {min_trains} trains are available in RAW data.")
warning(f"Less than {min_trains} trains are available in RAW data.")
if skip_ntrains:
print(f"Skip first {skip_ntrains} trains from processing as configured.")
# Select only requested number of images to process darks.
# Select only requested number of images to process darks.
instr_dc = instr_dc.select_trains(np.s_[skip_ntrains:n_trains])
instr_dc = instr_dc.select_trains(np.s_[:n_trains])
images = np.transpose(
images = np.transpose(
instr_dc[instrument_src, "data.adc"].ndarray(), (3, 2, 1, 0))
instr_dc[instrument_src, "data.adc"].ndarray(), (3, 2, 1, 0))
acelltable = np.transpose(instr_dc[instrument_src, "data.memoryCell"].ndarray())
acelltable = np.transpose(instr_dc[instrument_src, "data.memoryCell"].ndarray())
Loading