AllenInstitute / AllenInstitute/MIES
Rework setting setEventFlag
Nobody has claimed this yet.
- Dominant language
- IGOR Pro
- Stars
- 30
- Forks
- 11
- Avg merge
- 1d 40m
- Merged PRs (30d)
- 8
Description
Our current approach for setting the pre and post event fire flags is pretty dump. It immediately breaks down when skipping sweeps. The biggest problem is that we decide before doing things which events should be fired.
$ git grep setEventFlag
MIES_AnalysisFunctionManagement.ipf: WAVE setEventFlag = GetSetEventFlag(panelTitle)
MIES_AnalysisFunctionManagement.ipf: if((eventType == PRE_SET_EVENT && !setEventFlag[DAC][%PRE_SET_EVENT]) \
MIES_AnalysisFunctionManagement.ipf: || (eventType == POST_SET_EVENT && !setEventFlag[DAC][%POST_SET_EVENT]))
MIES_AnalysisFunctions_MultiPatchSeq.ipf: WAVE setEventFlag = GetSetEventFlag(panelTitle)
MIES_AnalysisFunctions_MultiPatchSeq.ipf: setEventFlag[DAC][%PRE_SET_EVENT] = 1
MIES_AnalysisFunctions_MultiPatchSeq.ipf: setEventFlag[DAC][%POST_SET_EVENT] = 1
MIES_AnalysisFunctions_MultiPatchSeq.ipf: WAVE setEventFlag = GetSetEventFlag(panelTitle)
MIES_AnalysisFunctions_MultiPatchSeq.ipf: setEventFlag[DAC][%PRE_SET_EVENT] = 0
MIES_AnalysisFunctions_MultiPatchSeq.ipf: setEventFlag[DAC][%POST_SET_EVENT] = 0
MIES_AnalysisFunctions_PatchSeq.ipf: WAVE setEventFlag = GetSetEventFlag(panelTitle)
MIES_AnalysisFunctions_PatchSeq.ipf: setEventFlag[DAC][%PRE_SET_EVENT] = 1
MIES_AnalysisFunctions_PatchSeq.ipf: setEventFlag[DAC][%POST_SET_EVENT] = 1
MIES_DAEphys.ipf: WAVE setEventFlag = GetSetEventFlag(panelTitle)
MIES_DAEphys.ipf: setEventFlag[][%PRE_SET_EVENT] = 1
MIES_DataConfiguratorITC.ipf: WAVE setEventFlag = GetSetEventFlag(panelTitle)
MIES_DataConfiguratorITC.ipf: setEventFlag = 0
MIES_DataConfiguratorITC.ipf: setEventFlag[i][] = (setColumn[i] + 1 == IDX_NumberOfSweepsInSet(setName[i]))
MIES_Indexing.ipf: WAVE setEventFlag = GetSetEventFlag(panelTitle)
MIES_Indexing.ipf: setEventFlag[][%PRE_SET_EVENT] = 1
MIES_WaveDataFolderGetters.ipf: WAVE/D/Z/SDFR=dfr wv = setEventFlag
MIES_WaveDataFolderGetters.ipf: Make/D/N=(NUM_DA_TTL_CHANNELS, 2) dfr:setEventFlag/WAVE=wv
The analysis functions even had to invent PSQ_ForceSetEvent/MSQ_ForceSetEvent to work around some of these limitions when jumping to the end of the set.
A more robust solution would dynamically find out if the event needs firing just before firing and not at the beginning of the previous sweep.
Properties of the set events:
- We expect one pre and one post set event for each stimset which is fully acquired
- If we repeat the first sweep or the last sweep we don't get additional set events
Conditions for pre set event (on each headstage):
- Not already fired with that SCI (stimset cycle id)
- First sweep (unrandomized set sweep count == 0) is about to start
-> No obstacles
Conditions for post set event (on each headstage):
- Last sweep (unrandomized set sweep count == num sweeps in set -1) is finished
The "finished" part is difficult as you can currently skip back during ITI, but the post set event was already fired before the ITI started. One way to overcome that is to say that we don't fire the post set event again if we have it fired already. This could be justified by saying that "we fire XXX set events the first time a stimset reaches the condition".
The last part would still work for our SpikeControl analysis function as here we skip back before the new decision logic kicks in.
Interesting commits:
- 407fec519045ebe30b941d884a775496b19c8255
- 006950e97a6fc2394fa12fdf45137b11696e3eb2 (XXX_SET_EVENT were not yet working with indexing)
Changes:
- Document that PRE_SET_EVENT is done before anything is prepared for the sweep PRE_SWEEP_EVENT has everything already prepared. This is crucial as you can still tweak stuff in PRE_SET but not in PRE_SWEEP.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the setEventFlag uses in MIES_AnalysisFunctionManagement.ipf, MIES_AnalysisFunctions_MultiPatchSeq.ipf, MIES_AnalysisFunctions_PatchSeq.ipf, MIES_DAEphys.ipf, MIES_DataConfiguratorITC.ipf, and MIES_Indexing.ipf. Review the listed commits and trace how SCI and unrandomized sweep counts determine PRE_SET_EVENT and POST_SET_EVENT. Done means event decisions are made at the specified sweep boundaries without duplicate events when repeating or skipping, and the PRE_SET_EVENT timing distinction is documented.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100