pico-python icon indicating copy to clipboard operation
pico-python copied to clipboard

streaming on 5000a

Open nanoballs opened this issue 8 years ago • 4 comments

HI i am quite new using picoscope with python... i cant find any streaming function.. As am trying to get a continous stream of data (some hours) from a channel at 16bit resolution and 5Ms/s i wold like not to have it in block mode but to be able to analize in real time. Has anyone something useful for it? thanks!!

nanoballs avatar Oct 12 '16 13:10 nanoballs

Hi, you might want to check out the "experiment" branch of the user morgatron. He implemented the streaming functionality and it seems to work fine on a P5444B. I'm not sure whether analyzing in real time and using a daq with a USB-interface go well together, tho.

DeadBugEngineering avatar Oct 12 '16 15:10 DeadBugEngineering

thanks! il have a look to it!

nanoballs avatar Oct 12 '16 17:10 nanoballs

Streaming was complicated because it required knowledge of how python's garbage collection works (at least I think so).

My worry was that you would set a buffer to stream to, then delete it. That would cause a segfault eventually. The other issue was: maybe you didn't want to use numpy. You would probably want to be super efficient if you are streaming data. Therefore, I decided to leave it to users to write the streaming code themselves.

If you find something that works, please submit a pull request. Collin and I do check this repo rather often.

hmaarrfk avatar Oct 21 '16 22:10 hmaarrfk

Oops, I just left a comment on issue #23 . Probably would've been better here. In short, I was running streaming and bulk data quite a lot a year or so ago, and based on that experience python makes it a bit harder to cause a segfault than you might think, and there's certainly ways to make it harder still. Not that my repository mentioned above is a great example.

A couple of other comments: as for not wanting to use numpy, I guess that's valid as not everyone has it installed- but then, if you're wanting do deal with large arrays in python you probably use numpy already? Otherwise I guess it'd probably work to use a builtin python 'array' object instead. As for speed, I found the major problem isn't the streaming itself, it's all the processing/visualising you inevitably want to do to which takes up CPU time and causes the streaming to skip. Ideally one runs the acquisition in a seperate process from the analysis/plotting and everything is good because the acquisition runs on it's own core.. I doubt one would want to add multiprocessing in picopython though.

morgatron avatar Jun 21 '17 02:06 morgatron