Skip to content

Commit 06d4f50

Browse files
committed
bugfix
1 parent f23db8a commit 06d4f50

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Packages/MIES/MIES_SweepFormula_PSX.ipf

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static Constant PSX_KEYBOARD_DIR_LR = 1
5959

6060
static Constant PSX_NUMBER_OF_SDS_DEFAULT = 2.5
6161

62-
static Constant PSX_TAU_CALC_FACTOR = 2.5
62+
static Constant PSX_TAU_CALC_FACTOR = 1 // 2.5
6363
static Constant PSX_BASELINE_RANGE_FACTOR = 10
6464
static Constant PSX_FIT_RANGE_FACTOR = 10
6565
static Constant PSX_FIT_RANGE_PERC = 0.9
@@ -572,6 +572,10 @@ static Function [variable peak_t, variable peak] PSX_CalculateEventPeak(WAVE pea
572572
numCrossings = DimSize(peakX, ROWS)
573573

574574
deconvPeak_t = peakX[index]
575+
576+
// TODO try out FindPeaks and use the latest peak
577+
578+
// TODO restrict accept fit range stop point to X times kernelDecayTau
575579

576580
// lower bound
577581
if(index > 0)
@@ -610,8 +614,10 @@ static Function [variable baseline_t, variable baseline] PSX_CalculateEventBasel
610614

611615
variable range
612616

617+
// TODO switch peak_t -> deconvPeak_t and calculate it first
613618
WaveStats/M=1/Q/R=(max(peak_t - PSX_BASELINE_RANGE_FACTOR * kernelRiseTau, peak_t_prev), peak_t) sweepDataOffFilt
614619

620+
615621
if(kernelAmp > 0)
616622
baseline_t = V_minloc
617623
elseif(kernelAmp < 0)
@@ -629,6 +635,11 @@ End
629635

630636
static Function [variable peak, variable peak_t, variable baseline, variable baseline_t, variable amplitude] PSX_CalculateEventProperties(WAVE peakX, WAVE peakY, WAVE sweepDataOffFilt, variable peak_t_prev, variable kernelAmp, variable kernelRiseTau, variable kernelDecayTau, variable index)
631637

638+
639+
// if(index == 1)
640+
// Debugger
641+
// endif
642+
632643
[peak_t, peak] = PSX_CalculateEventPeak(peakX, peakY, sweepDataOffFilt, kernelAmp, kernelRiseTau, kernelDecayTau, index)
633644
[baseline_t, baseline] = PSX_CalculateEventBaseline(sweepDataOffFilt, peak_t_prev, peak_t, kernelAmp, kernelRiseTau)
634645

@@ -2346,7 +2357,7 @@ static Function PSX_FitAcceptAverage(string win, DFREF averageDFR, WAVE eventPea
23462357

23472358
WAVE/Z eventStopTimeClean = ZapNaNs(eventStopTime)
23482359
if(WaveExists(eventStopTimeClean))
2349-
meanStopTime = mean(eventStopTime)
2360+
meanStopTime = mean(eventStopTimeClean)
23502361
else
23512362
meanStopTime = Inf
23522363
endif

0 commit comments

Comments
 (0)