lstosa 0.10.5__tar.gz → 0.10.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lstosa-0.10.5 → lstosa-0.10.7}/PKG-INFO +3 -3
- {lstosa-0.10.5 → lstosa-0.10.7}/environment.yml +3 -3
- {lstosa-0.10.5 → lstosa-0.10.7}/pyproject.toml +2 -2
- {lstosa-0.10.5 → lstosa-0.10.7}/src/lstosa.egg-info/PKG-INFO +3 -3
- {lstosa-0.10.5 → lstosa-0.10.7}/src/lstosa.egg-info/requires.txt +2 -2
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/_version.py +2 -2
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/paths.py +3 -4
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/closer.py +7 -2
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/gain_selection.py +4 -4
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/provprocess.py +27 -23
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/tests/test_osa_scripts.py +4 -4
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/update_source_catalog.py +78 -52
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/cliopts.py +7 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/.coveragerc +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/.gitignore +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/.mailmap +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/.pre-commit-config.yaml +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/.readthedocs.yml +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/LICENSE +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/MANIFEST.in +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/README.md +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/codemeta.json +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/dev/mysql.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/Makefile +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/_static/logo_lstosa.png +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/authors.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/components/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/conf.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/configuration.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/contribute.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/documents/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/howto/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/introduction/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/introduction/reduction_steps_lstchain.png +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/jobs.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/make.bat +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/nightsummary.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/provenance.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/references.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/reports.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/scripts/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/troubleshooting/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/utils.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/veto.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/workflow/LSTOSA_flow.png +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/docs/workflow/index.rst +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/extra/example_sequencer.txt +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04183.history +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04183_failed.history +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04183_oneline.history +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04185.0010.history +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/extra/sacct_output.csv +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/extra/squeue_output.csv +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/setup.cfg +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/lstosa.egg-info/SOURCES.txt +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/lstosa.egg-info/dependency_links.txt +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/lstosa.egg-info/entry_points.txt +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/lstosa.egg-info/top_level.txt +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/configs/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/configs/config.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/configs/datamodel.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/configs/options.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/configs/sequencer.cfg +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/conftest.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/high_level/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/high_level/selection_cuts.toml +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/high_level/significance.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/high_level/tests/test_significance.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/job.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/database.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/extract.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/nightsummary.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/set_source_coordinates.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_database.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_extract.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_nightsummary.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_source_coordinates.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/osadb.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/provenance/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/provenance/capture.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/provenance/config/definition.yaml +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/provenance/config/environment.yaml +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/provenance/config/logger.yaml +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/provenance/io.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/provenance/utils.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/raw.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/report.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/autocloser.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/calibration_pipeline.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/copy_datacheck.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/datasequence.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/reprocess_longterm.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/reprocessing.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/sequencer.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/sequencer_webmaker.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/show_run_summary.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/show_run_summary_tcu.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/simulate_processing.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/scripts/tests/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/test_jobs.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/test_osa.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/test_osadb.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/test_paths.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/test_raw.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/test_report.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/tests/test_veto.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/iofile.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/logging.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/mail.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/register.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/tests/test_iofile.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/tests/test_utils.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/utils/utils.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/version.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/veto.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/webserver/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/webserver/utils.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/workflow/__init__.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/workflow/dl3.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/workflow/stages.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/workflow/tests/test_dl3.py +0 -0
- {lstosa-0.10.5 → lstosa-0.10.7}/src/osa/workflow/tests/test_stages.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lstosa
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.7
|
|
4
4
|
Summary: Onsite analysis pipeline for the CTA LST-1
|
|
5
5
|
Author: María Láinez, José Enrique Ruiz, Lab Saha, Andrés Baquero, José Luis Contreras, Maximilian Linhoff
|
|
6
6
|
Author-email: Daniel Morcuende <dmorcuen@ucm.es>
|
|
@@ -20,8 +20,8 @@ Requires-Python: >=3.9
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: astropy~=5.0
|
|
23
|
-
Requires-Dist: lstchain
|
|
24
|
-
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: lstchain>=0.10.5
|
|
24
|
+
Requires-Dist: matplotlib
|
|
25
25
|
Requires-Dist: numpy
|
|
26
26
|
Requires-Dist: pandas
|
|
27
27
|
Requires-Dist: pyyaml
|
|
@@ -8,7 +8,7 @@ dependencies:
|
|
|
8
8
|
- pip
|
|
9
9
|
- astropy~=5.0
|
|
10
10
|
- ctapipe~=0.19.2
|
|
11
|
-
- matplotlib
|
|
11
|
+
- matplotlib
|
|
12
12
|
- pyparsing
|
|
13
13
|
- prov
|
|
14
14
|
- pyyaml
|
|
@@ -24,8 +24,8 @@ dependencies:
|
|
|
24
24
|
- protobuf=3.20
|
|
25
25
|
- ctapipe_io_lst=0.22
|
|
26
26
|
- ctaplot~=0.6.4
|
|
27
|
-
- pyirf
|
|
28
|
-
- lstchain
|
|
27
|
+
- pyirf~=0.10
|
|
28
|
+
- lstchain>=0.10.5
|
|
29
29
|
- tenacity
|
|
30
30
|
# dev dependencies
|
|
31
31
|
- pytest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lstosa
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.7
|
|
4
4
|
Summary: Onsite analysis pipeline for the CTA LST-1
|
|
5
5
|
Author: María Láinez, José Enrique Ruiz, Lab Saha, Andrés Baquero, José Luis Contreras, Maximilian Linhoff
|
|
6
6
|
Author-email: Daniel Morcuende <dmorcuen@ucm.es>
|
|
@@ -20,8 +20,8 @@ Requires-Python: >=3.9
|
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
21
21
|
License-File: LICENSE
|
|
22
22
|
Requires-Dist: astropy~=5.0
|
|
23
|
-
Requires-Dist: lstchain
|
|
24
|
-
Requires-Dist: matplotlib
|
|
23
|
+
Requires-Dist: lstchain>=0.10.5
|
|
24
|
+
Requires-Dist: matplotlib
|
|
25
25
|
Requires-Dist: numpy
|
|
26
26
|
Requires-Dist: pandas
|
|
27
27
|
Requires-Dist: pyyaml
|
|
@@ -9,9 +9,8 @@ from typing import List
|
|
|
9
9
|
import lstchain
|
|
10
10
|
from astropy.table import Table
|
|
11
11
|
from lstchain.onsite import (find_systematics_correction_file,
|
|
12
|
-
find_time_calibration_file
|
|
13
|
-
|
|
14
|
-
search_filter
|
|
12
|
+
find_time_calibration_file,
|
|
13
|
+
find_filter_wheels)
|
|
15
14
|
|
|
16
15
|
from osa.configs import options
|
|
17
16
|
from osa.configs.config import DEFAULT_CFG, cfg
|
|
@@ -142,7 +141,7 @@ def get_calibration_filename(run_id: int, prod_id: str) -> Path:
|
|
|
142
141
|
mongodb = cfg.get("database", "caco_db")
|
|
143
142
|
try:
|
|
144
143
|
# Cast run_id to int to avoid problems with numpy int64 encoding in MongoDB
|
|
145
|
-
options.filters =
|
|
144
|
+
options.filters = find_filter_wheels(int(run_id), mongodb)
|
|
146
145
|
except IOError:
|
|
147
146
|
log.warning("No filter information found in database. Assuming positions 52.")
|
|
148
147
|
options.filters = 52
|
|
@@ -193,7 +193,6 @@ def post_process_files(seq_list: list):
|
|
|
193
193
|
output_files_set = set(Path(options.directory).rglob("*Run*"))
|
|
194
194
|
|
|
195
195
|
DL1AB_RE = re.compile(rf"{options.dl1_prod_id}/dl1.*.(?:h5|hdf5|hdf)")
|
|
196
|
-
DL2_RE = re.compile(f"{options.dl2_prod_id}/dl2.*.(?:h5|hdf5|hdf)")
|
|
197
196
|
MUONS_RE = re.compile(r"muons.*.fits")
|
|
198
197
|
DATACHECK_RE = re.compile(r"datacheck_dl1.*.(?:h5|hdf5|hdf)")
|
|
199
198
|
INTERLEAVED_RE = re.compile(r"interleaved.*.(?:h5|hdf5|hdf)")
|
|
@@ -201,13 +200,16 @@ def post_process_files(seq_list: list):
|
|
|
201
200
|
pattern_files = dict(
|
|
202
201
|
[
|
|
203
202
|
("DL1AB", DL1AB_RE),
|
|
204
|
-
("DL2", DL2_RE),
|
|
205
203
|
("MUON", MUONS_RE),
|
|
206
204
|
("DATACHECK", DATACHECK_RE),
|
|
207
205
|
("INTERLEAVED", INTERLEAVED_RE),
|
|
208
206
|
]
|
|
209
207
|
)
|
|
210
208
|
|
|
209
|
+
if not options.no_dl2:
|
|
210
|
+
DL2_RE = re.compile(f"{options.dl2_prod_id}/dl2.*.(?:h5|hdf5|hdf)")
|
|
211
|
+
pattern_files["DL2"] = DL2_RE
|
|
212
|
+
|
|
211
213
|
for concept, pattern_re in pattern_files.items():
|
|
212
214
|
log.info(f"Post processing {concept} files, {len(output_files_set)} files left")
|
|
213
215
|
|
|
@@ -368,6 +370,9 @@ def extract_provenance(seq_list):
|
|
|
368
370
|
nightdir,
|
|
369
371
|
options.prod_id,
|
|
370
372
|
]
|
|
373
|
+
if options.no_dl2:
|
|
374
|
+
cmd.append("--no-dl2")
|
|
375
|
+
|
|
371
376
|
if not options.simulate and not options.test and shutil.which("sbatch") is not None:
|
|
372
377
|
subprocess.run(cmd, check=True)
|
|
373
378
|
else:
|
|
@@ -20,7 +20,7 @@ from osa.job import get_sacct_output, FORMAT_SLURM
|
|
|
20
20
|
|
|
21
21
|
log = myLogger(logging.getLogger(__name__))
|
|
22
22
|
|
|
23
|
-
PATH = "PATH=/fefs/aswg/software/
|
|
23
|
+
PATH = "PATH=/fefs/aswg/software/offline_dvr/bin:$PATH"
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def get_sbatch_script(
|
|
@@ -36,7 +36,7 @@ def get_sbatch_script(
|
|
|
36
36
|
#SBATCH --job-name "gain_selection_{run_id:05d}"
|
|
37
37
|
#SBATCH --export {PATH}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
lst_dvr {input_file} {output_dir} {ref_time} {ref_counter} {module} {ref_source}
|
|
40
40
|
"""
|
|
41
41
|
)
|
|
42
42
|
|
|
@@ -206,8 +206,8 @@ def check_failed_jobs(date: str, output_basedir: Path = None):
|
|
|
206
206
|
@click.option("--check", is_flag=True, default=False, help="Check for failed jobs.")
|
|
207
207
|
@click.argument("dates-file", type=click.Path(exists=True, path_type=Path))
|
|
208
208
|
@click.argument("output-basedir", type=click.Path(path_type=Path))
|
|
209
|
-
@click.option("-s", "--start-time", type=int, default=10)
|
|
210
|
-
@click.option("-e", "--end-time", type=int, default=18)
|
|
209
|
+
@click.option("-s", "--start-time", type=int, default=10, help="Time to (re)start gain selection in HH format.")
|
|
210
|
+
@click.option("-e", "--end-time", type=int, default=18, help="Time to stop gain selection in HH format.")
|
|
211
211
|
def main(
|
|
212
212
|
dates_file: Path = None,
|
|
213
213
|
output_basedir: Path = None,
|
|
@@ -81,8 +81,8 @@ def parse_lines_log(filter_cut, calib_runs, run_number):
|
|
|
81
81
|
filter_cut = "all"
|
|
82
82
|
cuts = {
|
|
83
83
|
"calibration": ["drs4_pedestal", "calibrate_charge"],
|
|
84
|
-
"r0_to_dl1": ["r0_to_dl1", "dl1ab"],
|
|
85
|
-
"dl1_to_dl2": ["
|
|
84
|
+
"r0_to_dl1": ["r0_to_dl1", "dl1ab", "dl1_datacheck"],
|
|
85
|
+
"dl1_to_dl2": ["dl1_to_dl2"],
|
|
86
86
|
}
|
|
87
87
|
cuts["all"] = cuts["calibration"] + cuts["r0_to_dl1"] + cuts["dl1_to_dl2"]
|
|
88
88
|
|
|
@@ -413,44 +413,48 @@ def produce_provenance(session_log_filename, base_filename):
|
|
|
413
413
|
read_prov(filename=session_log_filename),
|
|
414
414
|
str(paths_r0_dl1["out_path"]),
|
|
415
415
|
)
|
|
416
|
-
|
|
416
|
+
plines_check = parse_lines_run(
|
|
417
|
+
"dl1_datacheck",
|
|
418
|
+
read_prov(filename=session_log_filename),
|
|
419
|
+
str(paths_r0_dl1["out_path"]),
|
|
420
|
+
)
|
|
421
|
+
dl1_lines = plines_r0 + plines_ab[1:] + plines_check[1:]
|
|
417
422
|
|
|
418
423
|
# create r0_to_dl1 prov files only if filtering
|
|
419
424
|
if options.filter == "r0_to_dl1":
|
|
420
|
-
produce_provenance_files(plines_r0 + plines_ab[1:], paths_r0_dl1)
|
|
425
|
+
produce_provenance_files(plines_r0 + plines_ab[1:] + plines_check[1:], paths_r0_dl1)
|
|
421
426
|
|
|
422
427
|
if options.filter == "dl1_to_dl2" or not options.filter:
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
read_prov(filename=session_log_filename),
|
|
432
|
-
str(paths_dl1_dl2["out_path"]),
|
|
433
|
-
)
|
|
434
|
-
dl1_dl2_lines = plines_check + plines_dl2[1:]
|
|
428
|
+
if not options.no_dl2:
|
|
429
|
+
paths_dl1_dl2 = define_paths("dl1_to_dl2", PATH_DL2, options.dl2_prod_id, base_filename)
|
|
430
|
+
plines_dl2 = parse_lines_run(
|
|
431
|
+
"dl1_to_dl2",
|
|
432
|
+
read_prov(filename=session_log_filename),
|
|
433
|
+
str(paths_dl1_dl2["out_path"]),
|
|
434
|
+
)
|
|
435
|
+
dl1_dl2_lines = plines_dl2
|
|
435
436
|
|
|
436
437
|
# create dl1_to_dl2 prov files only if filtering
|
|
437
438
|
if options.filter == "dl1_to_dl2":
|
|
438
|
-
|
|
439
|
+
if not options.no_dl2:
|
|
440
|
+
produce_provenance_files(plines_dl2, paths_dl1_dl2)
|
|
439
441
|
|
|
440
442
|
# create calibration_to_dl1 and calibration_to_dl2 prov files
|
|
441
443
|
if not options.filter:
|
|
442
444
|
calibration_to_dl1 = define_paths(
|
|
443
445
|
"calibration_to_dl1", PATH_DL1, options.dl1_prod_id, base_filename
|
|
444
446
|
)
|
|
445
|
-
calibration_to_dl2 = define_paths(
|
|
446
|
-
"calibration_to_dl2", PATH_DL2, options.dl2_prod_id, base_filename
|
|
447
|
-
)
|
|
448
447
|
calibration_to_dl1_lines = calibration_lines + dl1_lines[1:]
|
|
449
448
|
lines_dl1 = copy.deepcopy(calibration_to_dl1_lines)
|
|
450
|
-
calibration_to_dl2_lines = calibration_to_dl1_lines + dl1_dl2_lines[1:]
|
|
451
|
-
lines_dl2 = copy.deepcopy(calibration_to_dl2_lines)
|
|
452
449
|
produce_provenance_files(lines_dl1, calibration_to_dl1)
|
|
453
|
-
|
|
450
|
+
|
|
451
|
+
if not options.no_dl2:
|
|
452
|
+
calibration_to_dl2 = define_paths(
|
|
453
|
+
"calibration_to_dl2", PATH_DL2, options.dl2_prod_id, base_filename
|
|
454
|
+
)
|
|
455
|
+
calibration_to_dl2_lines = calibration_to_dl1_lines + dl1_dl2_lines[1:]
|
|
456
|
+
lines_dl2 = copy.deepcopy(calibration_to_dl2_lines)
|
|
457
|
+
produce_provenance_files(lines_dl2, calibration_to_dl2)
|
|
454
458
|
|
|
455
459
|
|
|
456
460
|
def main():
|
|
@@ -99,10 +99,10 @@ def test_simulate_processing(
|
|
|
99
99
|
|
|
100
100
|
with open(json_file_dl1) as file:
|
|
101
101
|
dl1 = yaml.safe_load(file)
|
|
102
|
-
assert len(dl1["entity"]) ==
|
|
103
|
-
assert len(dl1["activity"]) ==
|
|
104
|
-
assert len(dl1["used"]) ==
|
|
105
|
-
assert len(dl1["wasGeneratedBy"]) ==
|
|
102
|
+
assert len(dl1["entity"]) == 19
|
|
103
|
+
assert len(dl1["activity"]) == 5
|
|
104
|
+
assert len(dl1["used"]) == 15
|
|
105
|
+
assert len(dl1["wasGeneratedBy"]) == 10
|
|
106
106
|
|
|
107
107
|
with open(json_file_dl2) as file:
|
|
108
108
|
dl2 = yaml.safe_load(file)
|
|
@@ -5,30 +5,30 @@ from pathlib import Path
|
|
|
5
5
|
from textwrap import dedent
|
|
6
6
|
|
|
7
7
|
import click
|
|
8
|
-
import re
|
|
9
8
|
import pandas as pd
|
|
10
9
|
from astropy import units as u
|
|
11
|
-
from astropy.table import Table, join,
|
|
10
|
+
from astropy.table import Table, join, unique, vstack
|
|
12
11
|
from astropy.time import Time
|
|
13
12
|
from lstchain.io.io import dl1_params_lstcam_key
|
|
14
|
-
from lstchain.reco.utils import
|
|
13
|
+
from lstchain.reco.utils import add_delta_t_key, get_effective_time
|
|
14
|
+
|
|
15
|
+
from osa.paths import get_major_version
|
|
15
16
|
from osa.utils.utils import get_lstchain_version
|
|
16
17
|
|
|
17
|
-
pd.set_option(
|
|
18
|
+
pd.set_option("display.float_format", "{:.1f}".format)
|
|
18
19
|
|
|
19
|
-
logging.basicConfig(
|
|
20
|
-
level=logging.INFO,
|
|
21
|
-
format='%(asctime)s:%(levelname)s:%(message)s'
|
|
22
|
-
)
|
|
20
|
+
logging.basicConfig(level=logging.INFO, format="%(asctime)s:%(levelname)s:%(message)s")
|
|
23
21
|
log = logging.getLogger(__name__)
|
|
24
22
|
|
|
25
23
|
|
|
26
24
|
BASE_DL1 = Path("/fefs/aswg/data/real/DL1")
|
|
27
25
|
BASE_MONITORING = Path("/fefs/aswg/data/real/monitoring")
|
|
26
|
+
CATALOG_DIR = Path("/fefs/aswg/data/real/OSA/Catalog")
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
def add_table_to_html(html_table):
|
|
31
|
-
return dedent(
|
|
30
|
+
return dedent(
|
|
31
|
+
f"""\
|
|
32
32
|
<html>
|
|
33
33
|
<head>
|
|
34
34
|
<link href="osa.css" rel="stylesheet" type="text/css">
|
|
@@ -37,11 +37,13 @@ def add_table_to_html(html_table):
|
|
|
37
37
|
{html_table}
|
|
38
38
|
</body>
|
|
39
39
|
</html>
|
|
40
|
-
"""
|
|
40
|
+
"""
|
|
41
|
+
)
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
def add_query_table_to_html(html_table):
|
|
44
|
-
return dedent(
|
|
45
|
+
return dedent(
|
|
46
|
+
f"""\
|
|
45
47
|
<html>
|
|
46
48
|
<head>
|
|
47
49
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
@@ -96,87 +98,111 @@ def add_query_table_to_html(html_table):
|
|
|
96
98
|
{html_table}
|
|
97
99
|
</body>
|
|
98
100
|
</html>
|
|
99
|
-
"""
|
|
101
|
+
"""
|
|
102
|
+
)
|
|
100
103
|
|
|
101
104
|
|
|
102
|
-
def
|
|
103
|
-
|
|
104
|
-
for timestamp in table["run_start"]:
|
|
105
|
-
start_time = Time(timestamp * u.ns, format="unix_tai")
|
|
106
|
-
start_times.append(start_time.utc.iso)
|
|
107
|
-
table.replace_column("run_start", start_times)
|
|
105
|
+
def add_start_and_elapsed(table: Table, datedir: str, version: str) -> None:
|
|
106
|
+
"""Add columns with the timestamp of first events and elapsed time of the runs.
|
|
108
107
|
|
|
108
|
+
This information is taken from the merged DL1 files. Two new columns are added
|
|
109
|
+
to the input table.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
table : astropy.table.Table
|
|
114
|
+
Astropy Table to which the two new columns are to be added.
|
|
115
|
+
datedir : str
|
|
116
|
+
Date directory in YYYYMMDD format.
|
|
117
|
+
version : str
|
|
118
|
+
Production version of the processing in the format 'vW.X.Y.Z'.
|
|
119
|
+
"""
|
|
120
|
+
if "run_id" not in table.columns:
|
|
121
|
+
raise KeyError("Run ID not present in given table. Please check its content.")
|
|
109
122
|
|
|
110
|
-
|
|
123
|
+
start_times = []
|
|
111
124
|
elapsed_times = []
|
|
125
|
+
|
|
112
126
|
for run in table["run_id"]:
|
|
113
|
-
major_version =
|
|
127
|
+
major_version = get_major_version(version)
|
|
114
128
|
file = BASE_DL1 / datedir / major_version / f"tailcut84/dl1_LST-1.Run{run:05d}.h5"
|
|
115
129
|
df = pd.read_hdf(file, key=dl1_params_lstcam_key)
|
|
130
|
+
|
|
131
|
+
# Timestamp of the first event
|
|
132
|
+
first_time = Time(df["dragon_time"][0], format="unix", scale="utc")
|
|
133
|
+
start_times.append(first_time.utc.iso)
|
|
134
|
+
|
|
135
|
+
# Elapsed time of the run
|
|
116
136
|
df_delta = add_delta_t_key(df)
|
|
117
137
|
_, elapsed_t = get_effective_time(df_delta)
|
|
118
|
-
|
|
119
138
|
elapsed_times.append(elapsed_t.to(u.min))
|
|
120
139
|
|
|
140
|
+
# Modify the input table by adding two new columns
|
|
121
141
|
table.add_column(elapsed_times, name="Elapsed [min]")
|
|
142
|
+
table.add_column(start_times, name="Run start [UTC]")
|
|
122
143
|
|
|
123
144
|
|
|
124
145
|
def copy_to_webserver(html_file, csv_file):
|
|
125
|
-
sp.run(["scp", str(html_file), "datacheck:/home/www/html/datacheck/lstosa/."])
|
|
126
|
-
sp.run(["scp", str(csv_file), "datacheck:/home/www/html/datacheck/lstosa/."])
|
|
146
|
+
sp.run(["scp", str(html_file), "datacheck:/home/www/html/datacheck/lstosa/."], check=True)
|
|
147
|
+
sp.run(["scp", str(csv_file), "datacheck:/home/www/html/datacheck/lstosa/."], check=True)
|
|
127
148
|
|
|
128
149
|
|
|
129
150
|
@click.command()
|
|
130
|
-
@click.argument(
|
|
131
|
-
'date',
|
|
132
|
-
type=click.DateTime(formats=["%Y-%m-%d"])
|
|
133
|
-
)
|
|
151
|
+
@click.argument("date", type=click.DateTime(formats=["%Y-%m-%d"]))
|
|
134
152
|
@click.option("-v", "--version", type=str, default=get_lstchain_version())
|
|
135
153
|
def main(date: datetime = None, version: str = get_lstchain_version()):
|
|
154
|
+
"""Update source catalog with new run entries from a given date in format YYYY-MM-DD.
|
|
155
|
+
|
|
156
|
+
Notes
|
|
157
|
+
-----
|
|
158
|
+
It needs to be run as lstanalyzer user.
|
|
136
159
|
"""
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"""
|
|
140
|
-
csv_file = Path("/fefs/aswg/data/real/OSA/Catalog/LST_source_catalog.ecsv")
|
|
141
|
-
table = Table.read(csv_file)
|
|
160
|
+
catalog_path = CATALOG_DIR / "LST_source_catalog.ecsv"
|
|
161
|
+
catalog_table = Table.read(catalog_path)
|
|
142
162
|
|
|
143
|
-
# Open
|
|
163
|
+
# Open table for given date and append its content to the table with entire catalog
|
|
144
164
|
datedir = date.strftime("%Y%m%d")
|
|
145
165
|
today_catalog = Table.read(BASE_MONITORING / f"RunCatalog/RunCatalog_{datedir}.ecsv")
|
|
146
166
|
today_runsummary = Table.read(BASE_MONITORING / f"RunSummary/RunSummary_{datedir}.ecsv")
|
|
167
|
+
# Keep only astronomical data runs
|
|
147
168
|
today_runsummary = today_runsummary[today_runsummary["run_type"] == "DATA"]
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
169
|
+
todays_info = join(today_runsummary, today_catalog)
|
|
170
|
+
todays_info.add_column(date.strftime("%Y-%m-%d"), name="date_dir")
|
|
171
|
+
todays_info.keep_columns(["run_id", "source_name", "date_dir"])
|
|
172
|
+
|
|
151
173
|
# Add start of run in iso format and elapsed time for each run
|
|
152
174
|
log.info("Getting run start and elapsed time")
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
# Change
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
# Add new rows
|
|
175
|
+
add_start_and_elapsed(todays_info, datedir, version)
|
|
176
|
+
|
|
177
|
+
# Change column names
|
|
178
|
+
todays_info.rename_column("run_id", "Run ID")
|
|
179
|
+
todays_info.rename_column("source_name", "Source name")
|
|
180
|
+
todays_info.rename_column("date_dir", "Date directory")
|
|
181
|
+
|
|
182
|
+
# Add new rows from given date to the whole catalog table
|
|
162
183
|
log.info("Adding new rows to table")
|
|
163
|
-
new_table = vstack([
|
|
164
|
-
table_unique = unique(new_table, keys="Run ID", keep=
|
|
184
|
+
new_table = vstack([catalog_table, todays_info])
|
|
185
|
+
table_unique = unique(new_table, keys="Run ID", keep="last")
|
|
165
186
|
|
|
166
|
-
# To pandas
|
|
187
|
+
# To pandas
|
|
167
188
|
log.info("Converting to pandas and HTML")
|
|
168
189
|
df = table_unique.to_pandas()
|
|
169
190
|
df = df.sort_values(by="Run ID", ascending=False)
|
|
191
|
+
|
|
192
|
+
# To HTML
|
|
170
193
|
html_table = df.to_html(index=False, justify="left")
|
|
171
194
|
html_table = html_table.replace(
|
|
172
195
|
'<table border="1" class="dataframe">',
|
|
173
|
-
'<table class="display compact" id="table139855676982704">'
|
|
196
|
+
'<table class="display compact" id="table139855676982704">',
|
|
197
|
+
)
|
|
174
198
|
html_content = add_query_table_to_html(html_table)
|
|
175
|
-
|
|
199
|
+
|
|
200
|
+
# Save the HTML and ECSV files and copy them to the LST-1 webserver
|
|
201
|
+
html_file = CATALOG_DIR / "LST_source_catalog.html"
|
|
176
202
|
html_file.write_text(html_content)
|
|
177
|
-
table_unique.write(
|
|
203
|
+
table_unique.write(catalog_path, delimiter=",", overwrite=True)
|
|
178
204
|
|
|
179
|
-
copy_to_webserver(html_file,
|
|
205
|
+
copy_to_webserver(html_file, catalog_path)
|
|
180
206
|
|
|
181
207
|
|
|
182
208
|
if __name__ == "__main__":
|
|
@@ -326,6 +326,12 @@ def provprocess_argparser():
|
|
|
326
326
|
dest="quit",
|
|
327
327
|
help="use this flag to reset session and remove log file",
|
|
328
328
|
)
|
|
329
|
+
parser.add_argument(
|
|
330
|
+
"--no-dl2",
|
|
331
|
+
action="store_true",
|
|
332
|
+
default=False,
|
|
333
|
+
help="Do not produce DL2 files (default False)",
|
|
334
|
+
)
|
|
329
335
|
parser.add_argument(
|
|
330
336
|
"drs4_pedestal_run_id", help="Number of the drs4_pedestal used in the calibration"
|
|
331
337
|
)
|
|
@@ -354,6 +360,7 @@ def provprocessparsing():
|
|
|
354
360
|
options.configfile = opts.config.resolve()
|
|
355
361
|
options.filter = opts.filter
|
|
356
362
|
options.quit = opts.quit
|
|
363
|
+
options.no_dl2 = opts.no_dl2
|
|
357
364
|
set_prod_ids()
|
|
358
365
|
|
|
359
366
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|