-
Notifications
You must be signed in to change notification settings - Fork 9
Various PSX fixes #2362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Various PSX fixes #2362
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
f508957
to
f23db8a
Compare
1332271
to
08deb18
Compare
a12c1dd
to
193bf80
Compare
This comment was marked as outdated.
This comment was marked as outdated.
@t-b I also tested pasting the average fit results into Excel. The row formatting is correct. However, Excel plots all the columns in one column. Excel is dumb. To correct this, paste into Excel, select the cells, select Data from the menu, select Text to Columns, and select the appropriate delimiter in the Excel pop-up GUI. |
@t-b there may also be issues with the indivdual decay tau values. For example in this case I'm getting a negative weighted tau. |
These routines allow to calculate all values between 2^1 and 2^30 which have 2 and 3 as prime factors. This helps in deciding a good cut off value for FFT as it only performs when the primes are smaller than 5.
And also move the error state constants into MIES_Constants.ipf.
The FFT implementation in Igor Pro requires the prime factors of the length to be < 5 for speedy execution. For some cases these prime factors can be very large (~1e5) and thus FFT would be dead slow, i.e. in the order of minutes on common machines. We now employ a data shortening to a size which has only 2 and 3 as prime factors, which makes FFT very fast. This is only done if we have prime factors larger than a 1000 in the original size.
We now reserve space for the defaults in the psxDeconvBPFilter/psxSweepBPFilter operations so that we can later on add the calculated defaults, which need parameters from psxKernel, can be added via PSX_AddDefaultFilterFrequencies.
And allow querying them from psxstats.
This is convenient for documentation purposes although this is not an input parameter.
1f4d350
to
79100a9
Compare
@timjarsky Given the SF code
which creates the plot the following IP code Function Dostuff()
string win = "DB_ITC18USB_Dev_0"
string name = "result name"
WAVE textualResultsValues = BSP_GetLogbookWave(win, LBT_RESULTS, LBN_TEXTUAL_VALUES, selectedExpDevice = 1)
string key = SFH_FormatResultsKey(SFH_RESULT_TYPE_STORE, name)
WAVE/T/Z settings = GetLastSetting(textualResultsValues, NaN, key, SWEEP_FORMULA_RESULT)
ASSERT(WaveExists(settings), "Missing settings")
string entry = settings[INDEP_HEADSTAGE]
//print entry
WAVE/WAVE/Z parsedData = JSONToWave(entry)
ASSERT(WaveExists(parsedData), "Missing parsedData")
ASSERT(IsWaveRefWave(parsedData), "parsedData is not a wave reference wave")
WAVE/Z element = parsedData[0]
ASSERT(WaveExists(element), "Missing element")
print element
End gathers the the number of events, here |
Ever since 7aa2be6 (PSX: Add average fit for all states, 2025-06-04) we are using the per-combo index for gathering the eventKernelAmp/eventOnsetTime/eventPeakTime values. This is wrong as we must use the index of the displayed events.
@timjarsky I've fixed the kernelAmp zero error. There was some confusion when calculating the average for multiple combos/ranges. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements various fixes and improvements for the PSX (PostSynaptic Current/Potential) analysis functionality. The main purpose is to enhance the PSX event detection and fitting algorithms with improved filtering, fitting procedures, and user interface enhancements.
Key changes include:
- Replaced single exponential with double exponential fitting for more accurate tau calculations
- Added new filter operations (
psxSweepBPFilter
andpsxDeconvBPFilter
) with automatic parameter ordering and ringing detection - Enhanced GUI with visualization helpers for peak, baseline, and deconvolution markers
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
Packages/MIES/MIES_SweepFormula_PSX.ipf | Core PSX analysis implementation with new fitting algorithms and filter improvements |
Packages/MIES/MIES_SweepFormula_PSX_Macro.ipf | Updated GUI panel with new checkboxes and controls for visualization |
Packages/MIES/MIES_WaveDataFolderGetters.ipf | Added new getters for PSX event data structures and fit results |
Packages/MIES/MIES_MiesUtilities_Algorithm.ipf | New band-pass filter with ringing detection algorithm |
Packages/MIES/MIES_Utilities_Algorithm.ipf | FFT optimization utilities for better performance |
Packages/tests/Basic/UTF_SweepFormula_PSX.ipf | Updated tests for new PSX functionality |
Packages/doc/SweepFormula.rst | Documentation updates for new PSX operations |
Comments suppressed due to low confidence (4)
Packages/MIES/MIES_SweepFormula_PSX.ipf:2439
- Variable name 'riseLowerThreshold' should be 'riselowerThreshold' to match the declaration on line 2434.
PSX_FitAverage(win, averageDFR, eventOnsetTime, eventPeakTime, eventStopTime, eventKernelAmp, stateNew, PSX_REJECT)
Packages/MIES/MIES_SweepFormula_PSX.ipf:2441
- Variable name 'riseLowerThreshold' should be 'riselowerThreshold' to match the declaration on line 2434.
PSX_UpdateAverageWave(contAverageUndet, undetIndex, averageDFR, PSX_UNDET)
Packages/MIES/MIES_SweepFormula_PSX.ipf:6445
- [nitpick] Variable name 'forDisp' is unclear. Consider renaming to something more descriptive like 'avgEventDiffDisplay' or 'debugDisplay'.
duplicate AvgEventDiff, forDisp
Packages/tests/Basic/UTF_Utils_Algorithm.ipf:1397
- [nitpick] The test logic uses a logical OR condition which may not provide sufficient test coverage. Consider testing each case separately to ensure both conditions are properly validated.
CHECK(result[0] == 2 || result[0] == 3) // NOLINT
camel case fix Co-authored-by: Copilot <[email protected]>
camel case fix Co-authored-by: Copilot <[email protected]>
@timjarsky The store example is at #2362 (comment). |
2^l + 3^k
logic, closes: PSX: Make it faster #1663()
behind numberOfSDs in the JWN to document itV_mode
and all other missing entries from StatsQuantiles to postProc output forstats
inpsxStats
psxKernel
parameters from scratchOld Todos
So this should be ready for a first test. I've adapted `psxKernel` and `psxStats` to allow passing in multiple selections.
that still makes sense. The baseline search shouldn't search past the previous
peak_t. With the baseline_t of the event available, PSX_CalculateEventPeak, instead
of using prevDeconvPeak_t to constrain the search, can use the event
baseline_tinstead. The above makes adding a peakfinding operation, which I suggested
yesterday, unnecessary.
// 3 checkboxes to turn all of these on/off below suppress update
// peak_t
// baseline_t
with
, see SweepFormula: Groups multiple x-axis labels #2423psxStats
, see psxstats: Should accept an array of properties #2422