Skip to content

Commit

Permalink
Merge pull request #778 from lsst-ts/tickets/DM-41802
Browse files Browse the repository at this point in the history
Add quadrant property to M1M3 ForceActuator
  • Loading branch information
pkubanek authored Nov 20, 2023
2 parents 5dd593b + ccef192 commit f14bb88
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions doc/version-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Version History
===============

v21.0.0
-------

* Added qudrant property to M1M3 FATable.

v20.1.0
-------

Expand Down
10 changes: 10 additions & 0 deletions python/lsst/ts/xml/tables/m1m3/fa_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ class ForceActuatorData:
near_neighbors: list[int]
far_neighbors: list[int]

@property
def quadrant(self) -> int:
"""Returns actuator quadrant.
Returns
-------
quadrant : `int`
Actuator quadrant (1-4).
"""
return self.actuator_id // 100

def get_index(self, index_type: FAIndex) -> int | None:
"""Returns given index.
Expand Down
7 changes: 5 additions & 2 deletions tests/test_Units.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
# Enable colloquial Imperial units.
astropy.units.imperial.enable()
# Add rpm and gpm (gallon/min).
rpm = astropy.units.def_unit('rpm', astropy.units.cycle / astropy.units.s)
gpm = astropy.units.def_unit('gallon/min', astropy.units.imperial.gallon * 60 / astropy.units.s)
rpm = astropy.units.def_unit("rpm", astropy.units.cycle / astropy.units.s)
gpm = astropy.units.def_unit(
"gallon/min", astropy.units.imperial.gallon * 60 / astropy.units.s
)
astropy.units.add_enabled_units([rpm, gpm])


def check_for_issues(csc: str, topic: str) -> str:
jira = ""
return jira
Expand Down
5 changes: 5 additions & 0 deletions tests/test_tables_m1m3.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def test_neighbors(self) -> None:
self.assert_sorted(item2.near_neighbors_indices(FAIndex.X), [])
self.assert_sorted(item2.only_far_neighbors_indices(FAIndex.X), [9])

def test_quadrant(self) -> None:
self.assertEqual(FATable[1].quadrant, 1)
self.assertEqual(FATable[45].quadrant, 2)
self.assertEqual(FATable[155].quadrant, 4)


if __name__ == "__main__":
unittest.main()

0 comments on commit f14bb88

Please sign in to comment.