Skip to content

ENH: Draw the synthetic baselines at random, following Ning et al. - #27

Merged
physicien merged 2 commits into
developmentfrom
ning_baselines
Nov 25, 2026
Merged

physicien merged 2 commits into
developmentfrom
ning_baselines

Conversation

@physicien

@physicien physicien commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Description

Closes #25.

The baselines of the synthetic signals were three fixed curves, and the generator worked in minutes and mV. The baselines are now drawn at random, and the signals have a sample index and no units.

  • Type 1 is a polynomial of random order plus a sinusoid of random frequency. Type 2 is white Gaussian noise through a low-pass filter. Both follow Ning, Selesnick and Duval (2014, §5.1), who do not give their ranges. The ranges used here were chosen to match their Figs. 5 and 6.
  • The three earlier curves remain available with --legacy-baselines.
  • Each signal draws its length between 500 and 40,000 samples, and 1 to 30 peaks (0 to 30 with the plate model). --length and --n-peaks set these two.
  • Peak widths are drawn in samples. With --plate-model, they follow the plate model, which also brings the dead time and the injection artifact.
  • Each peak stays where it was drawn or is dropped, so that the peaks cover at most 33% of the record and have a resolution of at least 1, except for the share that may overlap (--overlap-prob).
  • Heights are log-uniform, in a range set by the baseline. The noise is 30, 25 or 20 dB of baseline energy over noise energy.
  • Signals are named SYN__peaks__model__type__noise__length__replicate. synth_diag.py still reads the earlier names.
  • synth_figs.py labels its axes without units, and qo_all.py sorts by the error over the noise.
  • synthetic_data.md describes the new generator.

--rate, --height-median and --height-log-sigma are gone, and so is the rounding to a detector step. The earlier datasets can no longer be regenerated.

Peak detection in the package still uses widths in samples per minute and heights in mV (#23), so its result on these signals depends on the units they are read in.

References

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.

The generator now draws the two baselines of Ning et al. (2014, §5.1): a
polynomial plus a sinusoid, and low-pass filtered white noise. Both are
defined over the whole record. Erb's parabola, exponential and step come
with --legacy-baselines. Signals have a sample index and no units.

Peaks: 1 to 30 per signal (0 to 30 with the plate model), kept where they
are drawn or dropped, with a 20-sample margin at both ends, a resolution
of at least 1 unless they may overlap (10%), and at most 33% of the
record covered. Widths are drawn in samples, or follow the plate model
with --plate-model, which brings the dead time and the injection
artifact. Heights are log-uniform in a range set by the baseline. The
noise is 30, 25 or 20 dB of baseline energy over noise energy.

--length, --n-peaks, --overlap-prob, --plate-model and --legacy-baselines
are new; --rate, --height-median and --height-log-sigma are gone, and so
is the rounding to a detector step. Names are
SYN__peaks__model__type__noise__length__replicate; synth_diag still reads
the older ones. synth_figs labels its axes without units, and qo_all
sorts by the error over the noise. Earlier sets can no longer be
regenerated.

See #25.
@physicien physicien self-assigned this Nov 25, 2026
@physicien physicien linked an issue Nov 25, 2026 that may be closed by this pull request
@physicien
physicien merged commit d9b5d86 into development Nov 25, 2026
16 checks passed
@physicien
physicien deleted the ning_baselines branch November 25, 2026 20:46
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: Make the synthetic signals closer to real ones and free of units

1 participant