Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tickets/DM-47497 Adding CBP to MTCalsys #177

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions python/lsst/ts/observatory/control/data/mtcalsys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,20 @@ laser_functional:
use_fiberspectrograph_blue: false
exposure_times:
- 15.0

cbp_calibration:
calib_type: CBPCalibration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is defined as an enum in ts_observatorycontrol/utils/enums.py. calib_type identifies the light source. So let's keep this as Mono and introduce a new variable called use_cbp or something like that.

use_camera: false
wavelength: 700
wavelength_width: 800
wavelength_resolution: 50
use_cbpelectrometer: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we should rename the other electrometer to be flatfieldelectrometer or something like that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, use_electrometer is required currently. You'll have to add these two new ones to mtcalsys_schema.yaml

use_cbpcalelectrometer: true
use_fiberspectrograph_red: false
use_fiberspectrograph_blue: false
electrometer_integration_time: 0.001
electrometer_mode: CHARGE
electrometer_range: 2e-6
laser_mode: BURST
optical_configuration: F1_SCU
exposure_times: 30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know it it will be unhappy unless you put it in this format. It might be fine.
exposure_times:

  • 30.0

76 changes: 76 additions & 0 deletions python/lsst/ts/observatory/control/maintel/mtcalsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,15 @@ def __init__(
) -> None:

self.electrometer_projector_index = 103
self.electrometer_cbp_index = 101
self.electrometer_cbpcal_index = 102
self.fiberspectrograph_blue_index = 1
self.fiberspectrograph_red_index = 2
self.linearstage_led_select_index = 1
self.linearstage_led_focus_index = 2
self.linearstage_laser_focus_index = 3
self.linearstage_select_index = 4
self.cbp_index = 1

super().__init__(
components=[
Expand All @@ -144,10 +147,13 @@ def __init__(
f"FiberSpectrograph:{self.fiberspectrograph_blue_index}",
f"FiberSpectrograph:{self.fiberspectrograph_red_index}",
f"Electrometer:{self.electrometer_projector_index}",
f"ElectrometerCBP:{self.electrometer_cbp_index}",
f"ElectrometerCBPCal:{self.electrometer_cbpcal_index}",
f"LinearStage:{self.linearstage_led_select_index}",
f"LinearStage:{self.linearstage_led_focus_index}",
f"LinearStage:{self.linearstage_laser_focus_index}",
f"LinearStage:{self.linearstage_select_index}",
f"CBP:{self.cbp_index}",
],
domain=domain,
log=log,
Expand Down Expand Up @@ -200,6 +206,27 @@ async def setup_calsys(self, sequence_name: str) -> None:
await self.linearstage_projector_select.cmd_moveAbsolute.set_start(
distance=self.ls_select_led_location, timeout=self.long_timeout
)
elif (calibration_type == CalibrationType.CBPCalibration) or (
calibration_type == CalibrationType.CBP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned above, I thinks CalibrationType should remain the "light input" and we should create a new variable for the CBP vs. FlatField

):
await self.setup_cbp(
config_data["cbp_azimuth"],
config_data["cbp_elevation"],
config_data["cbp_mask"],
config_data["cbp_focus"],
config_data["cbp_rotation"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to add this to the mtcalsys.yaml file?

)
await self.setup_electrometers(
mode=str(config_data["electrometer_mode"]),
range=float(config_data["electrometer_range"]),
integration_time=float(config_data["electrometer_integration_time"]),
)
await self.setup_laser(
config_data["laser_mode"],
config_data["wavelength"],
config_data["optical_configuration"],
)
await self.laser_start_propagate()
else:
await self.linearstage_led_select.cmd_moveAbsolute.set_start(
distance=self.led_rest_position, timeout=self.long_timeout
Expand Down Expand Up @@ -339,6 +366,47 @@ async def setup_laser(
await self.change_laser_optical_configuration(optical_configuration)
await self.change_laser_wavelength(wavelength, use_projector)

async def setup_cbp(
self,
azimuth: float,
elevation: float,
mask: typing.Optional[int] = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be optional or have a default here? I think every time we move the CBP it would be good to confirm the mask, focus and rotation.

focus: typing.Optional[float] = None,
rotation: typing.Optional[int] = None,
) -> None:
"""Perform all steps for preparing the CBP for measurements.

Parameters
----------
az : `float`
Azimuth of CBP in degrees
el : `float`
Elevation of CBP in degrees
mask : `int`
Mask number to use
focus: `float`
Focus position in um
rot: `int`
Rotator position of mask in degrees
Default 0
use_projector : `bool`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this.

identifies if you are using the projector while
changing the wavelength
Default True
"""
timeout = 60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, don't use local timeout variable, we define some default timeouts in the base class. Chose one of those or make a custom one at the class level.

await self.rem.cbp.cmd_move.set_start(
azimuth=azimuth, elevation=elevation, timeout=timeout
)
if focus is not None:
await self.rem.cbp.cmd_setFocus.set_start(focus=focus, timeout=timeout)
if mask is not None:
await self.rem.cmd_changeMask.set_start(mask=mask, timeout=timeout)
if rotation is not None:
await self.rem.cmd_changeMaskRotation.set_start(
mask_rotation=rotation, timeout=timeout
)

async def get_laser_parameters(self) -> tuple:
"""Get laser configuration

Expand Down Expand Up @@ -854,6 +922,14 @@ async def take_fiber_spectrum(
def electrometer(self) -> salobj.Remote:
return getattr(self.rem, f"electrometer_{self.electrometer_projector_index}")

@property
def electrometerCBP(self) -> salobj.Remote:
return getattr(self.rem, f"electrometer_{self.electrometer_cbp_index}")

@property
def electrometerCBPCal(self) -> salobj.Remote:
return getattr(self.rem, f"electrometer_{self.electrometer_cbpcal_index}")

@property
def fiberspectrograph_red(self) -> salobj.Remote:
return getattr(
Expand Down
2 changes: 2 additions & 0 deletions python/lsst/ts/observatory/control/utils/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ class CalibrationType(enum.IntEnum):

WhiteLight = 1
Mono = 2
CBP = 3
CBPCalibration = 4


# TODO: (DM-46168) Revert workaround for TunableLaser XML changes
Expand Down
Loading