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

Add dofs vector option to apply_dof.py #231

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions doc/news/DM-46883.perf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add dofs vector option for `apply_dof.py` script.
20 changes: 17 additions & 3 deletions python/lsst/ts/standardscripts/maintel/apply_dof.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ def get_schema(cls) -> typing.Dict[str, typing.Any]:
description: Configuration for ApplyDOF Script.
type: object
properties:
dofs:
type: array
description: >-
Defines a 50-dimensional vector for all DOFs, combining M2,
Camera, M1M3, and M2 bending modes. This overrides individual DOF inputs.
First 5 elements for M2, next 5 for Camera, next 20 for M1M3 bending modes,
last 20 for M2 bending modes. Units: microns or arcsec.
items:
type: number
minItems: 50
maxItems: 50
M2_dz:
type: number
description: >-
Expand Down Expand Up @@ -395,9 +406,12 @@ async def configure(self, config) -> None:
# Configure tcs and camera
await self.configure_tcs()

# Loop through properties and assign their values to the vector
for key, value in vars(config).items():
self.dofs[getattr(DOFName, key)] = value
if hasattr(config, "dofs"):
self.dofs = config.dofs
else:
# Loop through properties and assign their values to the vector
for key, value in vars(config).items():
self.dofs[getattr(DOFName, key)] = value

def set_metadata(self, metadata) -> None:
"""Set script metadata.
Expand Down
15 changes: 15 additions & 0 deletions tests/test_maintel_apply_dof.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ async def test_configure(self) -> None:

assert all(self.script.dofs == dofs)

async def test_configure_with_dofs_vector(self) -> None:
async with self.make_script():
dofs = [0] * len(DOFName)
config_dofs = {
"M2_dz": 0.2,
"Cam_dy": 0.3,
"M1M3_B1": 0.5,
"M2_B14": 0.7,
"dofs": dofs,
}

await self.configure_script(**config_dofs)

assert self.script.dofs == dofs

async def test_run(self) -> None:
# Start the test itself
async with self.make_script():
Expand Down
Loading