Skip to content

Commit

Permalink
Merge pull request #138 from lsst-ts/tickets/DM-45232
Browse files Browse the repository at this point in the history
DM-45232: Support Summit Observing Weeks 29-30 of 2024
  • Loading branch information
tribeiro authored Jul 29, 2024
2 parents ae79778 + 5afaf32 commit e94ff1f
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 16 deletions.
5 changes: 5 additions & 0 deletions doc/news/DM-45232.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
In ``base_make_calibrations.py``, fix issue with ``take_image_type`` method trying to set ``self.group_id``.

This is a class property and cannot be changed.
Instead, use a local variable.Add your info here

2 changes: 2 additions & 0 deletions doc/news/DM-45232.bugfix.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In ``take_ptc_flats_comcam`` add ``StateTransition`` usage to Camera instance.

4 changes: 4 additions & 0 deletions doc/news/DM-45232.bugfix.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
In ``take_ptc_flats_comcam`` add a setup_instrument to change filter.

This is needed because ComCam is still returning an error when we tell it to select a filter that is already selected.

2 changes: 2 additions & 0 deletions doc/news/DM-45232.bugfix.3
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In ``take_ptc_flats_comcam`` remove default value from schema.

2 changes: 2 additions & 0 deletions doc/news/DM-45232.bugfix.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In take_ptc_flats_comcam.py, fix issue with take_image_type method trying to set self.group_id.

4 changes: 2 additions & 2 deletions python/lsst/ts/externalscripts/base_make_calibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ async def take_image_type(self, image_type, exp_times):
"""

self.note = getattr(self.config, "note", None)
self.group_id = self.group_id if self.obs_id is None else self.obs_id
group_id = self.group_id if self.obs_id is None else self.obs_id

return tuple(
[
Expand All @@ -474,7 +474,7 @@ async def take_image_type(self, image_type, exp_times):
reason=self.reason,
program=self.program,
note=self.note,
group_id=self.group_id,
group_id=group_id,
)
)[0]
for exp_time in exp_times
Expand Down
30 changes: 17 additions & 13 deletions python/lsst/ts/externalscripts/base_take_ptc_flats.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,11 @@ def get_schema(cls):
type: number
minimum: 0
minItems: 1
default: 30
n_darks:
description: >
Number of dark images to interleave between flat pairs.
type: integer
minimum: 1
default: 2
electrometer_scan:
description: Electrometer scan settings.
type: object
Expand All @@ -123,17 +121,14 @@ def get_schema(cls):
are "CURRENT" and "CHARGE".
type: string
enum: ["CURRENT", "CHARGE"]
default: "CURRENT"
range:
description: >
Electrometer measurement range. -1 for autorange.
type: number
default: -1
integration_time:
description: Electrometer integration time.
type: number
exclusiveMinimum: 0
default: 0.1
ignore:
description: >-
CSCs from the camera group to ignore in status check.
Expand Down Expand Up @@ -372,6 +367,17 @@ async def take_ptc_flats(self):
integration_time=self.config.electrometer_scan["integration_time"],
)

# Setup instrument filter
try:
await self.camera.setup_instrument(filter=self.get_instrument_filter())
except salobj.AckError:
self.log.warning(
f"Filter is already set to {self.get_instrument_filter()}. "
f"Continuing."
)

group_id = self.group_id if self.obs_id is None else self.obs_id

for i, exp_time in enumerate(self.config.flats_exp_times):
exp_time_pair = [exp_time, exp_time]

Expand All @@ -392,11 +398,10 @@ async def take_ptc_flats(self):

flat_task = self.camera.take_flats(
exptime=time,
n=1,
group_id=self.group_id,
nflats=1,
group_id=group_id,
program=self.program,
reason=self.reason,
**self.get_instrument_configuration(),
)

await asyncio.gather(electrometer_task, flat_task)
Expand All @@ -407,11 +412,10 @@ async def take_ptc_flats(self):
)
await self.camera.take_flats(
exptime=time,
n=1,
group_id=self.group_id,
nflats=1,
group_id=group_id,
program=self.program,
reason=self.reason,
**self.get_instrument_configuration(),
)

if hasattr(self.config, "interleave_darks"):
Expand All @@ -424,8 +428,8 @@ async def take_ptc_flats(self):
)
await self.camera.take_darks(
exptime=dark_exp_time,
n=1,
group_id=self.group_id,
ndarks=1,
group_id=group_id,
program=self.program,
reason=self.reason,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ async def configure_camera(self) -> None:
if self.comcam is None:
self.log.debug("Creating Camera.")
self.comcam = ComCam(
self.domain, intended_usage=ComCamUsages.TakeImage, log=self.log
self.domain,
intended_usage=ComCamUsages.TakeImage + ComCamUsages.StateTransition,
log=self.log,
)
await self.comcam.start_task
else:
Expand Down

0 comments on commit e94ff1f

Please sign in to comment.