Skip to content
Snippets Groups Projects

[Gotthard2][Dark] Sort dark runs

Merged Karim Ahmed requested to merge feat/sort_dark_runs_gh2 into master
Files
3
calcat_creation_time,
calcat_creation_time,
get_constant_from_db_and_time,
get_constant_from_db_and_time,
get_report,
get_report,
 
raw_data_location_string,
save_const_to_h5,
save_const_to_h5,
send_to_db,
send_to_db,
)
)
out_folder = Path(out_folder)
out_folder = Path(out_folder)
out_folder.mkdir(parents=True, exist_ok=True)
out_folder.mkdir(parents=True, exist_ok=True)
 
if not karabo_id_control:
 
karabo_id_control = karabo_id
 
ctrl_src = ctrl_source_template.format(karabo_id_control, control_template)
ctrl_src = ctrl_source_template.format(karabo_id_control, control_template)
 
run_nums = gotthard2lib.sort_dark_runs_by_gain(
 
raw_folder=in_folder,
 
runs=run_nums,
 
ctrl_src=ctrl_src,
 
)
# Read report path to associate it later with injected constants.
# Read report path to associate it later with injected constants.
report = get_report(metadata_folder)
report = get_report(metadata_folder)
# Run's creation time:
# Run's creation time:
creation_time = calcat_creation_time(in_folder, run_high, creation_time)
creation_time = calcat_creation_time(in_folder, run_nums[0], creation_time)
print(f"Creation time: {creation_time}")
print(f"Creation time: {creation_time}")
if not karabo_id_control:
karabo_id_control = karabo_id
%% Cell type:code id:c176a86f tags:
%% Cell type:code id:c176a86f tags:
``` python
``` python
run_dc = RunDirectory(in_folder / f"r{run_high:04d}")
run_dc = RunDirectory(in_folder / f"r{run_nums[0]:04d}")
file_loc = f"proposal:{run_dc.run_metadata()['proposalNumber']} runs:{run_high} {run_med} {run_low}" # noqa
file_loc = raw_data_location_string(
 
f"p{run_dc.run_metadata()['proposalNumber']}", run_nums)
receiver_names = [f"*{receiver_template.format(x)}*" for x in receiver_affixes]
receiver_names = [f"*{receiver_template.format(x)}*" for x in receiver_affixes]
data_sources = sorted(list(run_dc.select(receiver_names).all_sources))
data_sources = sorted(list(run_dc.select(receiver_names).all_sources))
step_timer.start()
step_timer.start()
run_dcs_dict = dict()
run_dcs_dict = dict()
ctrl_src = ctrl_source_template.format(karabo_id_control, control_template)
conditions = {
conditions = {
"bias_voltage": set(),
"bias_voltage": set(),
"exposure_time": set(),
"exposure_time": set(),
Loading