GSPICE
Survey spectra contain pixels that you cannot trust, such as cosmic rays, hot columns and pixels that the pipeline masked. GSPICE learns from your own spectra how the pixels vary together, and predicts any pixels from the others, with an uncertainty.
The figure shows one test spectrum of the example below. Pixels 80 to 109 are masked, and the orange line is their prediction by infill.
Install
pip install git+https://github.com/joshspeagle/GSPICE
Install gives the requirements and the other ways to install GSPICE.
Example
The example simulates spectra, fits a model to them, and predicts a range of pixels that it masks.
import numpy as np
import gspice
rng = np.random.default_rng(2026)
train = gspice.simulate(3000, 200, rng=rng)
test = gspice.simulate(5, 200, rng=rng)
model, _ = gspice.fit(train.flux, train.ivar)
mask = np.zeros(test.flux.shape, dtype=bool)
mask[:, 80:110] = True
result = gspice.infill(model, test.flux, test.ivar, mask=mask)
print(f"{result.replaced.sum()} pixels replaced")
Quickstart explains each step.
Documentation
The documentation is at joshspeagle.github.io/GSPICE. Start with Quickstart, Install and the first guide, Fill known bad pixels. The API reference documents every public name, and CHANGELOG.md lists the changes since the 2022 package.
The 2022 package
gspice.legacy keeps the 2022 functions, with their signatures and results: see Legacy interface. The 2022 names at the top level of gspice, such as gspice.gp_interp, are deprecated. Migrate from the 2022 package gives their replacements and the units of their outputs, and CHANGELOG.md lists the behaviour changes of gspice.legacy.
Citation
The method is in Finkbeiner, Speagle & Karim, arXiv:2511.16754. Cite GSPICE gives the BibTeX entry and the data to cite for the worked example. The IDL and Julia implementations, notebooks and notes of 2021 and 2022 are in the upstream repository dfink/gspice.
Metadata
Release files for pygspice 2.0.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 |
|---|---|---|---|---|
| pygspice-2.0.0.tar.gz | 6.3 MB | With provenance | Details for pygspice-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygspice-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for pygspice-2.0.0-py3-none-any.whl |
Total release size: 6.4 MB
Release files / pygspice-2.0.0.tar.gz
| Download URL | pygspice-2.0.0.tar.gz |
|---|---|
| Size | 6.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
958750a975d997da99bd455978f0668e8d1250be4c345ff5a5875654873b6072
|
|
BLAKE2b-256 checksum How to use checksums |
d6c46e806673f4158475a075e44e2bda720d060a7ee2eef5bc8c8e81698c9e7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 / pygspice-2.0.0-py3-none-any.whl
| Download URL | pygspice-2.0.0-py3-none-any.whl |
|---|---|
| Size | 96.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87d188e2ede96b23bb2be5e3c38ba127bfbd5677e71511e8da141ccf916acb79
|
|
BLAKE2b-256 checksum How to use checksums |
2a618b3f3a8a6c3c95c77831f6aa7671048d94fa671f8ba321f709c95c10257f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 pygspice 2.0.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
Both files in this release have been uploaded with provenance metadata.
Attestation for pygspice-2.0.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.