/** Options for {@link findPeaks}. */ export interface FindPeaksOptions { /** Minimum peak value to keep. */ height?: number; /** Minimum index separation between kept peaks (greedily keeps the taller peak). */ distance?: number; /** Minimum topographic prominence to keep (see {@link peakWidths} for the definition). */ prominence?: number; } /** * Find strict local-maxima peak indices in `x` (`x[i-1] < x[i] > x[i+1]`), then * optionally filter by minimum `height`, minimum index `distance` (greedily keeping * the taller peak of any too-close pair), and/or minimum topographic `prominence` — * `scipy.signal.find_peaks`. * * @param x - Input signal * @param opts - `{ height?, distance?, prominence? }` * @returns Ascending indices of the surviving peaks */ export declare function findPeaks(x: readonly number[], opts?: FindPeaksOptions): number[]; /** * Width (in samples) of each peak at `relHeight` down from the peak toward its * topographic base (see {@link peakProminence}), with linearly-interpolated crossing * points — `scipy.signal.peak_widths`. * * @param x - Input signal * @param peaks - Peak indices (e.g. from {@link findPeaks}) * @param relHeight - Fraction of the prominence to descend (default 0.5, i.e. FWHM-style) * @returns Width per peak, same order as `peaks` */ export declare function peakWidths(x: readonly number[], peaks: readonly number[], relHeight?: number): number[]; /** Options shared by {@link csd} and {@link coherence}. */ export interface CsdOptions { /** Segment length (default `min(256, x.length, y.length)`). */ nperseg?: number; /** Samples of overlap between segments (default `floor(nperseg/2)`). */ noverlap?: number; /** Window applied to each segment (default `'hann'`) — see {@link windowFunction}. */ window?: string; /** Sample rate in Hz, used to scale frequencies and power (default 1). */ fs?: number; } /** * Cross-spectral density of `x` and `y` via Welch's overlapped-segment-averaging * method (segment, window, FFT, average `X·conj(Y)`) — `scipy.signal.csd`. * * @param x - First signal * @param y - Second signal * @param opts - `{ nperseg?, noverlap?, window?, fs? }` * @returns `{ frequencies, power }` — `power` is the magnitude of the averaged * cross spectrum at each frequency bin */ export declare function csd(x: readonly number[], y: readonly number[], opts?: CsdOptions): { frequencies: number[]; power: number[]; }; /** * Magnitude-squared coherence between `x` and `y`: `|Pxy|² / (Pxx·Pyy)`, per Welch * frequency bin — `scipy.signal.coherence`. Values lie in `[0, 1]`. * * @param x - First signal * @param y - Second signal * @param opts - `{ nperseg?, noverlap?, window?, fs? }` * @returns `{ frequencies, coherence }` */ export declare function coherence(x: readonly number[], y: readonly number[], opts?: CsdOptions): { frequencies: number[]; coherence: number[]; }; /** Options for {@link stft} / {@link istft} — must match between the two calls. */ export interface StftOptions { /** Frame length (default 256). */ nperseg?: number; /** Samples of overlap between frames (default `floor(nperseg/2)`). */ noverlap?: number; /** Window applied to each frame (default `'hann'`) — see {@link windowFunction}. */ window?: string; } /** `stft`'s output: one row per frame, one column per (non-redundant-truncated) frequency bin. */ export interface StftResult { re: number[][]; im: number[][]; } /** * Short-time Fourier transform: windowed, overlapping frames, each FFT'd independently * — `scipy.signal.stft` (magnitude/phase convention; frames are not scaled). * * @param x - Input signal * @param opts - `{ nperseg?, noverlap?, window? }` * @returns `{ re, im }`, each `number[frame][bin]` */ export declare function stft(x: readonly number[], opts?: StftOptions): StftResult; /** * Inverse short-time Fourier transform via overlap-add: each frame is inverse-FFT'd * back to `nperseg` samples, re-windowed, and accumulated; the accumulation is * normalized by the running sum of squared window values (the standard * constant-overlap-add / COLA normalization), so reconstruction is exact in the * interior wherever the window's overlap sum is nonzero — `scipy.signal.istft`. * * @param S - `{ re, im }` as returned by {@link stft} * @param opts - `{ nperseg?, noverlap?, window? }` — must match the `stft` call * @returns Reconstructed signal */ export declare function istft(S: StftResult, opts?: StftOptions): number[]; /** * Downsample `x` by an integer factor `q`: apply a Butterworth anti-alias lowpass * (order 4, cutoff `min(0.8/q, 0.99)` of Nyquist) with zero-phase `filtfilt`, then * take every `q`-th sample — `scipy.signal.decimate` (IIR mode). * * @param x - Input signal * @param q - Downsampling factor (positive integer) * @returns Downsampled signal, length `ceil(x.length / q)` */ export declare function decimate(x: readonly number[], q: number): number[]; //# sourceMappingURL=spectral-peaks.d.ts.map