Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
timjarsky authored and t-b committed Nov 15, 2024
1 parent 28eccea commit 4838597
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Packages/MIES/MIES_SweepFormula_PSX.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ static Function/WAVE PSX_FilterSweepData(WAVE sweepData, variable low, variable
ASSERT(low > high, "Expected a band pass filter with low > high")

Duplicate/FREE sweepData, filtered
// Duplicate/O sweepData, root:sweepData

FilterIIR/ENDV=(filtered[0])/LO=(low / samp)/HI=(high / samp)/DIM=(ROWS) filtered; err = GetRTError(1)
// print low, high, samp
// Abort
FilterIIR/ENDV=(filtered[0])/LO=(low / samp)/HI=(high / samp)/DIM=(ROWS)/ORD=6 filtered; err = GetRTError(1)
SFH_ASSERT(!err, "Error filtering the data, msg: " + GetErrMessage(err))

return filtered
Expand Down Expand Up @@ -329,6 +332,9 @@ static Function/WAVE PSX_DeconvoluteSweepData(WAVE sweepData, WAVE/C psxKernelFF
low = deconvFilter[%$"Filter Low"]
high = deconvFilter[%$"Filter High"]
order = deconvFilter[%$"Filter Order"]

low = 200
high = 20

if(IsNaN(low))
lowFrac = PSX_DECONV_FILTER_DEF_LOW
Expand All @@ -346,7 +352,7 @@ static Function/WAVE PSX_DeconvoluteSweepData(WAVE sweepData, WAVE/C psxKernelFF
order = PSX_DECONV_FILTER_DEF_ORDER
endif

ASSERT(lowFrac < highFrac, "Expected a low pass filter with lowFrac < highFrac")
// ASSERT(lowFrac < highFrac, "Expected a low pass filter with lowFrac < highFrac")

numPoints = DimSize(sweepData, ROWS)
fftSize = DimSize(psxKernelFFT, ROWS)
Expand All @@ -362,8 +368,9 @@ static Function/WAVE PSX_DeconvoluteSweepData(WAVE sweepData, WAVE/C psxKernelFF
ASSERT(V_Value == -1, "Can not handle NaN in the deconvoluted wave")

CopyScales sweepData, Deconv

FilterFIR/ENDV={3}/LO={lowFrac, highFrac, order} Deconv

// todo remove low frequencies here with a bandpass filter, always bandpass
FilterFIR/ENDV={3}/LO={lowFrac, highFrac, order}/HI={20/samp, 10/samp, 7} Deconv

return Deconv
End
Expand Down

0 comments on commit 4838597

Please sign in to comment.