Skip to content

Conversation

@Soungai00
Copy link
Contributor

Plugin updated with NIDAQmx viewer based on NIDAQmx python wrapper.

For this first release with NI, Analog Input are coded and working with cDAQ & NI-USB devices.
Measurements available are current, voltages and temperatures:

  • voltages tested & working with cDAQ-9174 and NI-9205 module
  • temperatures tested and working with Thermocouples sensors plugged on NI-9211 module (still on cDAQ-9174)

.toml config files are used to get the configuration of the manip and scalable group parameter are created during init_detector to get the configurated analog inputs

Copy link
Contributor

@loicguilmard loicguilmard left a comment

Choose a reason for hiding this comment

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

aren't those supposed to be DAQmx_legacy now ?

self.level = level


class Channel:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The Channel object exists also in the nidaqmx library (see doc here), with many child classes (AIChannel, AOChannel, etc.) just like we do. Shouldn't we rather use these?
I am not fully sure, as the nidaqmx objects require a task during initialization, we might need to rewrite a lot of code, but this would seem better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After investigation it seems convenient to keep our channels. As you said the nidaqmx channel object require a task, and it doesn't really match the use of the param tree or the config files + modifying and deleting channels properly in a whole global task could easily become a mess so closing a task and opening a new one remains a clean way for update_task.

def __init__(self, **kwargs):
super().__init__(**kwargs)


Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should specifiy somewhere that the DigitalChannels are not fully implemented and not tested yet.

self.channels = None
self.clock_settings = None
self.trigger_settings = None
self.live = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Where is self.controller initialized? Which object is it supposed to be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

self.controller is a DAQmx object (btw I'm renaming it NIDAQmx) which is supposed to be initialized either in the init_detector of the daq_NIDAQmx_Viewer.py for a detector or in the ini_stage of daq_NIDAQmx_Move.py for an actuator

else:
self.controller = controller
else:
self.controller = 'A Nidaqmx task'
Copy link
Collaborator

Choose a reason for hiding this comment

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

The controller should probably not be a string here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since I didn't implement it but only made a copy paste of the current one, i'm removing this file to be sure only working things are released.

Copy link
Collaborator

@aurore-finco aurore-finco left a comment

Choose a reason for hiding this comment

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

So only the DAQ_viewer 0D has been tested with the new nidaqmx version? I think that the DAQ_Move might not work at the moment.

@loicguilmard
Copy link
Contributor

@seb5g I think we all agree now. If you're ok with the result, would you accept this PR ?
Basically, we cleaned up all the useless extra object using nidaq lib and tested the analog input while keeping the compatibility for previous users. We (with aurore team and jeremy) plan on having another PR/release for the counter and nidaq actuator module.

May be you want to test it against your system ?
May be it need a git tag to trigger the build ? not sure how you manage those.

@@ -0,0 +1,10 @@
from pathlib import Path
from hatchling.metadata.plugin.interface import MetadataHookInterface
from pymodaq_utils.resources.hatch_build_plugins import update_metadata_from_toml
Copy link
Contributor

Choose a reason for hiding this comment

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

If one use pyproject and hatch then one has to add pymodaq_utils in the project requirements. As only including pymodaq 4 will not require pymodaq_utils

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is already in the pyproject.toml in the following section:

[build-system]
requires = [
    "hatchling>=1.9.0",
    "hatch-vcs", "toml",
    "pymodaq_utils>=0.0.6",
]

Do you mean adding it in the dependencies of the project section such as below ?

dependencies = [
    "pymodaq>=4.4",
    "pydaqmx",
    "nidaqmx",
    "aenum",
    "pymodaq_utils"
]

Copy link
Contributor

Choose a reason for hiding this comment

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

non you're right it is a build requirement... sorry

@seb5g
Copy link
Contributor

seb5g commented Jan 29, 2025

@seb5g I think we all agree now. If you're ok with the result, would you accept this PR ? Basically, we cleaned up all the useless extra object using nidaq lib and tested the analog input while keeping the compatibility for previous users. We (with aurore team and jeremy) plan on having another PR/release for the counter and nidaq actuator module.

May be you want to test it against your system ? May be it need a git tag to trigger the build ? not sure how you manage those.

I saw one thing to modify in my quick review. I will accept the PR and then test on my stuff. I'll do other PR if need be.

@seb5g seb5g merged commit 74e8ef0 into PyMoDAQ:main Jan 29, 2025
1 check passed
@seb5g
Copy link
Contributor

seb5g commented Jan 29, 2025

Hi there, version 1.0.0 using nidaqmx is online! Good job to everyone @Soungai00 @jerlfan @loicguilmard @aurore-finco and all other I may not know about ;-)

@Soungai00 Soungai00 deleted the nidaq_cethil_multimodule branch January 30, 2025 09:01
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.

5 participants