Repository navigation
Fixes post evan merge - #150
Merged
Merged
Conversation
Revert "Added formulas and tests (#144)" #147 added libemg/_feature_selection_metrics.py, a registry covering a strict superset of the metrics #144 put on OfflineMetrics: 34 codes against 25, adding rPU, rNS, rCE, rC, UD, TT, MAV, CA and AE. Nothing in the library called #144's methods -- the only reference anywhere was the test module added alongside them. #147's implementations also fix three defects those tests documented: * _get_KL_divergence hardcoded `term3 = 24` where the feature dimensionality belongs, so KLD went negative on low-dimensional data. #147 uses x.shape[1]. * get_IIF ended in an unguarded `num_sum / dnum_sum` and raised ZeroDivisionError on perfectly separable data. #147 has an explicit ratio() guard. * get_BD looped over the repetition-segment count where every sibling metric loops over the class count. #147 loops class by class. #147's tests are stronger too: closed-form values (SI == sqrt(3), MSA == sqrt(4/3), C == 0.75, rC == 5/6, CDM on XOR == 0) rather than the ordering assertions these had. Its docs also carry fuller attribution -- Nawfel 2021, the Nawfel 2020 thesis, Singh 2003 for PRISM and Kohn 1996 for CDM, each with a note on what remains unverified. Test fallout: * test_offline_metrics_extended.py keeps the regression-metric and extract_* coverage and drops the seven classes that exercised #144. * test_extension_contracts.py lowers its get_available_metrics() floor, which returns 14 again rather than 37. * test_extension_contracts.py now imports CLASSIFIER_MODELS and REGRESSOR_MODELS instead of parsing them out of a dict literal inside each __init__. #145-#148 moved them to module level, which broke the parser and with it collection of two test modules. * test_data_handler.py retires the strict xfail for a file shorter than the window: the _get_mode_windows rewrite in #145-#148 fixed it, so the marker had started failing as an unexpected pass. Verified that a 10-sample file now yields no windows and leaves metadata aligned. Remove setup.py; pyproject.toml is now the only build configuration. It was missing [build-system], authors, keywords, classifiers, license and a packages.find section, so the two files together were already dropping metadata: Keywords and Classifier were absent from the built distribution. Those are ported here, along with project URLs and the tests/docs/examples exclusion that find_packages(exclude=["*tests*"]) used to provide. The Development Status classifier also loses its trailing whitespace, which made it an invalid trove classifier that PyPI rejects on upload. Verified with python -m build and twine check: both artifacts pass, the wheel carries all 13 packages and the 17 libemg.resources choreography files, and nothing from tests/, docs/, examples/ or demos/ leaks in.
test_a_real_log_hands_a_child_what_it_needs_and_nothing_it_should_not_have constructed EventLog(path="unused.log"), and start() opens that path, so every run of the suite left an untracked unused.log in the working tree. The name suggests the path was expected never to be opened. Every other path-taking test in the module already builds its path from tmp_path; this one is brought in line.
…ge config
CI reported "all tests failing". In fact no tests ran at all.
tests/test_figure_release.py called matplotlib.use("TkAgg", force=True) at
module scope. On a headless runner that raises, which is a *collection* error,
and a single collection error aborts the whole pytest session. 2077 collected
tests never executed, coverage measured only import-time lines at 17.92%, and
--cov-fail-under=44 then failed the job. The backend switch and the tkinter
import are both guarded now, so the module skips where it cannot run. It is
about Tk's finalisation behaviour specifically, so skipping headless is the
correct outcome rather than something to work around.
Restore [tool.pytest.ini_options] and [tool.coverage.run], both of which went
missing in the #145-#148 merge:
* The marker registration went with them, which is why `download` and
`hardware` reported as unknown marks. The flags and skip logic behind them
live in tests/conftest.py and were never lost, so the markers still
worked -- they were just undeclared, and --strict-markers was gone too.
* The coverage omit list went with them. Vendor streamers and GUI panels
need a device or a display and are covered only by the import smoke test;
counting them makes the headline figure a measure of how much GUI code
exists. With the list restored, coverage is 66% rather than 18%.
Raise the coverage floor to 55, measured at 66%.
Regenerate tests/data/golden/: #147 fixed getCOMPfeat, which omitted axis=2 on
the fourth moment, so np.sum collapsed the entire batch to one scalar and
every window and channel was divided by the same global numerator -- one
window's data changed another window's feature, and the value depended on
whatever else was in the batch. COMP has no MATLAB reference, so the snapshot
was the only thing watching it. The numbers moved for a correct reason, so the
fixture is regenerated rather than the test relaxed.
Note in the workflow that the 3.10-3.12 matrix contradicts
requires-python = ">=3.13". It passes only because requirements.txt installs a
flat dependency list and never installs libemg itself, so pip never checks
requires-python. Which of the two should move is a support policy call and is
left open.
The run aborted with SIGABRT (exit 134) at 87%, in test_pipeline_training.py::test_the_editor_can_be_closed_and_reopened, inside dearpygui's show_viewport(). With no display DearPyGui calls abort() in native code, so the process dies outright and every remaining test goes with it. The three modules that do this already wrapped the call in `try/except Exception: pytest.skip(...)`, which cannot work -- there is no Python exception to catch. Add an opt-in `gui` marker alongside --slow / --download / --hardware, and apply it to the three modules that create a viewport: test_pipeline_training, test_streamer_panel and test_visualization_panel (49 tests). They are deselected per-PR and run in a new nightly job under xvfb-run, which gives them a real display so they genuinely execute rather than skip. Also add tests/conftest.py::requires_display() as a safety net for anyone running without a display and without xvfb. It has to check before the call, for the same reason the existing except clause did not help. The GUI tests that never create a viewport -- choreography, data collection, the pipeline editor's document and viewer panels -- are unaffected and still run per-PR. Coverage is 64% with the viewport modules deselected, against 66% with them, because libemg/_gui/* is omitted from the report anyway. The floor stays at 55.
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.
No description provided.