Rework how sweep numbers are handled
Opened this issue · 1 comments
We have a couple of issues (#1754, #1235, #1193) which are there because we write into the labnotebook before we have acquired data. Recently we fixed reading these labnotebooks, #2097.
But we still create these problematic labnotebooks.
To summarize the issue: If we abort an analysis function in pre set/daq event and have already written a labnotebook entry for a future sweep number, and then acquire TP, the sweep numbers in the labnotebook are not ascending.
This problem stems from the fact that we only increase the sweep numbers, when we save sweep data after the sweep was acquired.
To solve this issue we (I've chatted with @MichaelHuth about this already) propose:
- Hand out a new sweep number before starting DAQ/TP. This needs to be done even before we call the pre daq event in DAP_CheckSettings.
- If the analysis function now aborts the sweep and we have already added labnotebook entries, we create a zero sized (i.e. no data) sweep wave and store that. This ensures that we always have sweep data for each sweep number in the labnotebook.
We probably introduce a per device currentSweep global variable. A RO variable getter will then replace most calls to DAG_GetNumericalValue(device, "SetVar_Sweep")/AFH_GetLastSweepAcquired.
Chatted with TJ about this and we think the approach of having "holes" instead of zero sized sweep waves should be preferred. This is more what the hardware did and also avoids issues with running analysis on empty sweeps.