ewoksxas.tasks.tests.test_lca#
Tests for the LinearCombinationAnalysis task.
The task wraps ewoksxas.fit.lca_fit.LCAModel: it reads sample and component Orange Tables, fits each sample as a non-negative linear combination of the components, and writes three tables (Transformed_Data, Data, Components).
Following fit/tests/test_lca_fit.py, the samples here are exact linear combinations of known components, so the recovered weights, the fit quality (rmse ~ 0, r2 ~ 1) and the reconstructed spectrum are all known in advance. test_lca_outputs_match_direct_fit additionally checks the task reproduces a direct LCAModel.fit() on the same data, i.e. it is a faithful wrapper.
Functions
|
|
|
Five linearly independent components, mirroring fit/tests/conftest.py. |
|
A single sample that is an exact linear combination of the components. |
|
component_identifier selects the human-readable name for each component. |
C-keys are numbered by component row order (positional, collision-free). |
|
Each C-key weight meta on the Data table carries its display name. |
|
Issue #40: components sharing a Scan Name still get distinct C-keys. |
|
|
Irrelevant extra components are fitted with ~zero weight. |
|
exclude_components drops the keyed (C-key) components from every table. |
|
Each sample is fitted independently; the tables grow accordingly. |
|
normalize=True scales each solution to sum to one. |
The three output tables have the expected orientation and metas. |
|
Task outputs reproduce a direct LCAModel.fit() on the same data. |
|
|
Sample metas (Scan Name) are carried into the Data and Transformed_Data tables. |
The fitted weights, fit quality and model spectrum are all recovered. |
|
|
xmin/xmax restrict the fit to a region of interest. |
Two samples sharing a Scan Name no longer crash the Components table. |
|
|