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

Addition of Vaisala resources #14

Merged
merged 22 commits into from
May 28, 2024
Merged

Addition of Vaisala resources #14

merged 22 commits into from
May 28, 2024

Conversation

rebeccahawke
Copy link
Contributor

Two equipment classes are included, for two types of barometer: PTU300 and PTB330.

docstrings now use reStructured Text.
set rstrip to True.
added TYPE_CHECKING for all class methods.
separated configure and read commands to allow different configurations for each channel.
multiple readings may be taken by read_channel (in which case the method returns a list of floats instead of a single float).
changed close_connection to instead modify the inherited disconnect method
docstrings improved for clarity and typographical, syntax and build errors fixed; simplified list iteration in example; unnecessary statements removed
and allowed each channel to be configured and read independently
read requires sending configuration of sense parameters immediately before or together with the read command. This fix somehow fixed the strange double read too.

Also added a second example for a milliK connected by ethernet.
 channels and readings are returned as separate lists
and created local variable for channels to ensure consistency of ordering
# Conflicts:
#	tests/resources/test_init.py
using a dictionary 'desired_units' of quantities and units
docs/resources.rst Show resolved Hide resolved
msl/equipment/resources/vaisala/ptb330.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptb330.py Show resolved Hide resolved
msl/equipment/resources/vaisala/ptb330.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
msl/examples/equipment/vaisala/ptb330.py Outdated Show resolved Hide resolved
removed log messages; adjusted behaviour of device_info, check_serial, and set_units; fixed docstring rendering; added default RS232 connection properties.
msl/equipment/resources/vaisala/ptb330.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptb330.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
* Pressure quantities: P, P3h, P1, P2, QNH, QFE, HCP, ...
* Pressure units: hPa, psi, inHg, torr, bar, mbar, mmHg, kPa, Pa, mmH2O, inH2O
* Temperature quantities: T, TP1, TP2, TP3, ...
* Temperature units: 'C, 'F, or K
Copy link
Contributor

Choose a reason for hiding this comment

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

In the PTU300 class, the leading ' (single quote) is not required for a temperature unit but here it is required. It may be useful to support C, F (no single quote) here for consistency with PTU300. Or always force the user to use a ' in both classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion. I've made some changes to catch incorrect unit setting for both classes.

msl/equipment/resources/vaisala/ptb330.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptb330.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
msl/equipment/resources/vaisala/ptu300.py Outdated Show resolved Hide resolved
typo fixes; simplified list representations; fixed errors in temperature unit setting; used Python unpacking feature; removed obsolete function return; changed PTU30* regex to specify supported models.
specified supported models for PTU300 class in docs. Added default RS232 connection info to class docstring.
Copy link
Contributor

@jborbely jborbely left a comment

Choose a reason for hiding this comment

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

Two comments (in addition to my nitpicky comment):

  1. the docstring for PTU300.get_format() does not render the backslash properly. Just make the dosctring a raw string (leading r), e.g., r"""Return the currently..."""
  2. rename the argument format to be fmt in PTU300.set_format() since it's best to avoid using builtin names when possible.

msl/equipment/resources/vaisala/ptb330.py Outdated Show resolved Hide resolved
fixed docstring rendering and typo
@jborbely jborbely merged commit 6ad831a into MSLNZ:main May 28, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants