Skip to content

[Autoloop: build-tsb-pandas-typescript-migration] Iteration 387: Add signal processing and digital filters#363

Open
github-actions[bot] wants to merge 14 commits into
mainfrom
autoloop/build-tsb-pandas-typescript-migration
Open

[Autoloop: build-tsb-pandas-typescript-migration] Iteration 387: Add signal processing and digital filters#363
github-actions[bot] wants to merge 14 commits into
mainfrom
autoloop/build-tsb-pandas-typescript-migration

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

This PR adds two new signal processing modules to src/stats/:

signal.ts — FFT, STFT, Welch PSD

  • FFT/IFFT/RFFT/IRFFT: Cooley-Tukey radix-2 DIT iterative algorithm (non-power-of-2 inputs zero-padded)
  • Frequency utilities: fftFreq, rfftFreq, fftshift, ifftshift
  • Window functions: rectangular, bartlett, hann, hamming, blackman, blackmanharris, flattop, kaiser + getWindow factory
  • STFT/ISTFT: overlap-add reconstruction, configurable window/hop
  • Welch PSD: mean/median averaging, one-sided/two-sided output
  • Periodogram: standard power spectral density estimate

filters.ts — FIR, Butterworth IIR

  • firwin: FIR filter design via windowed-sinc (lowpass/highpass/bandpass/bandstop)
  • butter: Butterworth IIR design in SOS form (lowpass/highpass/bandpass/bandstop)
  • Frequency response: freqz (single-section), sosfreqz (SOS cascade)
  • Filter application: lfilter (causal), filtfilt (zero-phase, double-pass), sosfilt, sosfiltfilt

Files Changed

  • src/stats/signal.ts — new (~600 lines)
  • src/stats/filters.ts — new (~450 lines)
  • tests/stats/signal.test.ts — new (~300 lines, unit + property-based)
  • tests/stats/filters.test.ts — new (~280 lines, unit + property-based)
  • playground/signal.html — new interactive tutorial
  • playground/filters.html — new interactive tutorial
  • src/stats/index.ts, src/index.ts — updated exports
  • playground/index.html — feature cards added

Metric

183 → 185 (+2 TypeScript source files with exports)


Generated by Autoloop — Iteration 387
Run: https://github.com/githubnext/tsb/actions/runs/28396990118

Generated by Autoloop · ● 85.2M ·

…signal processing (FFT/STFT/Welch) and digital filters (FIR/Butterworth)

- src/stats/signal.ts: Cooley-Tukey radix-2 DIT FFT/IFFT/RFFT/IRFFT,
  fftFreq/rfftFreq, fftshift/ifftshift, 8 window functions (getWindow),
  STFT/ISTFT (overlap-add), Welch PSD (mean/median), periodogram.
  Mirrors numpy.fft + scipy.signal spectral utilities.
- src/stats/filters.ts: FIR design via windowed-sinc (firwin), Butterworth
  IIR design (butter, SOS form), frequency response (freqz, sosfreqz),
  filter application (lfilter, filtfilt, sosfilt, sosfiltfilt).
  Mirrors scipy.signal filter utilities.
- tests/stats/signal.test.ts: 50+ tests (unit + property-based)
- tests/stats/filters.test.ts: 50+ tests (unit + property-based)
- playground/signal.html, playground/filters.html: interactive tutorials
- playground/index.html, src/stats/index.ts, src/index.ts: updated exports

Metric: 183 → 185 (+2)

Run: https://github.com/githubnext/tsb/actions/runs/28396990118

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ORC file format I/O (readOrc / toOrc)

Implement Apache ORC (Optimized Row Columnar) file format reader and writer.

- src/io/orc.ts: Full ORC implementation (~1200 lines)
  - Protobuf decoder/encoder (LSB-first varints, wire types 0/1/2/5)
  - Hadoop VInt reader/writer (MSB-first big-endian, Hadoop-style encoding)
  - RLE byte v1 encoder/decoder (PRESENT/BOOLEAN streams)
  - RLE integer v1 encoder/decoder (INT/LONG columns)
  - Column encoders: BOOLEAN, INT/LONG, FLOAT/DOUBLE, STRING
  - Full null support via ORC PRESENT stream
  - readOrc(data, options) and toOrc(df, options) exported functions
- tests/io/orc.test.ts: Comprehensive test suite with fast-check property tests
- playground/orc.html: Interactive tutorial page

Metric: 185 → 186

Run: https://github.com/githubnext/tsb/actions/runs/28429568433

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor Author

Commit pushed: 4bc79cc

Generated by Autoloop · ● 81.8M

@mrjf mrjf added the evergreen Persistent opt-in: Evergreen keeps this PR green/mergeable until ready or quota exhausted label Jul 2, 2026
- Fix filters.ts: out[i+j] possibly-undefined compound assignment
- Fix signal.ts: exactOptionalPropertyTypes violation in periodogram call
- Fix orc.ts: use fromColumns({index:}) instead of df.setIndex(new Index())
- Fix orc.ts: df.height -> df.shape[0] (height does not exist on DataFrame)
- Fix orc.test.ts: rt.height -> rt.shape[0]
- Fix orc.test.ts: wrap SharedArrayBuffer in Uint8Array before readOrc
- Fix filters.test.ts: add SOSSection type annotation instead of as const
- Remove unused Index import from orc.ts
- Convert playground/signal.html to use playground-runtime.js
- Convert playground/filters.html to use playground-runtime.js

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Commit pushed: ae5012c

Generated by Evergreen Orchestrator · 3K AIC · ⌖ 54.4 AIC · ⊞ 29.6K

@github-actions github-actions Bot added the evergreen-ready Evergreen believes configured merge gates are satisfied label Jul 2, 2026
…ACF/PACF, CCF, Durbin-Watson, Ljung-Box, Box-Pierce

Run: https://github.com/githubnext/tsb/actions/runs/28574601568

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Commit pushed: d1cd215

Generated by Autoloop · 2.7K AIC · ⌖ 37.4 AIC · ⊞ 51.8K

…ARIMA(p,d,q) model and Apache Avro OCF I/O

- src/stats/arima.ts: ARIMA(p,d,q) via Hannan-Rissanen two-step estimation
  (Yule-Walker AR init, OLS with proxy residuals, ψ-weight forecast CIs)
- src/io/read_avro.ts: Apache Avro OCF binary reader/writer
  (zigzag varint, all primitive/complex types, DataFrame integration)
- Tests: tests/stats/arima.test.ts, tests/io/read_avro.test.ts
- Playground: playground/arima.html, playground/avro.html
- Metric: 189 exported src files (was 187 on branch, best_metric=188)

Run: https://github.com/githubnext/tsb/actions/runs/28716959940

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Commit pushed: b56f92f

Generated by Autoloop · 3.7K AIC · ⌖ 58.2 AIC · ⊞ 51.8K

…Kalman filter & RTS smoother (state-space model)

Adds src/stats/kalman.ts with:
- KalmanFilter class: localLevel(), localLinearTrend() factories + custom constructor
- filter() — forward Kalman filter pass with missing-observation support
- smooth() — RTS (Rauch-Tung-Striebel) backward smoother
- kalmanFilter1D / kalmanSmooth1D convenience wrappers
- extractScalarMeans, extractScalarVariances, filteredPredictionInterval helpers
- StateSpaceModel alias for backward compat

Also adds comprehensive tests (75+ test cases, property-based with fast-check)
and an interactive playground page (playground/kalman.html).

Metric: 190 (previous best: 189, delta: +1)

Run: https://github.com/githubnext/tsb/actions/runs/28742188479

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Commit pushed: 758d4d5

Generated by Autoloop · 3.1K AIC · ⌖ 54.1 AIC · ⊞ 51.8K

…Exponential Smoothing / Holt-Winters ETS models

Implements statsmodels.tsa.holtwinters.ExponentialSmoothing API:
- SimpleExpSmoothing (SES / ETS(A,N,N)): level-only smoothing
- Holt (ETS(A,A,N) / ETS(A,Ad,N)): linear trend with optional damping
- ExponentialSmoothing (full Holt-Winters): additive/multiplicative
  trend and seasonal components, prediction intervals, AIC/BIC/AICc

Nelder-Mead simplex parameter optimisation, heuristic initialisation,
known initialisation support, forecastWithCI() with normal approximation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Commit pushed: cc88491

Generated by Evergreen Orchestrator · 3.3K AIC · ⌖ 126.3 AIC · ⊞ 29.9K

@mrjf mrjf marked this pull request as ready for review July 10, 2026 01:35
@github-actions github-actions Bot added evergreen_active Evergreen lease: a run is currently working this PR and removed evergreen_active Evergreen lease: a run is currently working this PR labels Jul 10, 2026
@mrjf mrjf removed the evergreen_active Evergreen lease: a run is currently working this PR label Jul 10, 2026
@github-actions github-actions Bot added the evergreen_active Evergreen lease: a run is currently working this PR label Jul 10, 2026
@mrjf mrjf removed the evergreen_active Evergreen lease: a run is currently working this PR label Jul 10, 2026
@github-actions github-actions Bot added evergreen_active Evergreen lease: a run is currently working this PR and removed evergreen_active Evergreen lease: a run is currently working this PR labels Jul 10, 2026
- src/stats/kalman.ts: fix filtCovs, predCovs, innovCovs, smoothCovs, gains
  declared as MutMat[][] (4-D) — should be MutMat[] (array of matrices)
- tests/stats/kalman.test.ts: change 'as [number][][]' → 'as number[][]'
  (tuple cast was incompatible with readonly (number|null)[][] parameter)
- tests/stats/acf_pacf.test.ts: fix Series construction to use { data: [...] }
  form (constructor only accepts SeriesOptions, not plain arrays)
- playground/filters.html, playground/signal.html: wrap scipy.signal import
  in try/except so examples skip gracefully when scipy is not installed in CI

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor Author

Commit pushed: 476eeaf

Generated by Evergreen · 1.9K AIC · ⌖ 13.1 AIC · ⊞ 36.7K

@github-actions github-actions Bot added evergreen_active Evergreen lease: a run is currently working this PR and removed evergreen_active Evergreen lease: a run is currently working this PR labels Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autoloop automation evergreen_active Evergreen lease: a run is currently working this PR evergreen Persistent opt-in: Evergreen keeps this PR green/mergeable until ready or quota exhausted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant