AllenInstitute / MIES

Multichannel Igor Electrophysiology Suite
https://alleninstitute.github.io/MIES/user.html
Other
22 stars 6 forks source link

Rework setting setEventFlag #658

Open t-b opened 4 years ago

t-b commented 4 years ago

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:

Conditions for pre set event (on each headstage):

-> No obstacles

Conditions for post set event (on each headstage):

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:

Changes:

timjarsky commented 1 year ago

Solved with #39