hbk-world / LAN-XI-Open-API-python-examples

Examples on how to use the LAN-XI OpenApi from python
1 stars 2 forks source link

Multi frame streaming #5

Open 1oly opened 3 years ago

1oly commented 3 years ago

Hello,

Thanks for making well-documented scripts - easy to get started!

I would like to record signals from several modules (PTP syncronized in a DAQ frame). I can follow streaming.py for a single module, but how would that look like for multiple modules?

1) Do I open recorder for all modules or just the master? response = requests.put(host + "/rest/rec/open") 2) Looping through the different hosts, I can get all channels and make the setup: response = requests.put(host + "/rest/rec/channels/input", json = setup) 3) But what about the socket and measurement?

response = requests.get(host + "/rest/rec/destination/socket")
response = requests.post(host + "/rest/rec/measurements")

I had a look in the PTP multiframe example for C#, but that's only for two frames and slightly difficult to translate into python.

Best regards, Oliver

1oly commented 3 years ago

Hi again,

I may have to read through the manual before asking questions (there is a section on the topic: 2.4.16 Commands for PTP synchronization). Will get back when I have tried those commands.

Troels51 commented 3 years ago

If you would like some another piece of documentation, we also have this page https://github.com/hbk-world/open-api-tutorials/blob/master/tutorials/streaming_multi_module.md It might be what you are looking for

1oly commented 1 year ago

Hello. The tutorial worked out great, thanks!

Another question: How do I set recorder duration, trigger conditions etc. for a recording? In the /rest/rec/channels/input/default setup, I can make changes to each module, but how do I control the frame?

In the tutorial, you control duration using Pythons time: https://github.com/hbk-world/open-api-tutorials/blob/03a9b3dc779bb005cebc20f63c5d5fdcafef16f6/src/streaming_multi_module.py#L200 but that can lead to recordings of different lengths (in my tests with a 12 channels input, I get sample lengths of +/- 4096 samples).