Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
t-b committed Oct 25, 2023
1 parent 66cb682 commit b6a6ea8
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions Packages/MIES/MIES_AnalysisFunctions_PatchSeq.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,8 @@ End

static Function [WAVE fitOffset, WAVE fitSlope] PSQ_DS_EvaluateFrequencyCurrentData(string device, variable numPointsForLineFit, WAVE apfreq, WAVE DAScales)

variable numPoints, numFits, first, last
variable i, numPoints, numFits, first, last
string line
string str = ""

numPoints = DimSize(apfreq, ROWS)
Expand All @@ -1802,8 +1803,8 @@ static Function [WAVE fitOffset, WAVE fitSlope] PSQ_DS_EvaluateFrequencyCurrentD
first = i
last = (i + numPointsForLineFit) - 1

WAVE freqDataSlice = DuplicateSubRange(freqData, first, last)
sprintf line, "freq%d = [%s]\r", i, RemoveEnding(NumericWaveToList(freqDataSlice, ","), ",")
WAVE apfreqSlice = DuplicateSubRange(apfreq, first, last)
sprintf line, "freq%d = [%s]\r", i, RemoveEnding(NumericWaveToList(apfreqSlice, ","), ",")
str += line

WAVE DaScalesSlice = DuplicateSubRange(DAScales, first, last)
Expand Down Expand Up @@ -1831,6 +1832,7 @@ static Function [WAVE fitOffset, WAVE fitSlope] PSQ_DS_EvaluateFrequencyCurrentD
endif
endfor

// @todo
// databrowser = PSQ_ExecuteSweepFormula(device, str)
//
// WAVE/T textualResultsValues = BSP_GetLogbookWave(databrowser, LBT_RESULTS, LBN_TEXTUAL_VALUES, selectedExpDevice = 1)
Expand All @@ -1842,6 +1844,10 @@ static Function [WAVE fitOffset, WAVE fitSlope] PSQ_DS_EvaluateFrequencyCurrentD
// WAVE DaScale = PSQ_GetSweepFormulaResultWave(textualResultsValues, key, sweepNo)
End

static Function PSQ_DS_CheckFitResults(WAVE fitOffset, WAVE fitSlope)

End

/// @brief Help strings for common parameters
///
/// Not every analysis function uses every parameter though.
Expand Down Expand Up @@ -2248,7 +2254,7 @@ Function PSQ_DAScale(device, s)
STRUCT AnalysisFunction_V3 &s

variable val, totalOnsetDelay, DAScale, baselineQCPassed, passingSupraSweep
variable i, numberOfSpikes, samplingFrequencyPassed
variable i, numberOfSpikes, samplingFrequencyPassed, numPoints
variable index, ret, showPlot, V_AbortCode, V_FitError, err, enoughSweepsPassed
variable sweepPassed, setPassed, length, minLength
variable minimumSpikeCount, maximumSpikeCount, daScaleModifierParam
Expand Down Expand Up @@ -2364,25 +2370,25 @@ Function PSQ_DAScale(device, s)
endif

// re-evaluate all sweeps from passingSupraSweep SCI using `E1` epoch
[WAVE apfreq, WAVE DaScales] = PSQ_DS_GatherFrequencyCurrentData(device, s.headstage, numPointsForLineFit, passingSupraSweep, s.sweepNo)
[WAVE apfreq, WAVE DaScales] = PSQ_DS_GatherFrequencyCurrentData(device, s.headstage, passingSupraSweep, s.sweepNo)
numPoints = DimSize(apfreq, ROWS)
ASSERT(numPoints == DimSize(DaScales, ROWS), "Non-matching wave sizes")

if(numPoints < numPointsForLineFit)
printf "Found only %d sweeps from DAScale suprathreshold but we require at least %d\r", numPoints, numPointsForLineFit
ControlWindowToFront()
return [$"", $""]
return 1
endif

WAVE/T apfreqLBN = LBN_GetTextWave()
apfreqLBN[INDEP_HEADSTAGE] = NumericWaveToList(apfreqLBN, ",")
key = CreateAnaFuncLBNKey(PSQ_DA_SCALE, PSQ_FMT_LBN_DA_AT_FREQ_DATA)
ED_AddEntryToLabnotebook(device, key, apfreqLBN, overrideSweepNo = s.sweepNo)

WAVE/T DAScalesLBN = LBN_GetTextWave()
DAScalesLBN[INDEP_HEADSTAGE] = NumericWaveToList(DAScalesLBN, ",")
WAVE/T DAScalesTextLBN = LBN_GetTextWave()
DAScalesTextLBN[INDEP_HEADSTAGE] = NumericWaveToList(DAScalesTextLBN, ",")
key = CreateAnaFuncLBNKey(PSQ_DA_SCALE, PSQ_FMT_LBN_DA_AT_DASCALE_DATA)
ED_AddEntryToLabnotebook(device, key, DAScalesLBN, overrideSweepNo = s.sweepNo)
ED_AddEntryToLabnotebook(device, key, DAScalesTextLBN, overrideSweepNo = s.sweepNo)

[WAVE fitOffset, WAVE fitSlope] = PSQ_DS_EvaluateFrequencyCurrentData(device, numPointsForLineFit, apfreq, DAScales)

Expand All @@ -2392,7 +2398,7 @@ Function PSQ_DAScale(device, s)
return 1
endif

WAVE/T maxSlopeLBN = LBN_GetNumericWave()
WAVE maxSlopeLBN = LBN_GetNumericWave()
maxSlopeLBN[INDEP_HEADSTAGE] = WaveMax(fitSlope)
key = CreateAnaFuncLBNKey(PSQ_DA_SCALE, PSQ_FMT_LBN_DA_AT_MAX_SLOPE)
ED_AddEntryToLabnotebook(device, key, maxSlopeLBN, overrideSweepNo = s.sweepNo)
Expand Down

0 comments on commit b6a6ea8

Please sign in to comment.