Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pymodaq_plugins_alcatel
pymodaq_plugins_pfeiffer
########################

Authors
=======

* Titouan Gadeyne (titouan.gadeyne@cea.fr)

* Titouan Gadeyne (titouan.gadeyne@cea.fr) for Alcatel driver
* Lucas Nicolas (lucas.nicolas@onera.fr) for OmniControl driver

Instruments
===========
Expand All @@ -16,12 +16,21 @@ Viewer0D
++++++++

* **ACM1000**: Alcatel ACM 1000 six-port gauge controller
* **OmniControl 200**: OmniControl 200 with pressure gauge connected (tested with PKR251)



Installation instructions
=========================
Installation instructions for Alcatel plugins
=============================================

* PyMoDAQ 4
* Windows 10
* No drivers from Alcatel are required.
* Your PC should have serial ports (COM ports) to connect the controller. On Windows 10 you may need to install a driver to create virtual COM ports.

Installation instructions for Pfeiffer plugins
==============================================

* PyMoDAQ 5.0.x or later
* May require a virtual COM port driver: https://ftdichip.com/drivers/

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ h5exporters = false # true if plugin contains custom h5 file exporters
scanners = false # true if plugin contains custom scan layout (daq_scan extensions)

[urls]
package-url = "https://github.com/Titouan-Gadeyne/pymodaq_plugins_alcatel"
package-url = "https://github.com/PyMoDAQ/pymodaq_plugins_pfeiffer"

[project]
name = "pymodaq_plugins_alcatel"
description = "PyMoDAQ plugin for the Alcatel ACM1000 6-port gauge controller."
name = "pymodaq_plugins_pfeiffer"
description = "PyMoDAQ plugin for the Pfeiffer/Alcatel instruments."
dependencies = [
"pymodaq>=5.3.2",
"pymodaq_utils>=5.3.1",
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions src/pymodaq_plugins_alcatel/daq_viewer_plugins/__init__.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/pymodaq_plugins_alcatel/resources/config_template.toml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from pymodaq_utils.utils import get_version, PackageNotFoundError
from pathlib import Path
from pymodaq.utils.logger import set_logger # to be imported by other modules.

from .utils import Config
config = Config()
from pymodaq_utils.utils import get_version, PackageNotFoundError
from pymodaq_utils.logger import set_logger, get_module_name

config = Config()
try:
__version__ = get_version(__package__)
except PackageNotFoundError:
__version__ = '0.0.0dev'



Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
importlib.import_module('.' + path.stem, __package__)
except Exception as e:
logger.warning("{:} plugin couldn't be loaded due to some missing packages or errors: {:}".format(path.stem, str(e)))
pass
pass

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pymodaq.utils.parameter import Parameter

import pylablib as pylablib
from pymodaq_plugins_alcatel.hardware.ACM1000_wrapper import ACM1000
from pymodaq_plugins_pfeiffer.hardware.ACM1000_wrapper import ACM1000


class DAQ_0DViewer_ACM1000(DAQ_Viewer_base):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import numpy as np

from pymodaq_utils.utils import ThreadCommand
from pymodaq_data.data import DataToExport
from pymodaq_gui.parameter import Parameter

from pymodaq.control_modules.viewer_utility_classes import DAQ_Viewer_base, comon_parameters, main
from pymodaq.utils.data import DataFromPlugins

from pymodaq_plugins_pfeiffer.hardware.omnicontrol import Omnicontrol
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."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

please use only english to make it usable by everyone

return [port.device for port in list_ports.comports()]

class DAQ_0DViewer_Pfeiffer_Omnicontrol(DAQ_Viewer_base):
""" Instrument plugin class for a OD viewer.
* Plugin for OmniControl 200 controller.
* Developed and tested only with a PKR 251 pressure gauge connected.
* Developed on PyMoDAQ 5.2
* May require a virtual COM port driver: https://ftdichip.com/drivers/

"""
params = comon_parameters+[
{'title': 'COM port :', 'name': 'com_port', 'type': 'list', 'limits': get_com_ports()},
{'title': 'Channel 1', 'name': 'ch_1', 'type': 'bool', 'value':True},
{'title': 'Channel 2', 'name': 'ch_2', 'type': 'bool', 'value':True},
]

def _active_channels(self):
"""Names of the currently checked channel booleans, in tree order."""
return [ch.name()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you should group your channels in a dedicated group in the settings

for ch in self.settings.children()
if ch.name().startswith('ch_') and ch.value()]


def ini_attributes(self):
self.controller: Omnicontrol = None
self.port=None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

don't nee an extra variable to store the COM port, it is already stored in the settings!

pass

def ini_detector(self, controller=None):
"""Detector communication initialization"""
self.settings.child('com_port').setLimits(get_com_ports())
if self.is_master:
self.port=self.settings.child('com_port').value()
self.port="COM9"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

hardcoded here?????????????, use the config if you want to store a default value

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

and place the default value in the "value" key of the com_port parameter

self.controller = Omnicontrol(self.port)
initialized = True
else:
self.controller = controller
initialized = True

self.pressure_data=[np.array([0]) for ch in self._active_channels()]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

use np.atleast_1d to make sure you always have at least a numpy array

label=[]
for ch in self._active_channels():
if ch == 'ch_1':
label.append('Channel 1')
elif ch == 'ch_2':
label.append('Channel 2')
self.dte_signal_temp.emit(DataToExport(name='OmniControl',
data=[DataFromPlugins(name='Pressure',
data=self.pressure_data,
dim='Data0D',
labels=label)]))
# labels = ['Channel 1', 'Channel 2'])]))

info = self.controller.read_name() # lève PfeifferError si pas de réponse

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

comments in english

return info, initialized

def close(self):
"""Terminate the communication protocol"""
if self.is_master and self.controller is not None:
self.controller.close()
self.controller = None

def grab_data(self, Naverage=1, **kwargs):
"""Start a grab from the detector

Parameters
----------
Naverage: int
Number of hardware averaging (if hardware averaging is possible, self.hardware_averaging should be set to
True in class preamble and you should code this implementation)
kwargs: dict
others optionals arguments
"""
pressure_data=[]
try:
for ch in self._active_channels():
if ch == 'ch_1':
pressure_data.append(np.array([self.controller.read_pressure(122)]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

122 and 132 ?? You should assign a variable name to store those at the top of your script:

CHANNEL1 = 122
CHANNEL2 = 132

elif ch == 'ch_2':
pressure_data.append(np.array([self.controller.read_pressure(132)]))
except Exception as e:
self.emit_status(ThreadCommand('Update_Status', [str(e), 'log']))
return

label=[]
for ch in self._active_channels():
if ch == 'ch_1':
label.append('Channel 1')
elif ch == 'ch_2':
label.append('Channel 2')

self.dte_signal.emit(DataToExport(
name='OmniControl',
data=[DataFromPlugins(name='Pressure',
data=pressure_data,
dim='Data0D',
labels=label)]))

def stop(self):
"""Stop the current grab hardware wise if necessary"""
return ''

def commit_settings(self, param: Parameter):
"""Apply the consequences of a change of value in the detector settings

Parameters
----------
param: Parameter
A given parameter (within detector_settings) whose value has been changed by the user
"""
## TODO for your custom plugin
if param.name() == "com_port":

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

could remove this if you just use the com port value stored in the settings

self.port=self.settings.child('com_port').value()


if __name__ == '__main__':
main(__file__)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import importlib
from pathlib import Path
from ... import set_logger
from pymodaq_utils.logger import set_logger

logger = set_logger('viewer1D_plugins', add_to_console=False)

for path in Path(__file__).parent.iterdir():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import importlib
from pathlib import Path
from ... import set_logger
from pymodaq_utils.logger import set_logger
logger = set_logger('viewer2D_plugins', add_to_console=False)

for path in Path(__file__).parent.iterdir():
Expand All @@ -9,4 +9,4 @@
importlib.import_module('.' + path.stem, __package__)
except Exception as e:
logger.warning("{:} plugin couldn't be loaded due to some missing packages or errors: {:}".format(path.stem, str(e)))
pass
pass
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import importlib
from pathlib import Path
from ... import set_logger
from pymodaq_utils.logger import set_logger
logger = set_logger('viewerND_plugins', add_to_console=False)

for path in Path(__file__).parent.iterdir():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Created the 01/06/2023

@author: Sebastien Weber
"""
"""
Empty file.
Loading
Loading