RADAR
Raman spectral Analysis using Deep learning for Artifact Removal.
RADAR splits Raman spectra into four additive components with convolutional neural networks:
spectrum = baseline + cosmic rays + noise + peaks
- Baseline: smooth background (fluorescence, etc.)
- Cosmic rays: narrow spikes
- Noise: random noise
- Peaks: the Raman bands, i.e. the corrected, denoised spectrum
The package contains:
- Two pre-trained networks, standard and ensemble, each trained on 240 million synthetic spectra.
- Training and evaluation tools: a synthetic data generator for training and testing, training and fine-tuning routines, and evaluation metrics (RMSE, MAE, max error, R²).
- File I/O for the common Raman formats: SPC, JCAMP-DX, Renishaw WDF, Horiba LabSpec, TriVista, text exports, Excel, Parquet, SQLite, HDF5, MATLAB, JSON and NumPy.
- Interfaces: a command-line tool.
Installation
cd RADAR
pip install . # core
pip install ".[formats]" # + Excel / Parquet / Feather
pip install ".[renishaw]" # + Renishaw .wdf
pip install -e ".[dev]" # everything, for development
Requires Python ≥ 3.9 and TensorFlow ≥ 2.16 (Keras 3). Check the installation
with radar-raman info.
Quick start
import radar_raman
comps = radar_raman.decompose("spectra.spc") # file (any supported format) or NumPy array
comps.baseline, comps.cosmic_rays, comps.noise, comps.peaks
comps.plot(0)
comps.save("spectra_components.h5") # .csv .xlsx .parquet .db .mat .json .spc .jdx ...
The API in eight functions
radar_raman.decompose(spectra, model="ensemble", output=None) # array / file -> Components
radar_raman.read(path) # any format -> SpectralData
radar_raman.write(obj, path) # spectra, components or data sets
radar_raman.formats(show=True) # supported formats
radar_raman.load_model("ensemble") # pre-trained or saved model
radar_raman.train(data=None, model="ensemble", init=None, save_to="my.keras", epochs=..., ...)
radar_raman.generate(1000) # synthetic spectra with ground truth
radar_raman.evaluate(model, test_set) # RMSE, MAE, max error, R²
Saved models record the RADAR, Keras and TensorFlow versions they were made
with: radar_raman.model_info("my.keras", show=True) or radar-raman info my.keras.
Supported file formats
| Read and write | Read only |
|---|---|
| CSV / TSV / TXT (incl. instrument exports, decimal commas), Excel, Parquet, Feather, SQLite, HDF5 / NetCDF-4, NumPy, MATLAB, JSON, Thermo Galactic SPC, JCAMP-DX | Renishaw WDF, Horiba LabSpec XML, Princeton TriVista TVF, RRUFF |
Instrument text exports from Renishaw WiRE, Horiba LabSpec, Ocean Insight,
WITec and RRUFF are recognised automatically. Raman maps keep their grid
shape (comps.as_map("peaks"), comps.band_image(990, 1010)).
Command line
radar-raman decompose sample.wdf -o sample_components.h5
radar-raman decompose data/*.spc -o "results/{stem}.csv" -m standard
radar-raman convert measurement.spc measurement.jdx
radar-raman generate -n 1000 -o test.h5
radar-raman train -o my_model.keras --epochs 12 --steps 200000
radar-raman evaluate test.h5 -m my_model.keras --statistics
radar-raman formats
Documentation
| User guide | everything in one place: installation, reading, decomposing, saving, models, training, fine-tuning, synthetic data, evaluation, CLI, troubleshooting |
| Models | the two architectures and the pre-trained weights |
| Synthetic data | the data generator |
| Command line | all commands and options |
| API reference | functions and classes |
| Differences from the original code | what changed and why |
To build the HTML documentation: pip install ".[docs]" && mkdocs serve.
Examples
| Script | Shows |
|---|---|
examples/01_quickstart.py |
decompose, derived spectra, save, plot |
examples/02_decompose_file.py |
read a CSV, both models, save and reload, compare with ground truth |
examples/03_generate_data.py |
synthetic training and test data |
examples/04_train_new_model.py |
train from scratch, checkpoint, save, reload, evaluate (--full for the complete schedule) |
examples/05_finetune_pretrained.py |
fine-tune a pre-trained model |
examples/06_compare_models.py |
standard vs ensemble: RMSE, MAE, max error, R² |
examples/07_original_weights.py |
load weight files written by the original training scripts |
examples/08_file_formats.py |
formats, maps, band images, conversion, SQL queries |
Tests
pip install -e ".[test,formats,renishaw]"
pytest # full suite
pytest -m "not slow" # skip the training tests
The suite checks that the networks reproduce the outputs of the original
implementation (to within 1e-5), and that every writable format round-trips.
Optional tests on real instrument files run when RADAR_SAMPLE_DATA points to
the public test data of the SPC, JCAMP-DX and rosettasciio projects (see
tests/test_formats.py).
How to cite
If you use RADAR, please cite the software:
Sjöberg, J., & Oancea, B. (2026). RADAR: Raman spectral Analysis using Deep learning for Artifact Removal (Python package) (Version 0.1.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.23760379
radar_raman.citation() prints the references, and
CITATION.cff has them in machine-readable form (GitHub's
"Cite this repository" button uses it).
Licence and credits
BSD 3-Clause, see LICENSE. The networks, the synthetic data generator and the pre-trained weights come from the original implementation by Joel Sjöberg (repository). The Python package is by Bogdan Oancea. Both copyright notices must be kept in redistributions. See AUTHORS.md.
Optional readers: renishawWiRE (MIT) and rosettasciio (GPL-3.0) are
separate packages that RADAR uses only if you install them.
Metadata
Release files for radar-raman 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| radar_raman-0.1.0.tar.gz | 3.2 MB | With provenance | Details for radar_raman-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| radar_raman-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for radar_raman-0.1.0-py3-none-any.whl |
Total release size: 6.5 MB
Release files / radar_raman-0.1.0.tar.gz
| Download URL | radar_raman-0.1.0.tar.gz |
|---|---|
| Size | 3.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8710da8374e33e490c52b49280ada9ef533fe1690d8b2e8bdc451f0b4a1d2373
|
|
BLAKE2b-256 checksum How to use checksums |
6973ec459b4a4ef1c47eab999a201218ff51c634c045d1b98ac2bab2d519365a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / radar_raman-0.1.0-py3-none-any.whl
| Download URL | radar_raman-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44a5de8cbd60f56ad64f9f37e4bc2d5e9262d2b626d42c8c5fe154b7cad909db
|
|
BLAKE2b-256 checksum How to use checksums |
10eed622cd79946edc386afe5708c0a4cbd77da0713667b4a6c7adc1c5034f2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for radar-raman 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for radar_raman-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.