Skip to content

Coverage increase - #78

Merged
joshuabmoore merged 46 commits into
mainfrom
coverage-increase
Aug 15, 2026
Merged

Coverage increase#78
joshuabmoore merged 46 commits into
mainfrom
coverage-increase

Conversation

@joshuabmoore

@joshuabmoore joshuabmoore commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Improvements to the pyhctsa coverage with 8 new operations added, including several nonlinear and gaussian-process (GP)-based features. In each case, functions were validated against their MATLAB counterparts:

  • poincare_section (Python wrapper for the TISEAN poincare)
  • stepdetect (native Python port of Max Little's l1pwc)
  • l1pwc_sweep_lambda (native Python port of Max Little's l1pwc)
  • local_density
  • GP_FitAcross (native Python port of the gpml package)
  • GP_Local_Prediction (native Python port of the gpml package)
  • TISEAN_d2 (Python wrapper for the TISEAN d2)
  • MMA (native Python port of the Physionet multiscale multifractal analysis / MMA)

Other changes:

  • Updates to spectral_summaries with the addition of the periodogram estimation method. Several features which were missing from the pyhctsa implementation of spectral_summaries have been added and verified against the MATLAB ground truth.
  • Optimised periodicity_wang according to the recent changes in Catch22 here.
  • Dropped requirements.txt
  • Updates to documentation including a revamp of the time-series analysis methods landing page grid layout with icons.

Stats:
Number of master operations has increased from 773 to 791 (~ 2.3% increase)
Total feature count has increased from 4605 to 5270 (~ 14% increase)

joshuabmoore and others added 30 commits August 6, 2026 09:16
`entropy._embed`, `nonlinearity._time_delay_embed` and `correlation._lag_embed`
were three copies of the same construction. The first two produce exactly equal
arrays; `_lag_embed` is the same embedding with its columns reversed.

Replace all three with `utils.time_delay_embed(y, m, tau, reverse=False)`.

The copies disagreed on how they signalled an over-short series: two raised
ValueError, `_lag_embed` logged a warning and returned a bare nan, which forced
`time_rev_kaplan` to test its result with `np.isscalar`. The shared helper always
raises; `time_rev_kaplan` now catches and emits the same warning and nan as
before.

Verified bit-identical over 192 results spanning permutation_entropy,
approximate_entropy, sample_entropy, embed_pca, local_density and
time_rev_kaplan, across four series types and their parameter grids.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`distribution._prctile` was a third implementation of the quantile already
provided by `utils.matlab_quantile` (and by numpy's 'hazen' method). Verified
zero maximum absolute difference against both across a range of percentages.

Its one caller, `outlier_test`, now takes both bounds from a single
`matlab_quantile` call; a stale comment noting the numpy equivalent goes with it.

Verified bit-identical over the 192-result baseline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`_stat_av` reimplemented the subset of `sliding_window` covering window_stat in
{'mean','std'} with across_win_stat='std'; its nested `get_window` was a
byte-for-byte copy of `stationarity._get_window`. Verified bit-identical output
across both statistics and several segmentations.

Its six call sites in `translate_shape` collapse to a loop over num_seg. The
import is function-local because stationarity already imports from this module,
so a top-level import would close the cycle -- the same approach information.py
uses for its correlation imports.

Verified bit-identical over 40 full translate_shape outputs (5 series x 2 shapes
x 4 offsets, including a too-short series that exercises the degenerate-window
warning), with output key order unchanged, plus the 192-result baseline.

Note: translate_shape cannot run on the installed numpy 1.26 at all, because it
calls np.unique_counts (added in numpy 2.0) while pyproject.toml declares
numpy>=1.24. That is a pre-existing bug, untouched here; the verification above
shimmed the function in the test harness only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Zero references anywhere in the package, tests, configs or docs. Its behaviour
remains reachable via first_min(y, 'mi-gaussian').

This deletion was already present as an uncommitted working-tree edit; committing
it here as the last item of the Tier A dedupe.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`np.unique_counts` was added in numpy 2.0, but pyproject.toml declares
numpy>=1.24, so translate_shape raised AttributeError on every call for any
environment inside the supported range (including the numpy 1.26 used here).

Use np.unique(..., return_counts=True), which is equivalent and available across
the whole declared range.

Verified against the previous behaviour by shimming np.unique_counts onto the
pre-fix code: 40 full translate_shape outputs (5 series x 2 shapes x 4 offsets)
are bit-identical, and the fixed version now runs unshimmed on numpy 1.26.
Also swept the package for other APIs that straddle the 1.x/2.0 boundary in
either direction; none remain.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@joshuabmoore
joshuabmoore merged commit 430b72e into main Aug 15, 2026
32 checks passed
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.

1 participant