Skip to content

ENH: Add peak models and a tailing factor to the synthetic generator - #26

Merged
physicien merged 5 commits into
developmentfrom
synth_peak_asymmetry
Nov 24, 2026
Merged

physicien merged 5 commits into
developmentfrom
synth_peak_asymmetry

Conversation

@physicien

Copy link
Copy Markdown
Owner

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-model selects the shape: emg (default), pearson7, the modified Pearson VII (which can also produce fronting), or gaussian (which disables asymmetry).
  • Each peak samples a tailing factor, and the generator maps it to the corresponding model parameter. --tailing-factor LO HI instead samples within a specified range, and --pearson-m LO HI sets the range for the Pearson VII shape parameter.
  • The truth file stores each peak’s shape, tailing factor, and asymmetry factor. The manifest stores the chosen peak model and the tailing factor range.
  • The peak model is included in signal names after the peak case. synth_diag.py parses this and also supports the older naming scheme.
  • Shape generation and noise generation use separate random streams, so datasets created with the same seed across the three models share record lengths, baselines, and noise.
  • Peak heights follow a log-normal distribution and are never less than three standard deviations of the noise. --height-median and --height-log-sigma control this distribution.
  • synthetic_data.md documents the new sampling procedures, and the Pearson VII notes in peakfitting.py have been shortened.

Type of Pull Request

  • Bug Fix
  • New Feature
  • Miscellaneous Changes (refactor, code improvements, etc.)
  • Documentation or Example Programs

Pull Request Checklist

  • New code and/or documentation is valid for use with the BSD 3-Clause license.
  • New code is fully documented with docstrings that follow Numpy style,
    if applicable.
  • New code follows package conventions (max 80 chars per line, etc.),
    if applicable.
  • Added/updated tests and ensured they pass locally, if applicable.
  • Verified that ruff check . passes, if applicable.

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.
@physicien physicien self-assigned this Nov 24, 2026
@physicien
physicien merged commit 195c8ee into development Nov 24, 2026
24 checks passed
@physicien
physicien deleted the synth_peak_asymmetry branch November 24, 2026 17:40
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.

ENH: The synthetic generator tails every peak and cannot make symmetric or fronting ones

1 participant