Skip to content

Commit

Permalink
Allow immediate tracking and ignoring tcs components
Browse files Browse the repository at this point in the history
  • Loading branch information
elanaku committed Oct 29, 2024
1 parent 0a9fce3 commit e435397
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,15 @@ async def slew_azel_and_setup_instrument(self, az, el):
filter=self.config.filter,
grating=self.config.grating,
)

async def setup_instrument(self, az, el):
"""Abstract method to set the instrument. Change the filter
and start tracking.
"""
# slew to desired field
await self.tcs.start_tracking()

await self.latiss.setup_instrument(
filter=self.config.filter,
grating=self.config.grating,
)
37 changes: 27 additions & 10 deletions python/lsst/ts/externalscripts/base_take_twilight_flats.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ async def slew_azel_and_setup_instrument(self, az, el):
"""
raise NotImplementedError()

@abc.abstractmethod
async def setup_instrument(self):
"""Abstract method to set the instrument. Change the filter
and slew and track target.
"""
raise NotImplementedError()

@classmethod
def get_schema(cls):
schema_yaml = """
Expand Down Expand Up @@ -242,14 +249,18 @@ def get_schema(cls):
description: If True, track sky. If False, keep az and el constant.
type: boolean
default: True
position_telescope:
description: If True, position telescope relative to the sun. \
If False, assume the telescope is in correct position.
type: boolean
default: True
ignore:
description: >-
CSCs from the camera group to ignore in status check.
Name must match those in self.group.components.
type: array
items:
type: string
additionalProperties: false
"""
schema_dict = yaml.safe_load(schema_yaml)
Expand Down Expand Up @@ -282,10 +293,13 @@ async def configure(self, config: types.SimpleNamespace):
if comp in self.camera.components_attr:
self.log.debug(f"Ignoring Camera component {comp}.")
setattr(self.camera.check, comp, False)
elif comp in self.tcs.components_attr:
self.log.debug(f"Ignoring component {comp}.")
setattr(self.tcs.check, comp, False)
else:
self.log.warning(
f"Component {comp} not in CSC Group. "
f"Must be one of {self.camera.components_attr}. "
f"Must be one of {self.camera.components_attr} or {self.tcs.components_attr}."
f"Ignoring."
)

Expand Down Expand Up @@ -465,16 +479,19 @@ async def take_twilight_flats(self):
# get an empty field
search_area_degrees = 0.05

if self.config.tracking:
ra, dec = await self.get_twilight_flat_sky_coords(
target, radius=search_area_degrees
)
if self.config.position_telescope:
if self.config.tracking:
ra, dec = await self.get_twilight_flat_sky_coords(
target, radius=search_area_degrees
)

await self.track_radec_and_setup_instrument(ra, dec)
else:
az = self.get_target_az()
await self.track_radec_and_setup_instrument(ra, dec)
else:
az = self.get_target_az()

await self.slew_azel_and_setup_instrument(az, self.config.target_el)
await self.slew_azel_and_setup_instrument(az, self.config.target_el)
else:
await self.setup_instrument()

# Take one 1s flat to calibrate the exposure time
self.log.info("Taking 1s flat to calibrate exposure time.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,24 @@ async def slew_azel_and_setup_instrument(self, az, el):
el=el,
)

async def setup_instrument(self):
"""Abstract method to set the instrument. Change the filter
and track target.
"""
current_filter = await self.comcam.get_current_filter()

if current_filter != self.config.filter:
self.log.debug(
f"Filter change required: {current_filter} -> {self.config.filter}"
)
await self.comcam.setup_filter(filter=self.config.filter)
else:
self.log.debug(
f"Already in the desired filter ({current_filter}). Starting tracking"
)

await self.mtcs.start_tracking()

async def configure(self, config):
"""Take the sequence of twilight flats twilight flats."""
self.configure_client()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,21 @@ async def slew_azel_and_setup_instrument(self, az, el):
az=az,
el=el,
)

async def setup_instrument(self):
"""Abstract method to set the instrument. Change the filter
and slew and track target.
"""
current_filter = await self.lsstcam.get_current_filter()

if current_filter != self.config.filter:
self.log.debug(
f"Filter change required: {current_filter} -> {self.config.filter}"
)
await self.lsstcam.setup_filter(filter=self.config.filter)
else:
self.log.debug(
f"Already in the desired filter ({current_filter}), slewing."
)

await self.mtcs.start_tracking()

0 comments on commit e435397

Please sign in to comment.