Repository navigation
Initial commit for OmniControl 200 - #3
LNicolasOnera wants to merge 6 commits into
Conversation
|
Previous plugin included the following folder only: pymodaq_plugins_pfeiffer\src\pymodaq_plugins_alcatel |
| from serial.tools import list_ports | ||
|
|
||
| def get_com_ports() -> list[str]: | ||
| """Détecte les ports COM connectés et les renvoie sous forme de liste de strings.""" |
There was a problem hiding this comment.
please use only english to make it usable by everyone
|
|
||
| def _active_channels(self): | ||
| """Names of the currently checked channel booleans, in tree order.""" | ||
| return [ch.name() |
There was a problem hiding this comment.
you should group your channels in a dedicated group in the settings
|
|
||
| def ini_attributes(self): | ||
| self.controller: Omnicontrol = None | ||
| self.port=None |
There was a problem hiding this comment.
don't nee an extra variable to store the COM port, it is already stored in the settings!
| self.settings.child('com_port').setLimits(get_com_ports()) | ||
| if self.is_master: | ||
| self.port=self.settings.child('com_port').value() | ||
| self.port="COM9" |
There was a problem hiding this comment.
hardcoded here?????????????, use the config if you want to store a default value
There was a problem hiding this comment.
and place the default value in the "value" key of the com_port parameter
| labels=label)])) | ||
| # labels = ['Channel 1', 'Channel 2'])])) | ||
|
|
||
| info = self.controller.read_name() # lève PfeifferError si pas de réponse |
| self.controller = controller | ||
| initialized = True | ||
|
|
||
| self.pressure_data=[np.array([0]) for ch in self._active_channels()] |
There was a problem hiding this comment.
use np.atleast_1d to make sure you always have at least a numpy array
| try: | ||
| for ch in self._active_channels(): | ||
| if ch == 'ch_1': | ||
| pressure_data.append(np.array([self.controller.read_pressure(122)])) |
There was a problem hiding this comment.
122 and 132 ?? You should assign a variable name to store those at the top of your script:
CHANNEL1 = 122
CHANNEL2 = 132
| A given parameter (within detector_settings) whose value has been changed by the user | ||
| """ | ||
| ## TODO for your custom plugin | ||
| if param.name() == "com_port": |
There was a problem hiding this comment.
could remove this if you just use the com port value stored in the settings
No description provided.