Repository navigation
ENH: Add peak models and a tailing factor to the synthetic generator - #26
Merged
Merged
Conversation
Cite where Niezen et al. (2022) and Milani et al. (2024) use the function instead of ranking claims, and drop the matching claim from the fit_peak docstring.
The analytes can now be an EMG (the default), a modified Pearson VII or a Gaussian (--peak-model). Each analyte draws a tailing factor (Snyder et al. 2009, 5% height), by default as one plus a log-normal variate, with rare fronting for the Pearson VII, and converts it to the model's parameter by root finding; --tailing-factor draws it uniformly in a range instead. The defaults were picked for this benchmark, and the docs give literature values for reference. The Pearson VII takes the plate FWHM when symmetric and its long-side floor is removed. The truth records each analyte's shape, tailing and asymmetry factors; the manifest gains peak_model, tf_min and tf_max. See #24.
The model follows the peak case, as in SYN__erb__many__emg__step__high__00__1004. synth_diag reads it into a peak_model column and still reads seven-field names, with peak_model empty.
The shapes and the noise now draw from streams split off the signal's seed, so datasets that differ only in their peak model share dead times, peak heights, positions and noise, wherever every peak fits where it was drawn.
The analyte heights were log-uniform between 1 and 30 mV. They are now log-normal, of median 3 mV and log-standard deviation 1.0, picked for this benchmark, and never below three noise standard deviations, the limit of detection of MacDougall et al. (1980, Eq. (9)). --height-median and --height-log-sigma set other values. Each height still takes one uniform draw, so record lengths, dead times and noise are unchanged. Placement depends on the height, so peak centres move on some signals. The manifest gains height_min_sigma.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #24.
The synthetic generator previously assigned the same kind of tail to every peak, with no option to disable it or adjust it. Peak shapes are now configurable, as is the amount of tailing.
--peak-modelselects the shape:emg(default),pearson7, the modified Pearson VII (which can also produce fronting), orgaussian(which disables asymmetry).--tailing-factor LO HIinstead samples within a specified range, and--pearson-m LO HIsets the range for the Pearson VII shape parameter.synth_diag.pyparses this and also supports the older naming scheme.--height-medianand--height-log-sigmacontrol this distribution.synthetic_data.mddocuments the new sampling procedures, and the Pearson VII notes inpeakfitting.pyhave been shortened.Type of Pull Request
Pull Request Checklist
if applicable.
if applicable.
ruff check .passes, if applicable.