Skip to content

PSX iterations #2427

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

Open
wants to merge 54 commits into
base: main
Choose a base branch
from
Open

PSX iterations #2427

wants to merge 54 commits into from

Conversation

t-b
Copy link
Collaborator

@t-b t-b commented May 14, 2025

  • Various PSX fixes #2362
  • BandPassWithRingingDetection: Generalize for all four filter types and rename
  • Make psxKernel a pure data container
  • psx Add PsxIterations([iterations = 0]) operation
    • Start from user given values for iterations > 0
    • Median values of all events with valid fit result for amplitude and weighted Tau
    • Calculate riseTau from rise times, use avg for now; TJ comes up with something better
    • Once finished, add resulting values to wave note
    • Let psx store that in the results wave using the id

t-b and others added 30 commits May 9, 2025 19:08
The returned wave is the same as was passed in. Although the current code
makes it clear what is input and what is output, this creates verbose code
as you can't have the same wave as input (RHS) and output (LHS) of an
equation.

So let's drop the returned wave.
And rename them to emphasize the label component as the y data unit is
only the fallback.
In e26f03a (SF: Adapt logic how x-waves are mapped to y-waves,
2022-08-19) we added code to special case x/y wave mapping.

But we don't need to do that if we have single point x and y waves only.
This preserves wave metadata like units.
…s' into HEAD

* bugfix/2423-sweepformula-multiple-axis-labels-for-x-axis:
  SF_GatherAxisLabels: Also gather the x-labels
  SF_FormatUnit: Factor it out
  SF_GatherFormulaResults: Prefer Duplicate over new Make
  SF_GatherFormulaResults: Skip special case for single x and y wave pairs
  Tests: Add TestAxisLabelGathering
  SF_FormulaPlotter: Move SF_CombineAxisLabels closer to its usage
  SF_FormulaPlotter: Generalize y axis label handling
  SF_GatherYUnits: Drop return value
  SF_CombineYUnits: Prefer TextWaveToList
  SF_FormulaPlotter: Factor traceCnt check out
By accepting the text wave to be pretty printed we can let the visualized
data and the data copied to the clipboard differ so that the latter can be
more easily C&P'ed into tab calculations like Excel/Calc.
…nto HEAD

* feature/2424-easier-copy-and-paste-from-psx-to-excel:
  UpdateInfoButtonHelp: Set machine-readable text for C&P
We already call PSX_UpdateAllEventGraph with all flags set in
PSX_PostPlot. So using PGC for each control and doing a partial update is
just a waste of CPU cycles.

This also fixes a bug where the Fit accepted average checkbox was checked
and the restore triggered an assertion as the single event waves were not
yet up-to-date.
When having a SF formula like psxStats vs [0, 1] the xWave has not the
same size anymore.

So we need to refetch the x-wave in this case.
Taking the start of the single event (0) does not work that well. So let's
take 10% of the mean peak time instead.
The current algorithm for determining the left boundary for the baseline
search did not take into account events which are close-by. Fix that by
using the peak time of the previous event as maximum boundary.
We do override the box size for the find peak search as that is a quick
fix but not that dirty.

Some minor test adjustments were also required.
When the calculated average standard deviation is NaN we can still get a
tau of NaN. Use the fallback value in this case.
And rename the original function to PSX_CalculateRiseTimeWrapper.
timjarsky and others added 24 commits May 9, 2025 19:29
…al fit

For the individual event decay fit. Weighted tau is computed for each event.
New MiES algorithmic utility for band pass filtering with Nan, Inf, and rinnging rejection and automatic order reduction
Rename it to psxDeconvBPFilter to make it clear that this is a bandpass
filter, see also PSX_DeconvoluteSweepData.

And also reorder the filter frequencies for the user to avoid an
assertion.
Due to implementation details of how FilterIIR implements band pass
filters the used order is always even. If required, odd values are increased by one so
that they are even.

Document that and also make them even already when we get them. We can as
well adap the default value to be even already.
Define all variables at the top, reword the documentation.
When PSX_OperationSweepGathering returns 1 as error code, we wrote the
code so that idx is not incremented in this case. The idea in d359a7a
(PSX_Operation: Handle partial results better, 2024-02-27) was that we
don't want holes in the output wave. But the code was buggy as it, after
an error, would reuse the same data again, and thus error out again, and
therefore ignoring all data behind the first combination with an error.

Fix that by introducing separate indizes for reading and writing.
A common tweaking algorithm done by users is to find the lowest filter
order which has the data from all combinations passing. As that is
manually quite tedious we now do that for her.

The idea is to start at some maximum order and then get he realized order
for each combination. If the realized order is constant for all
combinations, we are done. Otherwise we try the minimum order again and
should then be finished.

This is done for both sweep and deconv.
We need to preprocess the code before we can extract the variables and the
formula. Broken since 8ec6945 (SF: Add support to check also variables
with the check button, 2023-03-29).
@t-b t-b self-assigned this May 14, 2025
@t-b t-b requested review from timjarsky and MichaelHuth as code owners May 14, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants