lstosa 0.10.6__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.6 → lstosa-0.10.7}/PKG-INFO +3 -3
- {lstosa-0.10.6 → lstosa-0.10.7}/environment.yml +3 -3
- {lstosa-0.10.6 → lstosa-0.10.7}/pyproject.toml +2 -2
- {lstosa-0.10.6 → lstosa-0.10.7}/src/lstosa.egg-info/PKG-INFO +3 -3
- {lstosa-0.10.6 → lstosa-0.10.7}/src/lstosa.egg-info/requires.txt +2 -2
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/_version.py +2 -2
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/gain_selection.py +2 -2
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/provprocess.py +19 -17
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/tests/test_osa_scripts.py +4 -4
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/update_source_catalog.py +78 -52
- {lstosa-0.10.6 → lstosa-0.10.7}/.coveragerc +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/.gitignore +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/.mailmap +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/.pre-commit-config.yaml +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/.readthedocs.yml +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/LICENSE +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/MANIFEST.in +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/README.md +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/codemeta.json +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/dev/mysql.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/Makefile +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/_static/logo_lstosa.png +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/authors.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/components/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/conf.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/configuration.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/contribute.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/documents/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/howto/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/introduction/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/introduction/reduction_steps_lstchain.png +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/jobs.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/make.bat +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/nightsummary.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/provenance.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/references.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/reports.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/scripts/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/troubleshooting/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/utils.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/veto.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/workflow/LSTOSA_flow.png +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/docs/workflow/index.rst +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/extra/example_sequencer.txt +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04183.history +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04183_failed.history +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04183_oneline.history +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/extra/history_files/sequence_LST1_04185.0010.history +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/extra/sacct_output.csv +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/extra/squeue_output.csv +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/setup.cfg +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/lstosa.egg-info/SOURCES.txt +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/lstosa.egg-info/dependency_links.txt +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/lstosa.egg-info/entry_points.txt +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/lstosa.egg-info/top_level.txt +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/configs/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/configs/config.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/configs/datamodel.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/configs/options.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/configs/sequencer.cfg +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/conftest.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/high_level/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/high_level/selection_cuts.toml +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/high_level/significance.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/high_level/tests/test_significance.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/job.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/database.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/extract.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/nightsummary.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/set_source_coordinates.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_database.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_extract.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_nightsummary.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/nightsummary/tests/test_source_coordinates.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/osadb.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/paths.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/provenance/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/provenance/capture.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/provenance/config/definition.yaml +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/provenance/config/environment.yaml +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/provenance/config/logger.yaml +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/provenance/io.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/provenance/utils.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/raw.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/report.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/autocloser.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/calibration_pipeline.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/closer.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/copy_datacheck.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/datasequence.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/reprocess_longterm.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/reprocessing.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/sequencer.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/sequencer_webmaker.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/show_run_summary.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/show_run_summary_tcu.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/simulate_processing.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/scripts/tests/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/test_jobs.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/test_osa.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/test_osadb.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/test_paths.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/test_raw.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/test_report.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/tests/test_veto.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/cliopts.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/iofile.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/logging.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/mail.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/register.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/tests/test_iofile.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/tests/test_utils.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/utils/utils.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/version.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/veto.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/webserver/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/webserver/utils.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/workflow/__init__.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/workflow/dl3.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/workflow/stages.py +0 -0
- {lstosa-0.10.6 → lstosa-0.10.7}/src/osa/workflow/tests/test_dl3.py +0 -0
- {lstosa-0.10.6 → 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
|
|
@@ -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
|
|
|
@@ -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,29 +413,31 @@ 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:
|
|
@@ -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__":
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|