-
Notifications
You must be signed in to change notification settings - Fork 9
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
PSQ_DAScale: Add adaptive suprathreshold #1894
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
621cccb
to
735c407
Compare
7ef683d
to
b6a6ea8
Compare
ae1a136
to
3c3026b
Compare
2c62a50
to
7082022
Compare
7082022
to
e305464
Compare
d7d7a08
to
0d40569
Compare
1 task
61985d6
to
e1aaa8d
Compare
fd3d604
to
337a10c
Compare
59ae1d4
to
b90586f
Compare
b90586f
to
9b53f19
Compare
This comment was marked as outdated.
This comment was marked as outdated.
9b53f19
to
2adc777
Compare
8aaa9ad
to
d44d76e
Compare
And ready again. |
e7d0d6b
to
9425358
Compare
And ready! |
1 similar comment
And ready! |
…mode of PSQ_DAScale
… adaptive suprathreshold The old algorithm worked but selected too many measurement points. The new algorithm skips "too close" measurements, the closeness can be tweaked by the user with the new optional analysis function parameters: - AbsFrequencyMinDistance - AbsDAScaleMinDistance - AbsDAScaleMaxDistance
Requested change by Tim Jarsky.
- Also require passing rheobase sweeps and use them in addition to the supra sweeps for the initial f-I fits - Add NumSweepsWithSaturation analysis parameters, defaulting to 2, which requires this many passing sweeps with f-I slope QC passing to avoid noise issues - Remove AbsDAScaleStepMax/AbsDAScaleStepMin analysis parameters and derive normalized DAScale step widths from MaxFrequencyChangePercent and the initial f-I data. The maximum step width is DaScaleStepWidthMinMaxRatio, defaulting to 3, larger than the calculated minimum one. - Fix invalid slope detection, we now only consider a slope of NaN, which you get for a vertical line as invalid - Adapt tests
We need the same size as baselineQC/asyncQC as these are each SCI.
…_SWEEP_EVENT usage In PRE_SET_EVENT we fit the rheobase and supra data. For that we take the starting point of the E1 epoch of the data but use the adaptive supra E1 epoch length. For POST_SWEEP_EVENT we just want to take the E1 epoch length. This fixes that the assertion adaptiveEpochLength <= supraEpochLength was triggered for prematurely stopped adaptive supra sweeps when evaluated in POST_SWEEP_EVENT.
…ncy with failing baseline QC This does not make sense. And also prevents very large frequencies when stopping after chunk 0 as an early stop makes epoch E1 shorter and therefore the frequency higher.
9425358
to
b5300a3
Compare
timjarsky
approved these changes
May 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Close #1532.
Move code from PRE_SET_EVENT to POST_SWEEP_EVENT as we don't yet have epoch info for PSQ_DS_GatherFrequencyCurrentDataTodo List from testing on live neuron 2024/02/29:
Investigate why "dascales left"/"f-I slopes" in the textual LBN looks like single FP data. Partial explanation: The DAScale values ("Stim Scale Factor") read from the supra sweeps' LBN already have the looks-like-SP property, e.g "119.9999988529321"seems to be by-design supra usesspikeFrequencies[] = str2num(FloatWithMinSigDigits(spikeCount[p] / (pulseDuration[p] * MILLI_TO_ONE), numMinSignDigits = 2))
Original todo list
Thirty six hints for writing analysis functions
Create an issue with the description of the new analysis function.
Also define its name and two letter abbreviation (which must not collide with existing ones).
Always track any open items in task lists in the issue or the PR itself.
Think about what should happen at each event. As a rule of thumb we want
to do only what is really needed in
MID_SWEEP_EVENT
(if that is used atall). The common QC entries are determined in the following events:
POST_SWEEP_EVENT
POST_SET_EVENT
MID_SWEEP_EVENT
/POST_SWEEP_EVENT
.Create a list of used labnotebook keys. The question which labnotebook keys
are required can be answered by thinking about how the dashboard will interpret
the analysis function run results. Only if it can decide, by looking at
labnotebook entries, for each possible outcome exactly why the run failed, all
labnotebook keys were thought of.
Create a list of used user epochs. User epochs are there to define
interesting stimset x-ranges for the analysis function. This should be used
preferrably over other similiar approaches.
Create a list of analysis function parameters including required/optional
state and for the latter also the default values.
Units for labnotebook keys should be added if possible. For physical units we
tend to prefer base units without prefix, i.e. Ω instead of GΩ.
Decide if the new labnotebook entries should be headstage dependent or not.
The existing entries don't do a very good job in guiding you here. An
ideal choice is that the
DEPEND
/INDEP
type of a entry would nothave to be changed if the analysis function would need to support more or
fewer headstages.
Make a list of additional features and/or changes in common
PSQ_
/MSQ_
functions youneed.
Draw a preliminary flowchart, on paper is fine. This serves as a way to think the behaviour through.
Have a look at existing flowcharts for inspiration.
Create a stimulus set for testing. The test stimsets can be loaded via
LoadStimsets
and saved viaSaveStimsets
available inHardwareTests.pxp.
At this point you should have a pretty good idea what needs to be done.
Discuss what you think you need to do with your boss.
Add a skeleton analysis function, see
here <https://alleninstitute.github.io/MIES/file/_m_i_e_s___analysis_functions_8ipf.html>
__,and add all analysis parameters, their help messages and check code.
Add documentation for labnotebook keys and user epochs to the tables at the
top of
MIES_AnalysisFunctions_PatchSeq.ipf
/MIES_AnalysisFunctions_MultiPatchSeq.ipf
Implement the test override entries in
:cpp:func:
PSQ_CreateOverrideResults
/:cpp:func:MSQ_CreateOverrideResults
withdocumentation.
Implement the behaviour for each event. Going from easy to difficult has proven to work.
Now you should have a first version. Congratulation! Pad yourself on the
back and take a break, because now the real fun starts.
Add preliminary dashboard support. We do check for every testcase that
the dashboard works.
Create a new test suite and add it to
UTF_HardwareAnalysisFunctions.ipf
. Be sure tobase it on the test suite of the last added analysis function to avoid copying
deprecated approaches.
Add a first test case were all test override entries result in failed QC.
As rule of thumb what to check in each test case; be sure to have test
assertions for all added labnotebook entries (except standard baseline
entries) and position checking of user epochs.
Make that first test case pass, this takes a surprisingly long time. The
function :cpp:func:
LBV_PlotAllAnalysisFunctionLBNKeys
helps for debugging.After this first test case passes, reassess the test assertions. Are you testing enough or too much?
Writeup a test matrix for determining what needs to be
tested, first version in paper is fine. The columns are the inputs,
usually these are test overrides and analysis parameters.
See
UTF_PatchSeqSealEvaluation.ipf
for an example.We always have the following three test cases:
Sampling Interval QC
) failing.Sampling Interval QC
failing.Implement all test cases, fixing bugs in the analysis function on the way.
Run all tests for this analysis function with instrumentation.
Check the coverage output to see if you still have relevant gaps in testing.
Add new test cases for filling coverage gaps.
Repeat the last three points until the coverage is good enough.
Check if some helper code etc. can/should be fleshed out into its own pull request.
Be sure to include documentation and tests if your analysis function
publishes ZeroMQ messages. See
CheckPipetteInBathPublishing
and:cpp:func:
PSQ_PB_Publish
for an example. Add it also inCheckPublishedMessage
.Tell your boss to test the current state.
Check and fill any gaps in the documentation:
Create digital versions of the test matrix and the flowchart. For the
latter see
here <https://github.com/AllenInstitute/MIES/tree/main/Packages/doc/dot#readme>
__.Cleanup commits
Your done!