Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
isotuela committed Jul 3, 2023
1 parent ff7cadc commit 1053af4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
7 changes: 5 additions & 2 deletions doc/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
Version History
===============

v1.25.0
-------

* Add new ``auxtel/calibrations/power_on_atcalsys.py`` script, unit test and executable to set up and turn on the ATCalSys white light.

v1.24.0
-------

Expand Down Expand Up @@ -61,8 +66,6 @@ v1.22.0

* Add new ``MoveP2P`` maintel script.

* Add new ``auxtel/calibrations/power_on_atcalsys.py`` script, unit test and executable to set up and turn on the ATCalSys white light.

v1.21.0
-------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def __init__(self, index, add_remotes: bool = True):
self.timeout_chiller_cool_down = 60 * 10
self.chiller_temp_tolerance_relative = 0.1

# Shutter
self.timeout_open_shutter = 60 * 5

@classmethod
def get_schema(cls):
schema_yaml = """
Expand Down Expand Up @@ -133,14 +136,12 @@ async def configure(self, config):
self.white_light_source = salobj.Remote(
domain=self.domain,
name="ATWhiteLight",
log=self.log,
)

if self.monochromator is None:
self.monochromator = salobj.Remote(
domain=self.domain,
name="ATMonochromator",
log=self.log,
)

await asyncio.gather(
Expand Down Expand Up @@ -215,8 +216,7 @@ async def wait_for_chiller_temp_within_tolerance(self):
)

async def open_white_light_shutter(self):
await self.white_light_source.cmd_openShutter.set_start()
# Q? Should we include a check that the shutter is open?
await self.white_light_source.cmd_openShutter.start(timeout=self.timeout_open_shutter)

async def switch_lamp_on(self):
await self.white_light_source.cmd_turnLampOn.set_start(
Expand All @@ -227,20 +227,17 @@ async def wait_for_lamp_to_warm_up(self):
self.white_light_source.evt_lampState.flush()
start_time_lamp_warm_up = time.time()
while time.time() - start_time_lamp_warm_up < self.timeout_lamp_warm_up:
lamp_state = await self.white_light_source.evt_lampState.aget(
timeout=self.timeout_lamp_warm_up
) # gets the most recent data

# Now enters the loop with the stop condition being that the lamp is ON

while lamp_state.basicState != ATWhiteLight.LampBasicState.ON:
lamp_state = await self.white_light_source.evt_lampState.next(
flush=False, timeout=self.timeout_lamp_warm_up
)
if lamp_state.basicState == ATWhiteLight.LampBasicState.WARMUP:
warmup_time_left = (
lamp_state.warmupEndTime - lamp_state.private_sndStamp
)
self.log.info(f"Time Left for lamp warmup: {warmup_time_left} min.")
await asyncio.sleep(self.track_lamp_warmup)

elif lamp_state.basicState == ATWhiteLight.LampBasicState.ON:
self.log.info(
f"White Light Lamp is on after a warm up of {time.time() - start_time_lamp_warm_up} s"
)
self.log.info(f"Lamp state: {ATWhiteLight.LampBasicState(lamp_state.basicState)!r}.")
else:
raise TimeoutError(
f"White Light Lamp failed to turn on after {self.timeout_lamp_warm_up} s"
Expand Down Expand Up @@ -273,11 +270,12 @@ async def configure_atmonochromator(self):
)

async def get_monochromator_parameters(self):
tmp1 = await self.monochromator.evt_selectedGrating.aget()
tmp2 = await self.monochromator.evt_wavelength.aget()
tmp3 = await self.monochromator.evt_entrySlitWidth.aget()
tmp4 = await self.monochromator.evt_exitSlitWidth.aget()
return (tmp1.gratingType, tmp2.wavelength, tmp3.width, tmp4.width)
return await asyncio.gather(
self.monochromator.evt_selectedGrating.aget(timeout=self.std_timeout),
self.monochromator.evt_wavelength.aget(timeout=self.std_timeout),
self.monochromator.evt_entrySlitWidth.aget(timeout=self.std_timeout),
self.monochromator.evt_exitSlitWidth.aget(timeout=self.std_timeout),
)

async def assert_components_enabled(self):
"""Check if ATWhiteLight and ATMonochromator are ENABLED"""
Expand All @@ -286,4 +284,4 @@ async def assert_components_enabled(self):
if salobj.State(summary_state.summaryState) != salobj.State(
salobj.State.ENABLED
):
raise Exception(f"{comp} is not ENABLED")
raise RuntimeError(f"{comp} is not ENABLED")

0 comments on commit 1053af4

Please sign in to comment.