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

nidaqmx playao from a NumpyDeviceBuffer stream #113

Open
zoeith opened this issue Jul 24, 2020 · 7 comments
Open

nidaqmx playao from a NumpyDeviceBuffer stream #113

zoeith opened this issue Jul 24, 2020 · 7 comments

Comments

@zoeith
Copy link

zoeith commented Jul 24, 2020

The ultimate goal here is to make a function/waveform generator. The example in ni_daqmx_with_oscilloscope using a QTimer seems a little inelegant given everything else happening with streams. Also, what would one do if the numpy array is bigger than the nidaq buffer? (using a USB-6001 device holds 2047 samples)

I guess, ideally the nidaq would request the next chunk from the NumpyDeviceBuffer whenever it's ready? Or the NumpyDeviceBuffer polls until the nidaq is ready for the next chunk (something to do with _on_ao_done). Happy to generate a PR down the line but could use some advice on moving this forward.

Unrelated note, I'm also working on making Harvesters work with pyacq.

@zoeith
Copy link
Author

zoeith commented Aug 18, 2020

This works for my purposes at the moment. Any thoughts before a PR? Tests?

@samuelgarcia
Copy link
Contributor

Dear Zoey.
Thanks for having interest in pyacq.

The Nidaq implementation in pyacq is totally weak for the output.
I did it quikly some time ago with a simple usecase :

  • stream input to file and oscilloscpe
  • play on output a simple (and short) waveform when the end user click on a button.

A stremable output could be done in this class. If you need it I can help you to make the change.

@zoeith
Copy link
Author

zoeith commented Aug 31, 2020

Hi Samuel,

Sorry for the delay! Help would be great!

Did you have a chance to look at the implementation I made already? I also changed npbufferdevice some as well to generate the signal. It seems to work pretty well (surprisingly).

I'll add the Harvesters camera node soon too.

Thanks!

@samuelgarcia
Copy link
Contributor

Hi Zoe.
Oups. I miss that already implement it.
I will have a look.
Very cool if it works for you.
pyacq have very few users : welcome.

@timmcarson
Copy link

@zoeith

Can you share an example like ni_daqmx_with_oscilloscope.py using your updated ni_daqmx.py

@zoeith
Copy link
Author

zoeith commented Aug 1, 2022

Uh... It's been a while and this evolved some. I pushed some changes to my fork.

This example has a bunch of extra junk and might not have been the final way I ended up using it, but with some fiddling you should be able to move everything in streams instead of using some weird callback.

Curious how this works out for you, no promises I can help much more. Good luck!

@timmcarson
Copy link

@zoeith,

Thanks for the help. I have been able to get working, mostly.

I am getting a buffer warning related to the sampling rate that I need to figure out but at least there is an output.

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

No branches or pull requests

3 participants