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 produce provenance for DL2 if --no-dl2 option is given #259

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 4 additions & 2 deletions src/osa/scripts/closer.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,23 @@ def post_process_files(seq_list: list):
output_files_set = set(Path(options.directory).rglob("*Run*"))

DL1AB_RE = re.compile(rf"{options.dl1_prod_id}/dl1.*.(?:h5|hdf5|hdf)")
DL2_RE = re.compile(f"{options.dl2_prod_id}/dl2.*.(?:h5|hdf5|hdf)")
MUONS_RE = re.compile(r"muons.*.fits")
DATACHECK_RE = re.compile(r"datacheck_dl1.*.(?:h5|hdf5|hdf)")
INTERLEAVED_RE = re.compile(r"interleaved.*.(?:h5|hdf5|hdf)")

pattern_files = dict(
[
("DL1AB", DL1AB_RE),
("DL2", DL2_RE),
("MUON", MUONS_RE),
("DATACHECK", DATACHECK_RE),
("INTERLEAVED", INTERLEAVED_RE),
]
)

if not options.no_dl2:
DL2_RE = re.compile(f"{options.dl2_prod_id}/dl2.*.(?:h5|hdf5|hdf)")
pattern_files["DL2"] = DL2_RE

for concept, pattern_re in pattern_files.items():
log.info(f"Post processing {concept} files, {len(output_files_set)} files left")

Expand Down
14 changes: 8 additions & 6 deletions src/osa/scripts/provprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,17 @@ def produce_provenance(session_log_filename, base_filename):
calibration_to_dl1 = define_paths(
"calibration_to_dl1", PATH_DL1, options.dl1_prod_id, base_filename
)
calibration_to_dl2 = define_paths(
"calibration_to_dl2", PATH_DL2, options.dl2_prod_id, base_filename
)
calibration_to_dl1_lines = calibration_lines + dl1_lines[1:]
lines_dl1 = copy.deepcopy(calibration_to_dl1_lines)
calibration_to_dl2_lines = calibration_to_dl1_lines + dl1_dl2_lines[1:]
lines_dl2 = copy.deepcopy(calibration_to_dl2_lines)
produce_provenance_files(lines_dl1, calibration_to_dl1)
produce_provenance_files(lines_dl2, calibration_to_dl2)

if not options.no_dl2:
calibration_to_dl2 = define_paths(
"calibration_to_dl2", PATH_DL2, options.dl2_prod_id, base_filename
)
calibration_to_dl2_lines = calibration_to_dl1_lines + dl1_dl2_lines[1:]
lines_dl2 = copy.deepcopy(calibration_to_dl2_lines)
produce_provenance_files(lines_dl2, calibration_to_dl2)


def main():
Expand Down
7 changes: 7 additions & 0 deletions src/osa/utils/cliopts.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ def provprocess_argparser():
dest="quit",
help="use this flag to reset session and remove log file",
)
parser.add_argument(
"--no-dl2",
action="store_true",
default=False,
help="Do not produce DL2 files (default False)",
)
parser.add_argument(
"drs4_pedestal_run_id", help="Number of the drs4_pedestal used in the calibration"
)
Expand Down Expand Up @@ -354,6 +360,7 @@ def provprocessparsing():
options.configfile = opts.config.resolve()
options.filter = opts.filter
options.quit = opts.quit
options.no_dl2 = opts.no_dl2
morcuended marked this conversation as resolved.
Show resolved Hide resolved
set_prod_ids()


Expand Down