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

Adaptive Supra enhancements #2123

Merged
merged 47 commits into from
Aug 6, 2024

Conversation

t-b
Copy link
Collaborator

@t-b t-b commented May 22, 2024

  • PSQ_DAScale: Add adaptive suprathreshold #1894
  • Reuse f-I data from previous failing adaptive SCIs
  • Flowchart
  • Raise LBN version and supra version
  • Needs Use desired titles for sweepbrowser/databrowser #2100 so that the automation browser mode works properly again
  • Restrict survey plot to passing sweeps
  • Fix bug where APFrequency/DAScale values were duplicated, this could be a generic issue which will be fixed in Tests: Ensure that the CDF is empty after the test case #2153
  • Constant f-I data in RhSuAd currently asserts out, add optional parameter, with 1.5 as default, as a factor to the input DAScale range of the data to calculate the minimum DAScale width.
  • Remove NumPointsForLineFit and always take the last two points which have a different AP frequency.
  • Make adaptive tests pass for every commit
  • We want NumSweepsWithSaturation to look at RhSuAd and SCI slopes, currently we only look at SCI slopes
  • Test for 21767c54 (PSQ_DS_AdaptiveIsFinished: Fix requirement for multiple f-I slope QC matches, 2024-07-16)
  • Resolve TODOs/FIXME
  • Commit cleanup
  • Missing tests
PSQ_DS_AdaptiveIsFinished:

46 2925	 if(!WaveExists(sweepPassed) || DimSize(sweepPassed, ROWS) < numSweepsWithSaturation)
0  2926	   return 0
46 2927	endif

PSQ_DAScale

16 3864 if(ret)
0  3865    printf "Could not calculate DAScale step widths min/max.\r"
0  3866    ControlWindowToFront()
0  3867    return 1
16 3868 endif

14  3904 if(!WaveExists(futureDAScales))
11  3905   if(PSQ_DS_AdaptiveIsFinished(device, s.sweepNo, s.headstage, numSweepsWithSaturation, fromRhSuAd = 1))
0  3906     PSQ_ForceSetEvent(device, s.headstage)
0  3907     RA_SkipSweeps(device, Inf, SWEEP_SKIP_AUTO, limitToSetBorder = 1)
0  3908  
0  3909     WAVE/ZZ DAScales
0  3910     break
11  3911   endif
14  3912 endif
  • Q: Discuss with Tim: We currently determine passing f-I slope for each sweep after the sweep. But it could be the case that the maximum slope changes after deciding that we passed. Do we need to revise our earlier decision?
    A: No revision, but our method to determine the sweeps with saturation should change. We only want to consider sweeps with passing f-I slope and passing sweep QC which have a larger DAScale value than the maxSlope sleep.
  • It should be the case that we always have both sweeps passing for the f-I slope. Check that and assert out otherwise
  • Q: Check what happens when we have the same DAScale values for a f-I slope fit. A: Don't start the measurement if we only have constant DAScale data in RhSuAd (testcase : PS_DS_AD8). If this happens in the adaptive suprathreshold run this is equivalent to a NaN f-I slope/offset and we just try again. This is also covered in a test.
  • Check that we display/test the dashboard messages in CI
  • Fix the fail messages to mention how many f-I slope QC sweeps we were expecting vs being present. Show them in one line as they need to be consecutively (with ignoring failed sweeps).
  • Survey plot: Use DAscale as x-axis for f-I slope data (lower plot)

Requires:

Close #2119
Close #2129
Close #2130
Close #2141
Close #2131

@t-b t-b self-assigned this May 22, 2024
@t-b t-b changed the title PSQ_DaScale: Add new operation mode Adaptive Suprathreshold Reuse f-I data from previous failing adaptive SCIs May 22, 2024
@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch from 21741f8 to 85030ef Compare May 24, 2024 11:13
@t-b t-b changed the title Reuse f-I data from previous failing adaptive SCIs Adaptive Supra enhancements Jun 13, 2024
@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch from 85030ef to c216078 Compare June 14, 2024 13:46
@t-b t-b mentioned this pull request Jun 17, 2024
3 tasks
@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch from c216078 to 3394779 Compare June 19, 2024 20:31
@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch 3 times, most recently from 558c93d to 71c7091 Compare July 10, 2024 18:45
@t-b t-b assigned timjarsky and unassigned t-b Jul 10, 2024
@t-b t-b marked this pull request as ready for review July 10, 2024 18:48
@t-b t-b requested a review from timjarsky as a code owner July 10, 2024 18:48
@t-b
Copy link
Collaborator Author

t-b commented Jul 10, 2024

@timjarsky Ready for a first test.

@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch 6 times, most recently from 0873c5e to 07a83bc Compare July 16, 2024 16:18
@t-b t-b assigned t-b and unassigned timjarsky Jul 16, 2024
@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch 2 times, most recently from aa30210 to 4035595 Compare July 19, 2024 18:01
@t-b t-b requested a review from MichaelHuth as a code owner July 19, 2024 18:01
@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch 4 times, most recently from 9715991 to 8c403a7 Compare July 26, 2024 19:55
t-b added 23 commits August 3, 2024 22:10
We can't trigger a situation where the total fit over all f-I/DaScale
values fails but the fit for PSQ_DA_NUM_POINTS_LINE_FIT points passes in
PSQ_DS_FitFrequencyCurrentData.
…verride active

This catches test setup errors earlier and with a better error message.
Now that we also consider RhSuAdd sweeps for set QC, it does not make
sense to enfore that NumSweepsWithSaturation is smaller than the sweeps in
the stimset.
We now use the previous acquired (RhSuAd) sweeps for judging if we have enough
passing sweeps with f-I slope QC. For this we need to store the list of passing
RhSuAd sweeps together with their f-I slope QC status.

Calculating the f-I slope QC for these sweeps posed the problem that we have to
distinguish sweeps which are left to the maximum slope (usually smaller but not
passing) to the ones to the right. We now take that into account in
PSQ_DS_CalculateReachedFinalSlope.

This made it also required to keep f-I slope values which stem from duplicated
apfreq values. These are now added with the value -inf (PSQ_DS_SKIPPED_FI_SLOPE).

These changes now can create the situation that we start a adaptive
suprathreshold measurement but due to previous RhSuAd sweep already passing
enough for our numSweepsWithSaturation we just repeat the last DAScale value
and are done.

The function PSQ_DS_GetLabnotebookData does all the heavy lifting for getting
the desired labnotebook values for the RhSuAd data and the current SCI.
It now does not filter out NaN values and also allows to filter out data
values like f-I slope which is calculated for two sweeps.
Since we now also look at RhSuAd sweeps we always have at least one sweep
passing so the wave is never null.
The condition for a passing f-I slope should actually compare the DAScale
values instead of the indizes.
… well

This is a defense-in-depth check as fitSlope can never be smaller than
NaN, but it expresses the intent better.
We can nowadays use a configuration option to achieve it, so let's just
prefer that.
For PSQ_DAScale Adaptive Suprathreshold it can be the case that all sweeps
pass but as we don't have enough fI slope QC passes the set still fails.

Take that into account by returning an empty string when all sweeps pass.
This has the complication that we need to remove one point from the
DAScale array as the slope is always between two values.

Also CheckSurveyPlot needs to be revised as the plots now can not be
distinguished anymore by the number of traces.
We need to take NumSweepsWithSaturation into account. We also make the
fail message easier to grasp with not mentioning the exact slope
percentages. And while at it we also reorder the messages to complain
about not reaching futureDASCale at the end as this error is quite common.
@t-b t-b force-pushed the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch from e0f0d38 to e6bf6b0 Compare August 3, 2024 20:10
@t-b
Copy link
Collaborator Author

t-b commented Aug 3, 2024

@timjarsky I've rebased against main so that #2213 is included here. Would be good to update the rig computer with the version from the latest CI.

@t-b t-b enabled auto-merge August 5, 2024 19:14
@t-b t-b merged commit 1a0233d into main Aug 6, 2024
24 checks passed
@t-b t-b deleted the feature/2123-dascale-adaptive-supra-threshold-reuse-fi-data branch August 6, 2024 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants