@@ -744,7 +744,8 @@ static Function [WAVE/D peakX, WAVE/D peakY] PSX_AnalyzePeaks(WAVE sweepDataOffF
744744 riseTimeParams[ %$ "Upper Threshold" ] , \
745745 p)
746746
747- psxEvent[][ % tau] = PSX_FitEventDecay ( sweepDataOffFilt, psxEvent, maxTauFactor, eventFit, p)
747+ Make / FREE/ N= ( DimSize ( psxEvent, ROWS)) indexHelper
748+ indexHelper[] = PSX_FitEventDecay ( sweepDataOffFilt, psxEvent, maxTauFactor, eventFit, p)
748749
749750 return [ peakX, peakY]
750751End
@@ -855,19 +856,23 @@ End
855856///
856857/// \rst
857858///
858- /// exp_XOffset : :math:`y = K0 + K1 \cdot exp ( - ( x - x0 ) / K 2 ) `
859+ /// dblexp_XOffset : :math:`y = K0 + K1 \cdot exp ( - ( x - x0 ) / K 2 ) + K 3 * exp ( - ( x - x 0 ) / K 4 ) `
859860///
860861/// \endrst
861862static Function PSX_FitEventDecay ( WAVE sweepDataOffFilt, WAVE psxEvent, variable maxTauFactor, WAVE /WAVE eventFit, variable eventIndex)
862863
863- variable startTime, endTime, err, decayTau , fitRange, overrideTau
864+ variable startTime, endTime, err, weightedTau , slowTau , fastTau , fitRange, overrideTau
864865 string comboKey
865866
866867 [ startTime, endTime] = PSX_GetEventFitRange ( sweepDataOffFilt, psxEvent, eventIndex)
867868
868869 if ( IsNaN ( startTime) && IsNaN ( endTime))
869870 psxEvent[ eventIndex][ %$ "Fit manual QC call" ] = PSX_REJECT
870871 psxEvent[ eventIndex][ %$ "Fit result" ] = PSX_DECAY_FIT_INVALID_RANGE_ERROR
872+ psxEvent[ eventIndex][ % weightedTau] = NaN
873+ psxEvent[ eventIndex][ % slowTau] = NaN
874+ psxEvent[ eventIndex][ % fastTau] = NaN
875+
871876 return NaN
872877 endif
873878
@@ -886,7 +891,9 @@ static Function PSX_FitEventDecay(WAVE sweepDataOffFilt, WAVE psxEvent, variable
886891
887892 SetDataFolder currDFR
888893 // weighted tau computed from double exponential fit
889- decayTau = (( coefWave[ 1 ] * coefWave[ 2 ] + coefWave[ 3 ] * coefWave[ 4 ]) / ( coefWave[ 1 ] + coefWave[ 3 ]))
894+ slowTau = coefWave[ 2 ]
895+ fastTau = coefWave[ 4 ]
896+ weightedTau = (( coefWave[ 1 ] * slowTau + coefWave[ 3 ] * fastTau) / ( coefWave[ 1 ] + coefWave[ 3 ]))
890897
891898#ifdef AUTOMATED_TESTING
892899 WAVE /Z overrideResults = GetOverrideResults ()
@@ -900,22 +907,30 @@ static Function PSX_FitEventDecay(WAVE sweepDataOffFilt, WAVE psxEvent, variable
900907 overrideTau = overrideResults[ eventIndex][ %$ comboKey][ % Tau]
901908
902909 if ( ! IsNaN ( overrideTau))
903- decayTau = overrideTau
910+ weightedTau = overrideTau
904911 endif
905912 endif
906913#endif // AUTOMATED_TESTING
907914
908915 if ( err)
909916 psxEvent[ eventIndex][ %$ "Fit manual QC call" ] = PSX_REJECT
910917 psxEvent[ eventIndex][ %$ "Fit result" ] = - err
918+ psxEvent[ eventIndex][ % weightedTau] = NaN
919+ psxEvent[ eventIndex][ % slowTau] = NaN
920+ psxEvent[ eventIndex][ % fastTau] = NaN
921+
911922 return NaN
912923 endif
913924
914925 fitRange = endTime - startTime
915926
916- if ( IsFinite ( decayTau ) && decayTau > ( maxTauFactor * fitRange))
927+ if ( IsFinite ( weightedTau ) && weightedTau > ( maxTauFactor * fitRange))
917928 psxEvent[ eventIndex][ %$ "Fit manual QC call" ] = PSX_REJECT
918929 psxEvent[ eventIndex][ %$ "Fit result" ] = PSX_DECAY_FIT_ERROR
930+ psxEvent[ eventIndex][ % weightedTau] = NaN
931+ psxEvent[ eventIndex][ % slowTau] = NaN
932+ psxEvent[ eventIndex][ % fastTau] = NaN
933+
919934 return NaN
920935 endif
921936
@@ -925,8 +940,9 @@ static Function PSX_FitEventDecay(WAVE sweepDataOffFilt, WAVE psxEvent, variable
925940 eventFit[ eventIndex] = fit
926941 psxEvent[ eventIndex][ %$ "Fit result" ] = 1
927942 psxEvent[ eventIndex][ %$ "Fit manual QC call" ] = PSX_UNDET
928-
929- return decayTau
943+ psxEvent[ eventIndex][ % weightedTau] = weightedTau
944+ psxEvent[ eventIndex][ % slowTau] = slowTau
945+ psxEvent[ eventIndex][ % fastTau] = fastTau
930946End
931947
932948/// @brief Create the override results 2D wave
@@ -1216,8 +1232,14 @@ static Function [WAVE/D results, WAVE eventIndex, WAVE marker, WAVE/T comboKeys]
12161232 case "xinterval" :
12171233 propLabel = "iei"
12181234 break
1219- case "tau" :
1220- propLabel = "tau"
1235+ case "slowtau" :
1236+ propLabel = "slowTau"
1237+ break
1238+ case "fasttau" :
1239+ propLabel = "fastTau"
1240+ break
1241+ case "weightedtau" :
1242+ propLabel = "weightedTau"
12211243 break
12221244 case "estate" :
12231245 propLabel = "Event manual QC call"
@@ -1262,7 +1284,9 @@ static Function [WAVE/D results, WAVE eventIndex, WAVE marker, WAVE/T comboKeys]
12621284 stateType = "Event manual QC call"
12631285 break
12641286 case "Fit result" :
1265- case "tau" :
1287+ case "slowtau" :
1288+ case "fasttau" :
1289+ case "weightedtau" :
12661290 case "Fit manual QC call" :
12671291 stateType = "Fit manual QC call"
12681292 break
@@ -1556,8 +1580,14 @@ static Function/WAVE PSX_OperationStatsImpl(string graph, string id, WAVE/WAVE s
15561580 case "xinterval" :
15571581 propLabelAxis = "Event interval" + " (" + JWN_GetStringFromWaveNote ( allEvents[ 0 ] , PSX_X_DATA_UNIT) + ")"
15581582 break
1559- case "tau" :
1560- propLabelAxis = "Decay tau" + " (" + JWN_GetStringFromWaveNote ( allEvents[ 0 ] , PSX_X_DATA_UNIT) + ")"
1583+ case "slowtau" :
1584+ propLabelAxis = "Slow tau" + " (" + JWN_GetStringFromWaveNote ( allEvents[ 0 ] , PSX_X_DATA_UNIT) + ")"
1585+ break
1586+ case "fasttau" :
1587+ propLabelAxis = "Fast tau" + " (" + JWN_GetStringFromWaveNote ( allEvents[ 0 ] , PSX_X_DATA_UNIT) + ")"
1588+ break
1589+ case "weightedtau" :
1590+ propLabelAxis = "Weighted tau" + " (" + JWN_GetStringFromWaveNote ( allEvents[ 0 ] , PSX_X_DATA_UNIT) + ")"
15611591 break
15621592 case "estate" :
15631593 propLabelAxis = "Event manual QC" + " (enum)"
@@ -3002,9 +3032,9 @@ static Function PSX_UpdateSingleEventTextbox(string win, [variable eventIndex])
30023032 DFREF comboDFR = PSX_GetCurrentComboFolder ( win)
30033033 WAVE psxEvent = GetPSXEventWaveFromDFR ( comboDFR)
30043034
3005- Make / FREE/ T/ N= ( 8 , 2 ) input
3035+ Make / FREE/ T/ N= ( 10 , 2 ) input
30063036
3007- input[ 0 ][ 0 ] = { "Event State:" , "Fit State:" , "Fit Result:" , "Event:" , "Deconv Peak:" , "Peak:" , "Baseline:" , "IeI:" , "Amp (rel.):" , "Tau :" , "Onset time:" , "Rise time:" }
3037+ input[ 0 ][ 0 ] = { "Event State:" , "Fit State:" , "Fit Result:" , "Event:" , "Deconv Peak:" , "Peak:" , "Baseline:" , "IeI:" , "Amp (rel.):" , "Slow tau:" , "Fast tau:" , "Weighted tau :", "Onset time:" , "Rise time:" }
30083038 input[ 0 ][ 1 ] = { PSX_StateToString ( psxEvent[ eventIndex][ %$ "Event manual QC call" ]) , \
30093039 PSX_StateToString ( psxEvent[ eventIndex][ %$ "Fit manual QC call" ]) , \
30103040 PSX_FitResultToString ( psxEvent[ eventIndex][ %$ "Fit Result" ]) , \
@@ -3014,7 +3044,9 @@ static Function PSX_UpdateSingleEventTextbox(string win, [variable eventIndex])
30143044 num2str ( psxEvent[ eventIndex][ % baseline_t] , "%8.02f" ) + " [ms]" , \
30153045 num2str ( psxEvent[ eventIndex][ % iei] , "%8.02f" ) + " [ms]" , \
30163046 num2str ( psxEvent[ eventIndex][ % amplitude] , "%8.02f" ) + " [" + yUnit + "]" , \
3017- num2str ( psxEvent[ eventIndex][ % tau] , "%8.02f" ) + " [ms]" , \
3047+ num2str ( psxEvent[ eventIndex][ % slowTau] , "%8.02f" ) + " [ms]" , \
3048+ num2str ( psxEvent[ eventIndex][ % fastTau] , "%8.02f" ) + " [ms]" , \
3049+ num2str ( psxEvent[ eventIndex][ % weightedTau] , "%8.02f" ) + " [ms]" , \
30183050 num2str ( psxEvent[ eventIndex][ %$ "Onset Time" ] , "%8.02f" ) + " [ms]" , \
30193051 num2str ( psxEvent[ eventIndex][ %$ "Rise Time" ] , "%8.02f" ) + " [ms]" }
30203052
@@ -5155,14 +5187,14 @@ End
51555187
51565188static Function/WAVE PSX_GetAllStatsProperties ()
51575189
5158- Make / FREE/ T allProps = { "amp" , \
5159- "peak" , "peaktime" , \
5160- "deconvpeak" , "deconvpeaktime" , \
5161- "baseline" , "baselinetime" , \
5162- "xinterval" , \
5163- "tau " , \
5164- "estate" , "fstate" , "fitresult" , \
5165- "slewrate" , "slewratetime" , \
5190+ Make / FREE/ T allProps = { "amp" , \
5191+ "peak" , "peaktime" , \
5192+ "deconvpeak" , "deconvpeaktime" , \
5193+ "baseline" , "baselinetime" , \
5194+ "xinterval" , \
5195+ "slowtau " , "fasttau" , "weightedtau" , \
5196+ "estate" , "fstate" , "fitresult" , \
5197+ "slewrate" , "slewratetime" , \
51665198 "risetime" , "onsettime" }
51675199
51685200 return allProps
0 commit comments