From 1b5e235de22ea23d8ca820284bd9491ea9d5325f Mon Sep 17 00:00:00 2001 From: Parker Fagrelius Date: Fri, 6 Sep 2024 12:48:17 -0700 Subject: [PATCH 1/5] removed optical configuration from enums --- python/lsst/ts/tunablelaser/enums.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/python/lsst/ts/tunablelaser/enums.py b/python/lsst/ts/tunablelaser/enums.py index 729e607..dc71f1d 100644 --- a/python/lsst/ts/tunablelaser/enums.py +++ b/python/lsst/ts/tunablelaser/enums.py @@ -1,4 +1,4 @@ -__all__ = ["Power", "Mode", "Output", "OpticalConfiguration"] +__all__ = ["Power", "Mode", "Output"] import enum @@ -31,20 +31,3 @@ class Output(enum.StrEnum): """A calibration energy level where the energy level adjusts.""" MAX = "MAX" """Maximum energy level for the laser.""" - - -class OpticalConfiguration(enum.StrEnum): - """Configuration of the optical output""" - - SCU = "SCU" - """Pass the beam straight-through the SCU.""" - F1_SCU = "F1 SCU" - """Direct the beam through the F1 after passing through the SCU.""" - F2_SCU = "F2 SCU" - """Direct the beam through the F2 after passing through the SCU.""" - NO_SCU = "No SCU" - """Pass the beam straight-through.""" - F1_NO_SCU = "F1 No SCU" - """Pass the beam to F1 output.""" - F2_NO_SCU = "F2 No SCU" - """Pass the beam to F2 output.""" From 16e7d93b1a50c75f728258007a6da7b107e61822 Mon Sep 17 00:00:00 2001 From: Parker Fagrelius Date: Fri, 6 Sep 2024 13:28:35 -0700 Subject: [PATCH 2/5] workarounds for optical configuration --- python/lsst/ts/tunablelaser/component.py | 2 +- python/lsst/ts/tunablelaser/config_schema.py | 2 +- python/lsst/ts/tunablelaser/csc.py | 89 ++++++++++++++------ python/lsst/ts/tunablelaser/mock_server.py | 30 ++++++- 4 files changed, 92 insertions(+), 31 deletions(-) diff --git a/python/lsst/ts/tunablelaser/component.py b/python/lsst/ts/tunablelaser/component.py index 17b955a..3334961 100755 --- a/python/lsst/ts/tunablelaser/component.py +++ b/python/lsst/ts/tunablelaser/component.py @@ -142,7 +142,7 @@ async def set_optical_configuration(self, optical_configuration): Parameters ---------- - optical_configuration: `str`, {straight-through,F1,F2} + optical_configuration: `str`, OpticalConfiguration(enum.StrEnum) The optical alignment to switch to. """ self.maxi_opg.optical_alignment = optical_configuration diff --git a/python/lsst/ts/tunablelaser/config_schema.py b/python/lsst/ts/tunablelaser/config_schema.py index e6b4f10..36617bb 100644 --- a/python/lsst/ts/tunablelaser/config_schema.py +++ b/python/lsst/ts/tunablelaser/config_schema.py @@ -46,7 +46,7 @@ type: number optical_configuration: description: The mirror alignment configuration for the laser - enum: ["SCU","No SCU","F1 SCU","F1 No SCU","F2 SCU","F2 No SCU"] + enum: OpticalConfiguration(enum.StrEnum) wavelength: description: The min and max wavelengths for the laser type: object diff --git a/python/lsst/ts/tunablelaser/csc.py b/python/lsst/ts/tunablelaser/csc.py index e751a51..2b85c5b 100755 --- a/python/lsst/ts/tunablelaser/csc.py +++ b/python/lsst/ts/tunablelaser/csc.py @@ -26,8 +26,36 @@ import asyncio +# TODO: (DM-46168) Revert workaround for TunableLaser XML changes +import enum + +import warning from lsst.ts import salobj, utils -from lsst.ts.xml.enums import TunableLaser +from lsst.ts.xml.enums.TunableLaser import LaserDetailedState, LaserErrorCode + +try: + from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration +except ImportError: + warning.warn( + "OpticalConfiguration enumeration not availble in ts-xml. Using local version." + ) + + class OpticalConfiguration(enum.StrEnum): + """Configuration of the optical output""" + + SCU = "SCU" + """Pass the beam straight-through the SCU.""" + F1_SCU = "F1 SCU" + """Direct the beam through the F1 after passing through the SCU.""" + F2_SCU = "F2 SCU" + """Direct the beam through the F2 after passing through the SCU.""" + NO_SCU = "No SCU" + """Pass the beam straight-through.""" + F1_NO_SCU = "F1 No SCU" + """Pass the beam to F1 output.""" + F2_NO_SCU = "F2 No SCU" + """Pass the beam to F2 output.""" + from . import __version__, component, mock_server from .config_schema import CONFIG_SCHEMA @@ -119,7 +147,7 @@ async def telemetry(self): or self.model.m_cpu800.power_register_2.register_value == "FAULT" ): await self.fault( - code=TunableLaser.LaserErrorCode.HW_CPU_ERROR, + code=LaserErrorCode.HW_CPU_ERROR, report=( f"cpu8000 fault:{self.model.cpu8000.fault_register.register_value}" f"m_cpu800 fault:{self.model.m_cpu800.fault_register.register_value}" @@ -166,7 +194,7 @@ def assert_substate(self, substates, action): """ if self.evt_detailedState.data.detailedState not in [ - TunableLaser.LaserDetailedState(substate) for substate in substates + LaserDetailedState(substate) for substate in substates ]: raise salobj.ExpectedError( f"{action} not allowed in state {self.evt_detailedState.data.detailedState!r}" @@ -195,7 +223,7 @@ async def handle_summary_state(self): if not self.connected and self.model is not None: await self.evt_detailedState.set_write( - detailedState=TunableLaser.LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE + detailedState=LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE ) try: await self.model.connect() @@ -212,7 +240,7 @@ async def handle_summary_state(self): ): await self.model.stop_propagating() await self.publish_new_detailed_state( - TunableLaser.LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE + LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE ) if self.telemetry_task.done(): self.telemetry_task = asyncio.create_task(self.telemetry()) @@ -245,18 +273,18 @@ async def do_setBurstMode(self, data): await self.model.set_burst_mode(data.count) await self.evt_burstModeSet.set_write() if self.evt_detailedState.data.detailedState in [ - TunableLaser.LaserDetailedState.PROPAGATING_BURST_MODE, - TunableLaser.LaserDetailedState.PROPAGATING_CONTINUOUS_MODE, + LaserDetailedState.PROPAGATING_BURST_MODE, + LaserDetailedState.PROPAGATING_CONTINUOUS_MODE, ]: await self.publish_new_detailed_state( - TunableLaser.LaserDetailedState.PROPAGATING_BURST_MODE + LaserDetailedState.PROPAGATING_BURST_MODE ) if self.evt_detailedState.data.detailedState in [ - TunableLaser.LaserDetailedState.NONPROPAGATING_BURST_MODE, - TunableLaser.LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE, + LaserDetailedState.NONPROPAGATING_BURST_MODE, + LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE, ]: await self.publish_new_detailed_state( - TunableLaser.LaserDetailedState.NONPROPAGATING_BURST_MODE + LaserDetailedState.NONPROPAGATING_BURST_MODE ) else: raise salobj.ExpectedError("Not connected.") @@ -303,8 +331,8 @@ async def do_startPropagateLaser(self, data): self.assert_enabled() self.assert_substate( [ - TunableLaser.LaserDetailedState.NONPROPAGATING_BURST_MODE, - TunableLaser.LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE, + LaserDetailedState.NONPROPAGATING_BURST_MODE, + LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE, ], "startPropagateLaser", ) @@ -324,8 +352,8 @@ async def do_stopPropagateLaser(self, data): self.assert_enabled() self.assert_substate( [ - TunableLaser.LaserDetailedState.PROPAGATING_BURST_MODE, - TunableLaser.LaserDetailedState.PROPAGATING_CONTINUOUS_MODE, + LaserDetailedState.PROPAGATING_BURST_MODE, + LaserDetailedState.PROPAGATING_CONTINUOUS_MODE, ], "stopPropagateLaser", ) @@ -333,17 +361,17 @@ async def do_stopPropagateLaser(self, data): await self.model.stop_propagating() if ( self.evt_detailedState.data.detailedState - == TunableLaser.LaserDetailedState.PROPAGATING_BURST_MODE + == LaserDetailedState.PROPAGATING_BURST_MODE ): await self.publish_new_detailed_state( - TunableLaser.LaserDetailedState.NONPROPAGATING_BURST_MODE + LaserDetailedState.NONPROPAGATING_BURST_MODE ) elif ( self.evt_detailedState.data.detailedState - == TunableLaser.LaserDetailedState.PROPAGATING_CONTINUOUS_MODE + == LaserDetailedState.PROPAGATING_CONTINUOUS_MODE ): await self.publish_new_detailed_state( - TunableLaser.LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE + LaserDetailedState.NONPROPAGATING_CONTINUOUS_MODE ) else: raise salobj.ExpectedError("Not connected.") @@ -366,7 +394,7 @@ async def do_triggerBurst(self, data): """Trigger a burst.""" self.assert_enabled() self.assert_substate( - [TunableLaser.LaserDetailedState.PROPAGATING_BURST_MODE], + [LaserDetailedState.PROPAGATING_BURST_MODE], "Trigger", ) await self.model.trigger_burst() @@ -403,14 +431,19 @@ async def do_setOpticalConfiguration(self, data): alignment of the laser. """ self.assert_enabled() - if self.connected: - if self.laser_type == "Main": # only main laser can do this - await self.model.set_optical_configuration(data.configuration) - await self.evt_opticalConfiguration.set_write( - configuration=data.configuration - ) + if data.configuration not in OpticalConfiguration: + raise salobj.ExpectedError( + f"Optical Configuration {data.configuration} not included in allowable options" + ) else: - raise salobj.ExpectedError("Not connected") + if self.connected: + if self.laser_type == "Main": # only main laser can do this + await self.model.set_optical_configuration(data.configuration) + await self.evt_opticalConfiguration.set_write( + configuration=data.configuration + ) + else: + raise salobj.ExpectedError("Not connected") async def publish_new_detailed_state(self, new_sub_state): """Publish the updated detailed state. @@ -420,7 +453,7 @@ async def publish_new_detailed_state(self, new_sub_state): new_sub_state : `LaserDetailedState` The new sub state to publish. """ - new_sub_state = TunableLaser.LaserDetailedState(new_sub_state) + new_sub_state = LaserDetailedState(new_sub_state) await self.evt_detailedState.set_write(detailedState=new_sub_state) async def configure(self, config): diff --git a/python/lsst/ts/tunablelaser/mock_server.py b/python/lsst/ts/tunablelaser/mock_server.py index c0ec0cb..573270d 100755 --- a/python/lsst/ts/tunablelaser/mock_server.py +++ b/python/lsst/ts/tunablelaser/mock_server.py @@ -30,16 +30,44 @@ ] import asyncio + +# TODO: (DM-46168) Revert workaround for TunableLaser XML changes +import enum import inspect import io import logging import random from ipaddress import ip_address +import warning from lsst.ts import tcpip from .compoway_register import CompoWayFGeneralRegister -from .enums import Mode, OpticalConfiguration, Output, Power +from .enums import Mode, Output, Power + +try: + from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration +except ImportError: + warning.warn( + "OpticalConfiguration enumeration not availble in ts-xml. Using local version." + ) + + class OpticalConfiguration(enum.StrEnum): + """Configuration of the optical output""" + + SCU = "SCU" + """Pass the beam straight-through the SCU.""" + F1_SCU = "F1 SCU" + """Direct the beam through the F1 after passing through the SCU.""" + F2_SCU = "F2 SCU" + """Direct the beam through the F2 after passing through the SCU.""" + NO_SCU = "No SCU" + """Pass the beam straight-through.""" + F1_NO_SCU = "F1 No SCU" + """Pass the beam to F1 output.""" + F2_NO_SCU = "F2 No SCU" + """Pass the beam to F2 output.""" + TERMINATOR = b"\r\n\x03" From 0b56dc99158f4ad68e5c17604b356195f23b6df3 Mon Sep 17 00:00:00 2001 From: Parker Fagrelius Date: Fri, 6 Sep 2024 14:50:37 -0700 Subject: [PATCH 3/5] updates; --- python/lsst/ts/tunablelaser/canbus_modules.py | 28 ++++++++++++++++++- python/lsst/ts/tunablelaser/config_schema.py | 2 +- python/lsst/ts/tunablelaser/csc.py | 24 ++++++++-------- python/lsst/ts/tunablelaser/mock_server.py | 7 ++--- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/python/lsst/ts/tunablelaser/canbus_modules.py b/python/lsst/ts/tunablelaser/canbus_modules.py index d570312..dfc3580 100755 --- a/python/lsst/ts/tunablelaser/canbus_modules.py +++ b/python/lsst/ts/tunablelaser/canbus_modules.py @@ -45,13 +45,39 @@ "MidiOPG", "E5DCB", ] +# TODO: (DM-46168) Revert workaround for TunableLaser XML changes +import enum import logging +import warnings from . import interfaces from .compoway_register import CompoWayFDataRegister, CompoWayFOperationRegister -from .enums import Mode, OpticalConfiguration, Output, Power +from .enums import Mode, Output, Power from .register import AsciiRegister +try: + from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration +except ImportError: + warnings.warn( + "OpticalConfiguration enumeration not availble in ts-xml. Using local version." + ) + + class OpticalConfiguration(enum.StrEnum): + """Configuration of the optical output""" + + SCU = "SCU" + """Pass the beam straight-through the SCU.""" + F1_SCU = "F1 SCU" + """Direct the beam through the F1 after passing through the SCU.""" + F2_SCU = "F2 SCU" + """Direct the beam through the F2 after passing through the SCU.""" + NO_SCU = "No SCU" + """Pass the beam straight-through.""" + F1_NO_SCU = "F1 No SCU" + """Pass the beam to F1 output.""" + F2_NO_SCU = "F2 No SCU" + """Pass the beam to F2 output.""" + class CPU8000(interfaces.CanbusModule): """Implement the CPU8000 laser module which displays information about diff --git a/python/lsst/ts/tunablelaser/config_schema.py b/python/lsst/ts/tunablelaser/config_schema.py index 36617bb..e7e9469 100644 --- a/python/lsst/ts/tunablelaser/config_schema.py +++ b/python/lsst/ts/tunablelaser/config_schema.py @@ -46,7 +46,7 @@ type: number optical_configuration: description: The mirror alignment configuration for the laser - enum: OpticalConfiguration(enum.StrEnum) + enum: ["SCU","F1 SCU","F2 SCU","No SCU","F1 No SCU","F2 No SCU"] wavelength: description: The min and max wavelengths for the laser type: object diff --git a/python/lsst/ts/tunablelaser/csc.py b/python/lsst/ts/tunablelaser/csc.py index 2b85c5b..fd90134 100755 --- a/python/lsst/ts/tunablelaser/csc.py +++ b/python/lsst/ts/tunablelaser/csc.py @@ -28,15 +28,15 @@ # TODO: (DM-46168) Revert workaround for TunableLaser XML changes import enum +import warnings -import warning from lsst.ts import salobj, utils from lsst.ts.xml.enums.TunableLaser import LaserDetailedState, LaserErrorCode try: from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration except ImportError: - warning.warn( + warnings.warn( "OpticalConfiguration enumeration not availble in ts-xml. Using local version." ) @@ -431,19 +431,21 @@ async def do_setOpticalConfiguration(self, data): alignment of the laser. """ self.assert_enabled() - if data.configuration not in OpticalConfiguration: + try: + configuration = OpticalConfiguration(data.configuration) + except Exception: raise salobj.ExpectedError( f"Optical Configuration {data.configuration} not included in allowable options" ) + + if self.connected: + if self.laser_type == "Main": # only main laser can do this + await self.model.set_optical_configuration(configuration) + await self.evt_opticalConfiguration.set_write( + configuration=configuration + ) else: - if self.connected: - if self.laser_type == "Main": # only main laser can do this - await self.model.set_optical_configuration(data.configuration) - await self.evt_opticalConfiguration.set_write( - configuration=data.configuration - ) - else: - raise salobj.ExpectedError("Not connected") + raise salobj.ExpectedError("Not connected") async def publish_new_detailed_state(self, new_sub_state): """Publish the updated detailed state. diff --git a/python/lsst/ts/tunablelaser/mock_server.py b/python/lsst/ts/tunablelaser/mock_server.py index 573270d..e14fe82 100755 --- a/python/lsst/ts/tunablelaser/mock_server.py +++ b/python/lsst/ts/tunablelaser/mock_server.py @@ -30,25 +30,24 @@ ] import asyncio - -# TODO: (DM-46168) Revert workaround for TunableLaser XML changes import enum import inspect import io import logging import random +import warnings from ipaddress import ip_address -import warning from lsst.ts import tcpip from .compoway_register import CompoWayFGeneralRegister from .enums import Mode, Output, Power +# TODO: (DM-46168) Revert workaround for TunableLaser XML changes try: from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration except ImportError: - warning.warn( + warnings.warn( "OpticalConfiguration enumeration not availble in ts-xml. Using local version." ) From 8e384cbde747a2f90edd8ce357094f14521509f6 Mon Sep 17 00:00:00 2001 From: Parker Fagrelius Date: Wed, 18 Sep 2024 11:55:51 -0700 Subject: [PATCH 4/5] added OpticalConf back into enums --- python/lsst/ts/tunablelaser/canbus_modules.py | 29 ++----------------- python/lsst/ts/tunablelaser/config_schema.py | 2 +- python/lsst/ts/tunablelaser/csc.py | 29 +------------------ python/lsst/ts/tunablelaser/enums.py | 28 +++++++++++++++++- python/lsst/ts/tunablelaser/mock_server.py | 29 +------------------ 5 files changed, 32 insertions(+), 85 deletions(-) diff --git a/python/lsst/ts/tunablelaser/canbus_modules.py b/python/lsst/ts/tunablelaser/canbus_modules.py index dfc3580..1a1b477 100755 --- a/python/lsst/ts/tunablelaser/canbus_modules.py +++ b/python/lsst/ts/tunablelaser/canbus_modules.py @@ -45,39 +45,14 @@ "MidiOPG", "E5DCB", ] -# TODO: (DM-46168) Revert workaround for TunableLaser XML changes -import enum + import logging -import warnings from . import interfaces from .compoway_register import CompoWayFDataRegister, CompoWayFOperationRegister -from .enums import Mode, Output, Power +from .enums import Mode, OpticalConfiguration, Output, Power from .register import AsciiRegister -try: - from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration -except ImportError: - warnings.warn( - "OpticalConfiguration enumeration not availble in ts-xml. Using local version." - ) - - class OpticalConfiguration(enum.StrEnum): - """Configuration of the optical output""" - - SCU = "SCU" - """Pass the beam straight-through the SCU.""" - F1_SCU = "F1 SCU" - """Direct the beam through the F1 after passing through the SCU.""" - F2_SCU = "F2 SCU" - """Direct the beam through the F2 after passing through the SCU.""" - NO_SCU = "No SCU" - """Pass the beam straight-through.""" - F1_NO_SCU = "F1 No SCU" - """Pass the beam to F1 output.""" - F2_NO_SCU = "F2 No SCU" - """Pass the beam to F2 output.""" - class CPU8000(interfaces.CanbusModule): """Implement the CPU8000 laser module which displays information about diff --git a/python/lsst/ts/tunablelaser/config_schema.py b/python/lsst/ts/tunablelaser/config_schema.py index e7e9469..22019c5 100644 --- a/python/lsst/ts/tunablelaser/config_schema.py +++ b/python/lsst/ts/tunablelaser/config_schema.py @@ -46,7 +46,7 @@ type: number optical_configuration: description: The mirror alignment configuration for the laser - enum: ["SCU","F1 SCU","F2 SCU","No SCU","F1 No SCU","F2 No SCU"] + enum: {[e.value for e in OpticalConfiguration]} wavelength: description: The min and max wavelengths for the laser type: object diff --git a/python/lsst/ts/tunablelaser/csc.py b/python/lsst/ts/tunablelaser/csc.py index fd90134..ff7e017 100755 --- a/python/lsst/ts/tunablelaser/csc.py +++ b/python/lsst/ts/tunablelaser/csc.py @@ -26,39 +26,12 @@ import asyncio -# TODO: (DM-46168) Revert workaround for TunableLaser XML changes -import enum -import warnings - from lsst.ts import salobj, utils from lsst.ts.xml.enums.TunableLaser import LaserDetailedState, LaserErrorCode -try: - from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration -except ImportError: - warnings.warn( - "OpticalConfiguration enumeration not availble in ts-xml. Using local version." - ) - - class OpticalConfiguration(enum.StrEnum): - """Configuration of the optical output""" - - SCU = "SCU" - """Pass the beam straight-through the SCU.""" - F1_SCU = "F1 SCU" - """Direct the beam through the F1 after passing through the SCU.""" - F2_SCU = "F2 SCU" - """Direct the beam through the F2 after passing through the SCU.""" - NO_SCU = "No SCU" - """Pass the beam straight-through.""" - F1_NO_SCU = "F1 No SCU" - """Pass the beam to F1 output.""" - F2_NO_SCU = "F2 No SCU" - """Pass the beam to F2 output.""" - - from . import __version__, component, mock_server from .config_schema import CONFIG_SCHEMA +from .enums import OpticalConfiguration def run_tunablelaser(): diff --git a/python/lsst/ts/tunablelaser/enums.py b/python/lsst/ts/tunablelaser/enums.py index dc71f1d..3a03660 100644 --- a/python/lsst/ts/tunablelaser/enums.py +++ b/python/lsst/ts/tunablelaser/enums.py @@ -1,6 +1,7 @@ -__all__ = ["Power", "Mode", "Output"] +__all__ = ["Power", "Mode", "Output", "OpticalConfiguration"] import enum +import warnings class Power(enum.StrEnum): @@ -31,3 +32,28 @@ class Output(enum.StrEnum): """A calibration energy level where the energy level adjusts.""" MAX = "MAX" """Maximum energy level for the laser.""" + + +# TODO: (DM-46168) Revert workaround for TunableLaser XML changes +try: + from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration +except ImportError: + warnings.warn( + "OpticalConfiguration enumeration not availble in ts-xml. Using local version." + ) + + class OpticalConfiguration(enum.StrEnum): + """Configuration of the optical output""" + + SCU = "SCU" + """Pass the beam straight-through the SCU.""" + F1_SCU = "F1 SCU" + """Direct the beam through the F1 after passing through the SCU.""" + F2_SCU = "F2 SCU" + """Direct the beam through the F2 after passing through the SCU.""" + NO_SCU = "No SCU" + """Pass the beam straight-through.""" + F1_NO_SCU = "F1 No SCU" + """Pass the beam to F1 output.""" + F2_NO_SCU = "F2 No SCU" + """Pass the beam to F2 output.""" diff --git a/python/lsst/ts/tunablelaser/mock_server.py b/python/lsst/ts/tunablelaser/mock_server.py index e14fe82..c0ec0cb 100755 --- a/python/lsst/ts/tunablelaser/mock_server.py +++ b/python/lsst/ts/tunablelaser/mock_server.py @@ -30,43 +30,16 @@ ] import asyncio -import enum import inspect import io import logging import random -import warnings from ipaddress import ip_address from lsst.ts import tcpip from .compoway_register import CompoWayFGeneralRegister -from .enums import Mode, Output, Power - -# TODO: (DM-46168) Revert workaround for TunableLaser XML changes -try: - from lsst.ts.xml.enums.TunableLaser import OpticalConfiguration -except ImportError: - warnings.warn( - "OpticalConfiguration enumeration not availble in ts-xml. Using local version." - ) - - class OpticalConfiguration(enum.StrEnum): - """Configuration of the optical output""" - - SCU = "SCU" - """Pass the beam straight-through the SCU.""" - F1_SCU = "F1 SCU" - """Direct the beam through the F1 after passing through the SCU.""" - F2_SCU = "F2 SCU" - """Direct the beam through the F2 after passing through the SCU.""" - NO_SCU = "No SCU" - """Pass the beam straight-through.""" - F1_NO_SCU = "F1 No SCU" - """Pass the beam to F1 output.""" - F2_NO_SCU = "F2 No SCU" - """Pass the beam to F2 output.""" - +from .enums import Mode, OpticalConfiguration, Output, Power TERMINATOR = b"\r\n\x03" From 66e7a9a43bdffd6c9ae68e79257fabea64ce1d2e Mon Sep 17 00:00:00 2001 From: Parker Fagrelius Date: Wed, 18 Sep 2024 11:58:29 -0700 Subject: [PATCH 5/5] changed config_schema --- python/lsst/ts/tunablelaser/config_schema.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/lsst/ts/tunablelaser/config_schema.py b/python/lsst/ts/tunablelaser/config_schema.py index 22019c5..2f1396d 100644 --- a/python/lsst/ts/tunablelaser/config_schema.py +++ b/python/lsst/ts/tunablelaser/config_schema.py @@ -23,8 +23,10 @@ import yaml +from .enums import OpticalConfiguration + CONFIG_SCHEMA = yaml.safe_load( - """ + f""" $schema: http://json-schema.org/draft-07/schema# $id: https://github.com/lsst-ts/ts_TunableLaser/blob/master/schema/TunableLaser.yaml title: TunableLaser v4