Skip to content

Commit

Permalink
Add --no-gainsel option also for autocloser
Browse files Browse the repository at this point in the history
  • Loading branch information
marialainez committed Mar 11, 2024
1 parent 200aa18 commit e4e6d3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/osa/scripts/autocloser.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(
config_file: Path,
ignore_cronlock: bool = False,
test: bool = False,
no_gainsel: bool = False,
):
"""
Parameters
Expand Down Expand Up @@ -82,7 +83,7 @@ def __init__(
if not self.lock_automatic_sequencer() and not ignore_cronlock:
log.warning(f"{self.telescope} already locked! Ignoring {self.telescope}")
return
if not self.simulate_sequencer(date, config_file, test):
if not self.simulate_sequencer(date, config_file, test, no_gainsel):
log.warning(
f"Simulation of the sequencer failed "
f"for {self.telescope}! Ignoring {self.telescope}"
Expand Down Expand Up @@ -121,7 +122,7 @@ def lock_automatic_sequencer(self):
self.locked = True
return True

def simulate_sequencer(self, date: str, config_file: Path, test: bool):
def simulate_sequencer(self, date: str, config_file: Path, test: bool, no_gainsel: bool):
"""Launch the sequencer in simulation mode."""
if test:
self.read_file()
Expand All @@ -135,6 +136,9 @@ def simulate_sequencer(self, date: str, config_file: Path, test: bool):
date,
self.telescope,
]
if no_gainsel:
sequencer_cmd.insert(1, "--no-gainsel")

Check warning on line 140 in src/osa/scripts/autocloser.py

View check run for this annotation

Codecov / codecov/patch

src/osa/scripts/autocloser.py#L140

Added line #L140 was not covered by tests

log.debug(f"Executing {' '.join(sequencer_cmd)}")
sequencer = subprocess.Popen(
sequencer_cmd,
Expand Down Expand Up @@ -445,7 +449,7 @@ def main():
# create telescope and sequence objects
log.info("Simulating sequencer...")

telescope = Telescope(args.tel_id, date, args.config)
telescope = Telescope(args.tel_id, date, args.config, no_gainsel=args.no_gainsel)

log.info(f"Processing {args.tel_id}...")

Expand Down
6 changes: 6 additions & 0 deletions src/osa/utils/cliopts.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ def autocloser_cli_parser():
default=False,
help="Disregard the production of DL2 files",
)
parser.add_argument(
"--no-gainsel",
action="store_true",
default=False,
help="Do not check if the gain selection finished correctly (default False)",
)
parser.add_argument("-r", "--runwise", action="store_true", help="Close the day run-wise.")
parser.add_argument("-l", "--log", type=Path, default=None, help="Write log to a file.")
parser.add_argument("tel_id", type=str, choices=["LST1"])
Expand Down

0 comments on commit e4e6d3d

Please sign in to comment.