Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not create the DL2 directory if --no-dl2 option is given #266

Merged
merged 6 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions src/osa/scripts/provprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def parse_lines_log(filter_cut, calib_runs, run_number):
filter_cut = "all"
cuts = {
"calibration": ["drs4_pedestal", "calibrate_charge"],
"r0_to_dl1": ["r0_to_dl1", "dl1ab"],
"dl1_to_dl2": ["dl1_datacheck", "dl1_to_dl2"],
"r0_to_dl1": ["r0_to_dl1", "dl1ab", "dl1_datacheck"],
"dl1_to_dl2": ["dl1_to_dl2"],
}
cuts["all"] = cuts["calibration"] + cuts["r0_to_dl1"] + cuts["dl1_to_dl2"]

Expand Down Expand Up @@ -413,29 +413,31 @@ def produce_provenance(session_log_filename, base_filename):
read_prov(filename=session_log_filename),
str(paths_r0_dl1["out_path"]),
)
dl1_lines = plines_r0 + plines_ab[1:]
plines_check = parse_lines_run(
"dl1_datacheck",
read_prov(filename=session_log_filename),
str(paths_r0_dl1["out_path"]),
)
dl1_lines = plines_r0 + plines_ab[1:] + plines_check[1:]

# create r0_to_dl1 prov files only if filtering
if options.filter == "r0_to_dl1":
produce_provenance_files(plines_r0 + plines_ab[1:], paths_r0_dl1)
produce_provenance_files(plines_r0 + plines_ab[1:] + plines_check[1:], paths_r0_dl1)

if options.filter == "dl1_to_dl2" or not options.filter:
paths_dl1_dl2 = define_paths("dl1_to_dl2", PATH_DL2, options.dl2_prod_id, base_filename)
plines_check = parse_lines_run(
"dl1_datacheck",
read_prov(filename=session_log_filename),
str(paths_dl1_dl2["out_path"]),
)
plines_dl2 = parse_lines_run(
"dl1_to_dl2",
read_prov(filename=session_log_filename),
str(paths_dl1_dl2["out_path"]),
)
dl1_dl2_lines = plines_check + plines_dl2[1:]
if not options.no_dl2:
paths_dl1_dl2 = define_paths("dl1_to_dl2", PATH_DL2, options.dl2_prod_id, base_filename)
plines_dl2 = parse_lines_run(
"dl1_to_dl2",
read_prov(filename=session_log_filename),
str(paths_dl1_dl2["out_path"]),
)
dl1_dl2_lines = plines_dl2

# create dl1_to_dl2 prov files only if filtering
if options.filter == "dl1_to_dl2":
produce_provenance_files(plines_check + plines_dl2[1:], paths_dl1_dl2)
if not options.no_dl2:
produce_provenance_files(plines_dl2, paths_dl1_dl2)

# create calibration_to_dl1 and calibration_to_dl2 prov files
if not options.filter:
Expand Down
2 changes: 1 addition & 1 deletion src/osa/scripts/tests/test_osa_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_simulate_processing(

with open(json_file_dl1) as file:
dl1 = yaml.safe_load(file)
assert len(dl1["entity"]) == 16
assert len(dl1["entity"]) == 19
assert len(dl1["activity"]) == 4
morcuended marked this conversation as resolved.
Show resolved Hide resolved
assert len(dl1["used"]) == 13
assert len(dl1["wasGeneratedBy"]) == 7
Expand Down
Loading