Coverage increase - #78
Merged
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improvements to the
pyhctsacoverage 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 TISEANpoincare)stepdetect(native Python port of Max Little'sl1pwc)l1pwc_sweep_lambda(native Python port of Max Little'sl1pwc)local_densityGP_FitAcross(native Python port of thegpmlpackage)GP_Local_Prediction(native Python port of thegpmlpackage)TISEAN_d2(Python wrapper for the TISEANd2)MMA(native Python port of the Physionet multiscale multifractal analysis /MMA)Other changes:
periodogramestimation method. Several features which were missing from thepyhctsaimplementation ofspectral_summarieshave been added and verified against the MATLAB ground truth.periodicity_wangaccording to the recent changes in Catch22 here.requirements.txtStats:
Number of master operations has increased from 773 to 791 (~ 2.3% increase)
Total feature count has increased from 4605 to 5270 (~ 14% increase)