pyFDN.sample_delay_lengths#
- pyFDN.sample_delay_lengths(N, delay_range=(400, 1200), *, distribution='uniform', coprime=False, sort=False, rng=None)[source]#
Generate
Ndelay-line lengths in samples.Targets are drawn within
delay_rangeaccording todistributionand, whencoprimeis set, snapped to the nearest distinct, pairwise-coprime integers. A localnumpy.random.Generatoris used so passing an integer seed (or generator) makes the result reproducible without touching NumPy’s global random state.- Parameters:
N (
int) – Number of delay lines.delay_range (
tuple[int,int]) – Inclusive(low, high)range in samples.distribution (
str) –Sampling distribution for the delay lengths:
"uniform"– flat in linear space."geometric"– flat in log space (log-uniform), i.e. geometrically spaced with equal probability per octave."lognormal"– Gaussian in log space, centred on the geometric mean of the range. The range span roughly ±2 sigma.
coprime (
bool) – WhenTrue, snap the sampled values to the nearest distinct, pairwise-coprime integers. Coprime delays avoid coinciding echoes and degenerate modes; snapping may nudge values slightly outsidedelay_range.sort (
bool) – Sort the returned delays in ascending order.rng (
Generator|int|None) – Local NumPy generator or integer seed.
- Return type:
- Returns:
Integer array of shape
(N,)with the delay lengths in samples.
Example:
sample_delay_lengths(8) # uniform, may repeat sample_delay_lengths(8, (500, 4000), distribution="geometric") sample_delay_lengths(8, (500, 4000), distribution="lognormal", coprime=True)