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

No timeout when acquisition card bugs #44

Open
lcontami opened this issue Mar 28, 2018 · 9 comments
Open

No timeout when acquisition card bugs #44

lcontami opened this issue Mar 28, 2018 · 9 comments

Comments

@lcontami
Copy link
Member

lcontami commented Mar 28, 2018

For example when you forget to turn on the modulation signal, the card can't demodulate (simply can't even trigger) but the program just stays stuck without returning an error or timeout at some point.

@MatthieuDartiailh
Copy link
Member

Indeed this does not appear to be supported at the moment. I believe the best would be to have a timeout before acquisition starts (after it can last as long as necessary). Help welcome.

@lcontami
Copy link
Member Author

Sometimes the card also seem to bug in the middle of the measurement at one point (for no reason that I can see), and never returns an error.
I will try to understand what is happening tomorrow to see which correction could fix that.

@lcontami
Copy link
Member Author

the driver should also catch memory overflow and raise an error. It looks like it does not for now

https://spdevices.com/images/stories/user_guides/14-1351_ADQAPI_Reference_Guide.pdf references a GetStreamOverflow method.

It would additionnaly be nice to add in the driver the trigger limit (it is at .5V per default, I think this information could be written in the driver, what do you think ?)

@lcontami lcontami self-assigned this Mar 29, 2018
@MatthieuDartiailh
Copy link
Member

I believe both changes would be reasonable. The question would be when to check for Overflow we do not want to do that too often.

@Billthered
Copy link

Billthered commented Jun 18, 2020

Sometimes the card also seem to bug in the middle of the measurement at one point (for no reason that I can see), and never returns an error.
I will try to understand what is happening tomorrow to see which correction could fix that.

A likely related issue occurs occasionally in the middle of measurements during DemodSPTask with ADQ14. Observed it when using 'avg_before_demod'.

Traceback:

>   File "C:\Users\hqc\.conda\envs\exopy\lib\site-packages\exopy\tasks\tasks\decorators.py", line 86, in decorator
    return function_to_decorate(*args, **kwargs)
  File "c:\users\hqc\documents\tino\exopy_hqc_legacy\exopy_hqc_legacy\tasks\tasks\instr\spdev_tasks.py", line 200, in perform
    freq, cosin, sinus, ch1_i, ch1_q = treat_channel_data(1)
  File "c:\users\hqc\documents\tino\exopy_hqc_legacy\exopy_hqc_legacy\tasks\tasks\instr\spdev_tasks.py", line 188, in treat_channel_data
    ch_i_av = 2*np.mean(ch*cosin)
ValueError: operands could not be broadcast together with shapes (50000,500) (50000,) 

It seems that for some reason, either the acquisition card does not work properly (this occurs randomly) or resizing does not work in driver.get_traces. Then the array of traces that is returned is not of good dimensions (should be 2 in 'avg_before_demod' with 2 channels, dim1 ->channels, dim2 -> samples). After the call to driver.get_traces in perform of spdev_tasks.py, during treat_channel_data(.), an error occurs line 188
ch_i_av = 2*np.mean(ch*cosin)
for example

ValueError: operands could not be broadcast together with shapes (50000,500) (50000,)

where here 50000 was the number of traces and 500 the number of samples. The shape of cosin, given by nsamples defined line 172
nsamples = np.shape(ch)[0]

looks wrong. Indeed in 'avg_before_demod' ch should be dimension 1, but seems to be 2 here.
I believe that treat_channel_data(index) works fine but driver.get_traces has the unexpected behavior of returning a larger array.

I could not see what is causing the issue of size. Any idea? Or would it be acceptable to add a check on the size of the returned array ?

@MatthieuDartiailh
Copy link
Member

@Billthered Could you share a typical configuration file exhibiting this issue ? I will try to have a look this week-end or next week.

@MatthieuDartiailh
Copy link
Member

The issue comes from https://github.com/Exopy/exopy_hqc_legacy/blob/master/exopy_hqc_legacy/instruments/drivers/dll/sp_adq14.py#L250
After a failure, we retry once but we do not pass the value of average which defaults to False hence the issue. Passing the average value would help. Making retry a counter rather than a bool may also make sense to allow than one retry. Please confirm that the fix in #68 address the issue and I will merge.

@Billthered
Copy link

Great ! As this occurs occasionally only (likely one out of 1.000.000 calls) I guess the best is to start a long measurement over the WE and see whether this happens again, I will be able to tell very soon! Thanks a lot @MatthieuDartiailh !

@Billthered
Copy link

No fail over 10 billion traces over the WE. It seems fine and can be merged !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants