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

DM-45744 Implement ATBuilding CSC +790-148 #3

Merged
merged 15 commits into from
Aug 23, 2024
Merged

Conversation

bbrondel
Copy link
Contributor

No description provided.

@bbrondel bbrondel requested review from rbovill and couger01 August 20, 2024 19:13
@bbrondel bbrondel marked this pull request as ready for review August 20, 2024 19:30
@bbrondel bbrondel requested a review from tribeiro August 20, 2024 22:07
Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

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

Here is an initial round of comments.

General comment:

Please, document all the assertion Errors that can happen with the inclusion assert self.connected.

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 commit the .pre-commit-config.yaml file. This should be generated by generate_pre_commit_conf from ts-pre-commit-config package.

from .dispatcher import Dispatcher

__all__ = ["__version__", "Config", "Controller", "Dispatcher"]
Copy link
Member

Choose a reason for hiding this comment

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

We usually don't have this __all__`` definition here in the init` file.

@@ -22,33 +22,49 @@
import logging
from enum import IntEnum

import megaind
try:
import megaind
Copy link
Member

Choose a reason for hiding this comment

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

I missed the inclusion of this package dependency. I don't think this is part of our stack. Do you really need it?

Usually, adding new package dependencies require approval by myself and/or Wouter. We should discuss this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's necessary as a part of the hardware controlling the vents - the Sequent Microsystems Industrial Automation Hat.


__all__ = ["Controller"]
__all__ = ["Controller", "VentGateState"]


class VentGateState(IntEnum):
Copy link
Member

Choose a reason for hiding this comment

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

Should this be in ts-xml?

FAULT = -1


class FanDriveState(IntEnum):
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be in ts-xml?

raise ModuleNotFoundError("The megaind module is not available.")
return megaind.getOptoCh(*args, **kwargs)

def setOd(self, *args, **kwargs) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Methods should be snake_case but, same as above, we need to talk about the use of megaind.

return value.lower() in ("true", "t", "1")
if value.lower() in ("true", "t", "1"):
return True
if value.lower() in ("false", "f", "0"):
Copy link
Member

Choose a reason for hiding this comment

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

should this be elif instead?

return True
if value.lower() in ("false", "f", "0"):
return False
raise ValueError(f"Expected bool value but got {value}")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe document what are the valid values for conversion to bool?

python/lsst/ts/vent/controller/dispatcher.py Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Consider renaming this dome_vents_simulator.py

Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

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

Forgot to mark "request changes"

Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

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

I have a few additional comments I hope you will take into account but otherwise this looks good! thanks for the updates!

async def get_drive_state(self) -> FanDriveState:
"""Returns the current fan drive state based on the contents
of the IPAE register.

Copy link
Member

Choose a reason for hiding this comment

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

Please use the numpy docs style.

This should be something like:

Returns
--------
`FanDriveState`
    Current fan drive state.

You don't need to document all the values as that should be in the enumeration.

def get_opto_ch(self, *args, **kwargs) -> int:
"""Calls hardware I/O or a simulated substitute depending
whether the class was instantiated with simulate = True.

Copy link
Member

Choose a reason for hiding this comment

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

Please, document input arguments and return values (use numpy docs style).

def set_od(self, *args, **kwargs) -> None:
"""Calls harware I/O or a simulated substitute depending
whether the class was instantiated with simulate = True.

Copy link
Member

Choose a reason for hiding this comment

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

Please, document input args.

@@ -27,7 +49,15 @@ def _cast_string_to_type(new_type: type, value: str):
"""
Copy link
Member

Choose a reason for hiding this comment

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

Please document return value

@bbrondel bbrondel merged commit 1f5d655 into develop Aug 23, 2024
2 checks passed
@bbrondel bbrondel deleted the tickets/DM-45744 branch August 23, 2024 16:13
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.

2 participants