Skip to content

Commit

Permalink
Formatting improvements to XML_Units.rst.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbovill committed Mar 21, 2024
1 parent 93011c1 commit 83c0168
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions Control-User-Interfaces/XML_Units.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,28 @@ XML Unit Standards

.. Define policy pertaining to XML unit definitions
It is the policy of this Project to use the `International System of Units <https://www.nist.gov/pml/owm/metric-si/si-units>`_ (SI), by default, in all XML Unit definitions. The Project recognizes that certain hardware and system constraints may require the use of units outside this standard. For example, many hardware components measure pressure in the common Imperial units of psi, psia or psig (all variants of pounds per square inch). Steps were taken to allow for exceptions in these cases. The process for requesting an exception is defined in the Non-SI Unit Requests section of this document.
It is the policy of this Project to use the `International System of Units <https://www.nist.gov/pml/owm/metric-si/si-units>`_ (SI), by default, in all XML Unit definitions.
The Project recognizes that certain hardware and system constraints may require the use of units outside this standard.
For example, many hardware components measure pressure in the common Imperial units of psi, psia or psig (all variants of pounds per square inch).
Steps were taken to allow for exceptions in these cases.
The process for requesting an exception is defined in the Non-SI Unit Requests section of this document.

The Commandable SAL Component (CSC) interface definitions, the XML files, are located in the `ts_xml <https://github.com/lsst-ts/ts_xml>`_ repository. This repo is maintained by the Telescope & Site Software (TSSW) team, but is utilized by the Project as a whole. As such, this Unit Standards definition is published at the `Observatory Controls <https://obs-controls.lsst.io/index.html>`_ level, but is cross-linked to the `TSSW Developer Guide <https://tssw-developer.lsst.io/index.html>`_ for completeness.
The Commandable SAL Component (CSC) interface definitions, the XML files, are located in the `ts_xml <https://github.com/lsst-ts/ts_xml>`_ repository.
This repo is maintained by the Telescope & Site Software (TSSW) team, but is utilized by the Project as a whole.
As such, this Unit Standards definition is published at the `Observatory Controls <https://obs-controls.lsst.io/index.html>`_ level, but is cross-linked to the `TSSW Developer Guide <https://tssw-developer.lsst.io/index.html>`_ for completeness.


XML Unit Standards Verification
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The Project elected to use the `Astropy Python library <https://docs.astropy.org/en/stable/units/>`_ to verify the units defined in the XML files conform to SI-standards. Additionally, all XML formatting is defined by the schemas located in the `ts_xml <https://github.com/lsst-ts/ts_xml>`_ repository. The enforcement of these content and formatting standards is done via the `unit tests <https://github.com/lsst-ts/ts_xml/tree/develop/tests>`_ that are run automatically with each new commit and pull request. They can also be run manually by following the instructions located in the `ts_xml README <https://github.com/lsst-ts/ts_xml?tab=readme-ov-file>`_.
The Project elected to use the `Astropy Python library <https://docs.astropy.org/en/stable/units/>`_ to verify the units defined in the XML files conform to SI-standard.
Additionally, all XML formatting is defined by the schemas located in the `ts_xml <https://github.com/lsst-ts/ts_xml>`_ repository.
The enforcement of these content and formatting standards is done via the `unit tests <https://github.com/lsst-ts/ts_xml/tree/develop/tests>`_ that are run automatically with each new commit and pull request.
They can also be run manually by following the instructions located in the `ts_xml README <https://github.com/lsst-ts/ts_xml?tab=readme-ov-file>`_.

The Astropy library also contains utilities for unit conversion. As such, it is possible to take non-SI units published by hardware components or third-party software tools and convert them to SI-units, in the CSC code, for the purpose of interface definitions and publishing to the Engineering Facility Database (EFD). For example, to convert psi to Pa, the following code example can be used:
The Astropy library also contains utilities for unit conversion.
As such, it is possible to take non-SI units published by hardware components or third-party software tools and convert them to SI-units, in the CSC code, for the purpose of interface definitions and publishing to the Engineering Facility Database (EFD).
For example, to convert psi to Pa, the following code example can be used:

.. code-block:: python
Expand All @@ -65,7 +76,10 @@ The Astropy library also contains utilities for unit conversion. As such, it is
Non-SI Unit Requests
^^^^^^^^^^^^^^^^^^^^

To request the use of a non-SI unit, a request must be made at the weekly Commissioning Activities Planning (CAP) meeting. The request must be made and approved BEFORE the changes are implemented. Simply add an agenda item to the `Future Meetings <https://confluence.lsstcorp.org/display/LSSTCOM/Agenda+Items+for+Future+CAP+Meetings>`_ page, attend the specific meeting once accepted and present the case. If approved, continue with the development process defined in the `TSSW Developer Guide <https://tssw-developer.lsst.io/index.html>`_, specifically the `Reporting Work for XML Release <https://tssw-developer.lsst.io/development-guidelines/xml/reporting-xml-release-work.html#reporting-xml-release-work>`_ section.
To request the use of a non-SI unit, a request must be made at the weekly Commissioning Activities Planning (CAP) meeting.
The request must be made and approved BEFORE the changes are implemented.
Simply add an agenda item to the `Future Meetings <https://confluence.lsstcorp.org/display/LSSTCOM/Agenda+Items+for+Future+CAP+Meetings>`_ page, attend the specific meeting once accepted and present the case.
If approved, continue with the development process defined in the `TSSW Developer Guide <https://tssw-developer.lsst.io/index.html>`_, specifically the `Reporting Work for XML Release <https://tssw-developer.lsst.io/development-guidelines/xml/reporting-xml-release-work.html#reporting-xml-release-work>`_ section.

Types of Exceptions
-------------------
Expand All @@ -75,9 +89,13 @@ There are actually two ways to handle non-standard unit exceptions:
#. Improvements to the Astropy library.
#. Explicit unit test exceptions.

For the first case, there have been times when a conventional SI unit was not included in the Astropy definition. In this case, a change request was made directly to the Astropy maintainers to add the unit to the library. In the interim, until the change is released, the second method is used and then removed.
For the first case, there have been times when a conventional SI unit was not included in the Astropy definition.
In this case, a change request is made directly to the Astropy maintainers to add the unit to the library.
In the interim, until the change is released, the second method is used and then removed.

In the second case, the `unit test <https://github.com/lsst-ts/ts_xml/blob/develop/tests/test_Units.py>`_ that verifies unit conformity is updated to allow for the non-standard unit. Either the unit is added to the NONSTANDARD_UNITS list, or it is added to the local instance of the Astropy library using the tools provided by the library itself. Examples of both methods can be found in the unit test file linked above.
In the second case, the `unit test <https://github.com/lsst-ts/ts_xml/blob/develop/tests/test_Units.py>`_ that verifies unit conformity is updated to allow for the non-standard unit.
Either the unit is added to the NONSTANDARD_UNITS list, or it is added to the local instance of the Astropy library using the tools provided by the library itself.
Examples of both methods can be found in the unit test file linked above.

Any changes to the unit test constitute a change to the ts_xml package, and therefore must follow the development guidelines before being released.

0 comments on commit 83c0168

Please sign in to comment.