Skip to content

Commit

Permalink
ReachTargetVoltage: Convert to V3 analysis function
Browse files Browse the repository at this point in the history
This allows us to set it in the wavebuilder again as we can only set V3
functions interactively due to 55ee1cc (Introduce Analysis functions
V3, 2018-01-26).

V1 and V2 functions are still executed from existing stimsets.
  • Loading branch information
t-b committed Nov 20, 2020
1 parent 73b80dd commit 85d6c5b
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions Packages/MIES/MIES_AnalysisFunctions.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -947,16 +947,10 @@ End
/// Prerequisites:
/// - Stimset with multiple but identical sweeps and testpulse-like shape. The
/// number of sweeps must be larger than the number of rows in the targetVoltages wave below.
/// - This stimset must have this analysis function set for the "Pre DAQ" and the "Post Sweep" Event
/// - Does not support DA/AD channels not associated with a MIES headstage (aka unassociated DA/AD Channels)
/// - All active headstages must be in "Current Clamp"
/// - An inital DAScale of -20pA is used, a fixup value of -100pA is used on the next sweep if the measured resistance is smaller than 20MOhm
Function ReachTargetVoltage(panelTitle, eventType, ITCDataWave, headStage, realDataLength)
string panelTitle
variable eventType
Wave ITCDataWave
variable headstage, realDataLength

Function ReachTargetVoltage(string panelTitle, STRUCT AnalysisFunction_V3& s)
variable sweepNo, index, i
variable amps
variable autoBiasCheck, holdingPotential
Expand All @@ -972,11 +966,11 @@ Function ReachTargetVoltage(panelTitle, eventType, ITCDataWave, headStage, realD

WAVE ampParam = GetAmplifierParamStorageWave(panelTitle)

switch(eventType)
switch(s.eventType)
case PRE_DAQ_EVENT:
targetVoltagesIndex[headstage] = -1
targetVoltagesIndex[s.headstage] = -1

if(DAG_GetHeadstageMode(panelTitle, headstage) != I_CLAMP_MODE)
if(DAG_GetHeadstageMode(panelTitle, s.headstage) != I_CLAMP_MODE)
printf "(%s) The analysis function %s does only work in clamp mode.\r", panelTitle, GetRTStackInfo(1)
ControlWindowToFront()
return 1
Expand Down Expand Up @@ -1012,7 +1006,7 @@ Function ReachTargetVoltage(panelTitle, eventType, ITCDataWave, headStage, realD
KillOrMoveToTrash(wv = GetAnalysisFuncDAScaleRes(panelTitle))
KillWindow/Z $RESISTANCE_GRAPH

SetDAScale(panelTitle, headstage, absolute=-20e-12)
SetDAScale(panelTitle, s.headstage, absolute=-20e-12)

PGC_SetAndActivateControl(panelTitle,"Check_DataAcq1_DistribDaq", val = 1)

Expand All @@ -1023,15 +1017,15 @@ Function ReachTargetVoltage(panelTitle, eventType, ITCDataWave, headStage, realD
return Nan
break
case POST_SWEEP_EVENT:
targetVoltagesIndex[headstage] += 1
targetVoltagesIndex[s.headstage] += 1
break
default:
ASSERT(0, "Unknown eventType")
break
endswitch

// only do something if we are called for the very last headstage
if(DAP_GetHighestActiveHeadstage(panelTitle) != headstage)
if(DAP_GetHighestActiveHeadstage(panelTitle) != s.headstage)
return NaN
endif

Expand Down

0 comments on commit 85d6c5b

Please sign in to comment.