A lightweight, heavily annotated FastICA implementation for educational and local waveform separation demos.
Project description
nGene FastICA
A lightweight, heavily annotated FastICA implementation for educational signal separation and local waveform separation demos.
This package keeps the FastICA engine simple and local. Version 0.1.2 restores and expands the human-readable explanatory comments around the core algorithm so that the code can be studied as an educational implementation, not only used as a black-box function.
What this package does
Fast Independent Component Analysis (FastICA) separates observed mixed signals into estimated independent source components. Typical examples include synthetic waveform separation, auditory signal demos, and educational blind-source-separation experiments.
Input shape convention:
(n_signals, n_samples)
Rows are observed mixtures and columns are sample points.
Install locally during development
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -e .
Basic usage
import numpy as np
from ngene_fastica import FastICA
# Shape convention: rows are observed mixtures, columns are samples.
X = np.random.randn(3, 10000)
S = FastICA(n_components=3, random_state=42).fit_transform(X)
print(S.shape)
Backward-compatible usage
The original educational script used num_sources, max_iterations, tolerance, and decompose_mixtures(). These names are supported as aliases:
from ngene_fastica import FastICA
ica = FastICA(num_sources=3, max_iterations=500, tolerance=1e-5, random_state=42)
source_signals = ica.decompose_mixtures(signal_mixtures)
Local waveform separation demo
After local installation:
ngene-fastica-demo
The demo writes WAV files for generated sources, mixed signals, and separated signals. ICA recovers sources up to permutation and sign, so the separated files may not match the original source order exactly.
Educational notes in the source code
The core implementation in src/ngene_fastica/fastica.py now includes step-by-step explanatory comments for:
- input shape convention;
- centering;
- covariance estimation;
- eigenvalue decomposition;
- whitening;
- random unmixing-matrix initialization;
- fixed-point FastICA iteration;
tanhnon-linearity and derivative;- symmetric decorrelation by SVD;
- sign-invariant convergence;
- final source extraction through
components_.
Notes
- Input shape is
(n_signals, n_samples). - The implementation uses NumPy only; SciPy is not required.
- This is intended as a lightweight educational/demo package, not a replacement for mature scientific packages.
- ICA output has sign and permutation ambiguity by design.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ngene_fastica-0.1.2.tar.gz.
File metadata
- Download URL: ngene_fastica-0.1.2.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87baf1733395a39e52104f4715d068d783833cd7c65c6a40e76b461324fb94dc
|
|
| MD5 |
56f1eb7d85be852a5536a8adc03546fa
|
|
| BLAKE2b-256 |
6669b4e25ca3fd68effdd078e95b8ad44613ecdc86c3b440faf1c50a5b89ade3
|
File details
Details for the file ngene_fastica-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ngene_fastica-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0f4d3a4e7312faf4d149b975028b7d5fd6fde6757510000e237f57bbaee5bd9
|
|
| MD5 |
93fc078d14ed8d03d918acb2cb370da5
|
|
| BLAKE2b-256 |
8138ddbadb110cb4cc7e1859bb8cfc7546fe6ca65597111010ea43ba30473534
|