Skip to content

Commit

Permalink
Merge pull request #310 from cta-observatory/lstcam_calib
Browse files Browse the repository at this point in the history
Use lstcam_calib instead of lstchain for the calibration
  • Loading branch information
marialainez authored Dec 2, 2024
2 parents 831ce71 + f865da4 commit 48f7e24
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 28 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ jobs:
strategy:
matrix:
include:
- python-version: "3.9"

- python-version: "3.10"

- python-version: "3.11"
Expand Down
7 changes: 4 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ dependencies:
- click
- pymongo
- scikit-learn=1.2
- protobuf=3.20
- ctapipe_io_lst=0.22
- ctapipe_io_lst=0.24
- ctaplot~=0.6.4
- pyirf~=0.10
- lstchain>=0.10.7
- lstchain>=0.10.13
- tenacity
- pip:
- lstcam_calib
# dev dependencies
- pytest
- pytest-cov
Expand Down
4 changes: 2 additions & 2 deletions extra/history_files/sequence_LST1_04183.history
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
04179 onsite_create_drs4_pedestal_file v0.7.0 2021-12-19 22:11 None None 0
04183 onsite_create_calibration_file v0.7.0 2021-12-19 22:11 None None 0
04179 lstcam_calib_onsite_create_drs4_pedestal_file v0.7.0 2021-12-19 22:11 None None 0
04183 lstcam_calib_onsite_create_calibration_file v0.7.0 2021-12-19 22:11 None None 0
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ classifiers = [
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Physics",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"astropy~=5.0",
"lstchain>=0.10.7",
"lstchain>=0.10.13",
"matplotlib",
"numpy",
"pandas",
Expand All @@ -48,6 +47,7 @@ dependencies = [
"pymongo",
"gammapy~=1.1",
"tenacity",
"lstcam_calib",
]

dynamic = ["version"]
Expand Down
6 changes: 4 additions & 2 deletions src/osa/configs/sequencer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ DL2_PROD_ID: model2

[lstchain]
# Calibration steps in calibration pipeline script
drs4_baseline: onsite_create_drs4_pedestal_file
charge_calibration: onsite_create_calibration_file
#drs4_baseline: onsite_create_drs4_pedestal_file
#charge_calibration: onsite_create_calibration_file
drs4_baseline: lstcam_calib_onsite_create_drs4_pedestal_file
charge_calibration: lstcam_calib_onsite_create_calibration_file
use_ff_heuristic_id: False

# Data processing steps in datasequence script
Expand Down
17 changes: 9 additions & 8 deletions src/osa/scripts/calibration_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,23 @@ def is_calibration_produced(drs4_pedestal_run_id: int, pedcal_run_id: int) -> bo
def drs4_pedestal_command(drs4_pedestal_run_id: int) -> list:
"""Build the create_drs4_pedestal command."""
base_dir = Path(cfg.get("LST1", "BASE")).resolve()
command = cfg.get("lstchain", "drs4_baseline")
return [
"onsite_create_drs4_pedestal_file",
f"--run_number={drs4_pedestal_run_id}",
f"--base_dir={base_dir}",
command,
"-r", str(drs4_pedestal_run_id),
"-b", base_dir,
"--no-progress",
]


def calibration_file_command(drs4_pedestal_run_id: int, pedcal_run_id: int) -> list:
"""Build the create_calibration_file command."""
base_dir = Path(cfg.get("LST1", "BASE")).resolve()
command = cfg.get("lstchain", "charge_calibration")
cmd = [
"onsite_create_calibration_file",
f"--pedestal_run={drs4_pedestal_run_id}",
f"--run_number={pedcal_run_id}",
f"--base_dir={base_dir}",
command,
"-p", str(drs4_pedestal_run_id),
"-r", str(pedcal_run_id),
"-b", base_dir,
]
# In case of problems with trigger tagging:
if cfg.getboolean("lstchain", "use_ff_heuristic_id"):
Expand Down
19 changes: 12 additions & 7 deletions src/osa/scripts/tests/test_osa_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,11 @@ def test_drs4_pedestal_cmd(base_test_dir):

cmd = drs4_pedestal_command(drs4_pedestal_run_id="01804")
expected_command = [
"onsite_create_drs4_pedestal_file",
"--run_number=01804",
f"--base_dir={base_test_dir}",
cfg.get("lstchain", "drs4_baseline"),
"-r",
"01804",
"-b",
base_test_dir,
"--no-progress",
]
assert cmd == expected_command
Expand All @@ -314,10 +316,13 @@ def test_calibration_file_cmd(base_test_dir):

cmd = calibration_file_command(drs4_pedestal_run_id="01804", pedcal_run_id="01809")
expected_command = [
"onsite_create_calibration_file",
"--pedestal_run=01804",
"--run_number=01809",
f"--base_dir={base_test_dir}",
cfg.get("lstchain", "charge_calibration"),
"-p",
"01804",
"-r",
"01809",
"-b",
base_test_dir,
]
assert cmd == expected_command

Expand Down
2 changes: 1 addition & 1 deletion src/osa/tests/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def test_set_cache_dirs():
def test_calibration_history_level():
from osa.job import check_history_level

levels = {"onsite_create_drs4_pedestal_file": 1, "onsite_create_calibration_file": 0}
levels = {cfg.get("lstchain", "drs4_baseline"): 1, cfg.get("lstchain", "charge_calibration"): 0}
level, exit_status = check_history_level(calibration_history_file, levels)
assert level == 0
assert exit_status == 0
Expand Down

0 comments on commit 48f7e24

Please sign in to comment.