Preparation for ivscc apfrequency operation#2730
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prepares the SweepFormula subsystem for the upcoming ivscc_apfrequency operation by adding reusable operations (getmeta, preparefit, fit2) and enhancing SweepFormula plotting metadata (error bar styles + axis offsets/percent display), along with tests and documentation.
Changes:
- Added SweepFormula operations:
getmeta,preparefit, andfit2(plus executor wiring and new constants/meta keys). - Extended SF plotter support for error bar styling and axis offset/percentage metadata.
- Added automated tests and updated SweepFormula documentation for the new operations.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Packages/tests/UTF_DataGenerators.ipf | Adds a test data generator for integrated Igor fit function names. |
| Packages/tests/Basic/UTF_SweepFormula_Operations.ipf | Adds extensive tests for getmeta, preparefit, and fit2 (success + failure cases). |
| Packages/MIES/MIES_WaveDataFolderGetters.ipf | Extends plot metadata wave shape; introduces errorbar-style wave factory; adds preparefit output wave creator. |
| Packages/MIES/MIES_Utilities_SFHCheckers.ipf | Adds new checker helpers for integer/non-negative arguments and preparefit hold-string validation. |
| Packages/MIES/MIES_SweepFormula.ipf | Extends plot metadata filling, adds axis property application, and plumbs errorbar-style metadata into plotting. |
| Packages/MIES/MIES_SweepFormula_Operations.ipf | Implements getmeta, preparefit, and fit2 including fit metadata emission and error bar generation. |
| Packages/MIES/MIES_SweepFormula_Helpers.ipf | Adds helper to set fit trace styling + errorbar-style metadata for plotted fit output. |
| Packages/MIES/MIES_SweepFormula_Executor.ipf | Registers the new operations with the SweepFormula executor. |
| Packages/MIES/MIES_Constants.ipf | Adds new SF operation names, meta keys (fit + plotting), preparefit constants, and fit error/quit reason codes. |
| Packages/doc/SweepFormula.rst | Documents getmeta, preparefit, and fit2 usage and fit metadata keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
05bd0c6 to
de67fef
Compare
99c1655 to
487b685
Compare
487b685 to
f8a5bf6
Compare
f8a5bf6 to
97d6b31
Compare
97d6b31 to
016c5ec
Compare
016c5ec to
73dfcad
Compare
|
@claude review |
1 similar comment
|
@claude review |
|
Hmm for me claude is not in the reviewers list and I can not choose it. |
|
@MichaelHuth Can the copilot comments being dismissed? If yes please do so. |
97f563a to
dd8c83a
Compare
|
@t-b Sorry, I have to push once more, as the number of coefficient change for poly n that Copilot suggested is actually wrong. I need to revert that. So for poly n, the n refers to the number of terms, whereas for poly2D n refers to the degree of the polynomial. |
Preparefit allows to create a fitting profile for a subsequent fit. This profile is currently used by the operation fit2 as argument. preparefit([fitFuncName, length, errorbarType, errorbarStyle, confLevel, coefs, holdStr, range, constraints]) When called without arguments the resulting profile is set to NO_FIT and fit2 will return an null wave. The profile allows to set a fit function name, that can be an Igor Pro integrated or user fit function. The length argument sets the number of point in the fit result. When set the zero the number of points equals the number of input points. errorbarType, errorbarStyle, confLevel define which information is returned as errorbar with style hints for displaying. coefs, holdStr, range, constraints are technically the same arguments that CurveFit takes. holdStr was changed from a 01 syntax to OX to allow easy input as quoteless string. coefs, range and constraints are arrays. The operation returns a types result, such that a consuming function can verify the origin. Some aspects of the input are checked by Preparefit itself, e.g. existence of user fit function, number of coefficient, number of elements in holdStr.
fit2 is a operation that allows to run a fit on input data. The design is rather generic. The call can be either written with an x-wave or without: fit2(wvY, preparefit) fit2(wvY, wvX, preparefit) preparefit is a fit profile from the operation preparefit. Errorbar meta information from wvY and wvX is used a standard deviation for the input. If there is a standard deviation for x-values an ODR fit is run. The fit2 function returns the fitted data and all additional generated data as meta data that can be retrieved with getmeta. It also sets the errorbars of the result according to the specification from the fit profile from preparefit. If the fit fails a zero sized wave is returned where from the meta data, e.g. with the key from SF_META_FITERROR the error code can be retrieved.
The function SFH_IsArray does a check if the WaveRef wave has a single row. If yes then it refers further to an array. If it has multiple rows, then it must be datasets and no array. The brackets were set wrong for this check. Since: 50ce1f5 (SFH: Introduce function SFH_MoveDatasetHigherIfCompatible, 2024-06-11)
dd8c83a to
8ab4683
Compare
This PR pulls out the following three components from PR #2599 :
with tests and docu
close #2731