Skip to content

Commit

Permalink
added LaserDetailedState
Browse files Browse the repository at this point in the history
  • Loading branch information
parfa30 committed Oct 30, 2024
1 parent 89077ae commit 5ce2e7d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/news/DM-46276.feature.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In ``mtcalsys.yaml``, Added laser configuration information to all tests, including laser mode and optical configuration.
1 change: 0 additions & 1 deletion doc/news/DM-46276.feature.2.rst

This file was deleted.

9 changes: 8 additions & 1 deletion doc/news/DM-46276.feature.rst
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
Changed change_laser_wavelength and setup_laser functions to be more useful in a variety of sal scripts
Add features to allow ``MTCalSys`` to better handle the laser
- In ``mtcalsys.py`` made the following changes:
- Added ``laser_start_propagate`` and ``laser_stop_propagate()``
- Added ``get_laser_parameters()``
- Improved ``setup_laser()`` to change the wavelength and the optical configuration
- Changed ``change_laser_wavelength()`` so it can be used for the laser or whitelight system
- In ``mtcalsys.yaml`` added a laser functional setup
- In ``mtcalsys_schema.yaml`` added laser mode and optical configuration
4 changes: 2 additions & 2 deletions python/lsst/ts/observatory/control/maintel/mtcalsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ async def get_laser_parameters(self) -> tuple:
self.rem.tunablelaser.evt_opticalConfiguration.aget(
timeout=self.long_timeout
),
self.rem.tunableevt_wavelengthChanged.aget(timeout=self.long_timeout),
self.rem.tunableevt_interlockState.aget(timeout=self.long_timeout),
self.rem.tunablelaser.evt_wavelengthChanged.aget(timeout=self.long_timeout),
self.rem.tunablelaser.evt_interlockState.aget(timeout=self.long_timeout),
self.rem.tunablelaser.evt_burstModeSet.aget(timeout=self.long_timeout),
self.rem.tunablelaser.evt_continuousModeSet.aget(timeout=self.long_timeout),
)
Expand Down
47 changes: 47 additions & 0 deletions tests/maintel/test_mtcalsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from lsst.ts.observatory.control.maintel.mtcalsys import MTCalsys, MTCalsysUsages
from lsst.ts.observatory.control.mock import RemoteGroupAsyncMock
from lsst.ts.utils import index_generator
from lsst.ts.xml.enums.TunableLaser import LaserDetailedState


class TestMTCalsys(RemoteGroupAsyncMock):
Expand Down Expand Up @@ -112,6 +113,52 @@ async def test_change_laser_wavelength(self) -> None:

await self.mtcalsys.change_laser_wavelength(wavelength=500.0)

async def test_setup_laser(self) -> None:
config_data = self.mtcalsys.get_calibration_configuration("laser_functional")

await self.mtcalsys.setup_laser(
mode=config_data["laser_mode"],
wavelength=config_data["wavelength"],
optical_configuration=config_data["optical_configuration"],
use_projector=config_data["false"],
)

self.mtcalsys.rem.tunablelaser.cmd_setOpticalConfiguration.set_start.assert_awaited_with(
configuration=config_data["optical_configuration"],
timeout=self.mtcalsys.long_timeout,
)

assert (
self.mtcalsys.rem.tunablelaser.evt_opticalConfiguration.aget().configuration
== config_data["optical_configuration"]
)

async def test_laser_start_propagation(self) -> None:
await self.mtcalsys.laser_start_propagate()

self.mtcalsys.rem.tunablelaser.cmd_startPropagateLaser.start.assert_awaited_with(
timeout=self.mtcalsys.laser_warmup
)

laser_state = self.mtcalsys.rem.tunablelaser.evt_detailedState.next()
assert laser_state.DetailedState in {
LaserDetailedState.PROPAGATING_CONTINUOUS_MODE,
LaserDetailedState.PROPAGATING_BURST_MODE,
}

async def test_laser_stop_propagation(self) -> None:
await self.mtcalsys.laser_stop_propagate()

self.mtcalsys.rem.tunablelaser.cmd_stopPropagateLaser.start.assert_awaited_with(
timeout=self.mtcalsys.laser_warmup
)

laser_state = self.mtcalsys.rem.tunablelaser.evt_detailedState.next()
assert laser_state.DetailedState in {
LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE,
LaserDetailedState.NONPROPAGATING_BURST_MODE,
}

async def test_prepare_for_whitelight_flat(self) -> None:
mock_comcam = ComCam(
"FakeDomain", log=self.log, intended_usage=ComCamUsages.DryTest
Expand Down

0 comments on commit 5ce2e7d

Please sign in to comment.