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

Use lstcam_calib instead of lstchain for the calibration #310

Merged
merged 12 commits into from
Dec 2, 2024
Merged
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies:
- pyirf~=0.10
- lstchain>=0.10.7
- tenacity
- lstcam_calib
morcuended marked this conversation as resolved.
Show resolved Hide resolved
# 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
morcuended marked this conversation as resolved.
Show resolved Hide resolved
04183 lstcam_calib_onsite_create_calibration_file v0.7.0 2021-12-19 22:11 None None 0
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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
morcuended marked this conversation as resolved.
Show resolved Hide resolved
#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
6 changes: 4 additions & 2 deletions src/osa/scripts/calibration_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ 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",
command,
f"--run_number={drs4_pedestal_run_id}",
f"--base_dir={base_dir}",
"--no-progress",
Expand All @@ -55,8 +56,9 @@ def drs4_pedestal_command(drs4_pedestal_run_id: int) -> list:
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",
command,
f"--pedestal_run={drs4_pedestal_run_id}",
morcuended marked this conversation as resolved.
Show resolved Hide resolved
f"--run_number={pedcal_run_id}",
f"--base_dir={base_dir}",
Expand Down
5 changes: 3 additions & 2 deletions src/osa/scripts/tests/test_osa_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import yaml

from osa.configs import options
from osa.configs.config import cfg
from osa.scripts.closer import is_sequencer_successful, is_finished_check

ALL_SCRIPTS = [
Expand Down Expand Up @@ -300,7 +301,7 @@ def test_drs4_pedestal_cmd(base_test_dir):

cmd = drs4_pedestal_command(drs4_pedestal_run_id="01804")
expected_command = [
"onsite_create_drs4_pedestal_file",
cfg.get("lstchain", "drs4_baseline"),
"--run_number=01804",
f"--base_dir={base_test_dir}",
"--no-progress",
Expand All @@ -313,7 +314,7 @@ 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",
cfg.get("lstchain", "charge_calibration"),
"--pedestal_run=01804",
"--run_number=01809",
f"--base_dir={base_test_dir}",
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
4 changes: 2 additions & 2 deletions src/osa/workflow/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def _clean_up(self):
self._remove_dl1b_output('dl1_LST-1.Run')
elif self.command == "lstchain_check_dl1":
self._remove_dl1b_output('datacheck_dl1_LST-1.Run')
elif self.command == "onsite_create_calibration_file":
elif self.command == cfg.get("lstchain", "charge_calibration"):
self._remove_calibration()
elif self.command == "onsite_create_drs4_pedestal_file":
elif self.command == cfg.get("lstchain", "drs4_baseline"):
self._remove_drs4_baseline()

def _remove_drs4_baseline(self):
Expand Down
Loading