Skip to main content

nDspec

Docs

Multi-dimensional X-ray data modelling in Python

nDspec is a software package designed to model (primarly) X-ray astronomical data; in particular, it is meant to enable users to fit spectral, timing and (in the future) polarimetric data natively. Currently, nDspec provides the following features:

  • a class to handle folding an energy-dependent model through a given X-ray instrument response matrix. We currently support any mission which provides OGIP-compatible data and responses.

  • Classes to handle the standard spectral-timing data products (power spectra, two-dimensional cross spectra, as well as their one-dimensional projections like lag-frequency spectra). Models need to be defined by the user either in the time domain (ie, an impulse response function) or in the Fourier domain (ie, a transfer functions). Additive models can be combined by the users before computing a given Fourier product.

  • Classes to handle standard spectro-polarimetric analysis. Models need to be defined by the user in units of Stokes I, Q and U parameters.

  • A class to handle arbitrary two-dimensional data consisting of real numbers. The data may or may not be energy dependent.

  • A small library of phenomenological spectral-timing-polarimetric models, currently including a one dimensional power-law, black body and gaussian, as well as example impulse response and/or transfer functions that parametrize the time dependence of these components.

  • A complementary library, xspectrampoline, which exposes the full library of compiled Xspec models without requiring a HEASOFT installation.

The goal of the software is to provide users with a modular package that can move the community beyond simple one-dimensional spectral fitting. Being an open-source modular package, unlike legacy software nDspec allows users to interface with data science libraries for model handling or fitting.

Documentation

The software documentation, including installation instructions, tutorials, and the full API, is found on readthedocs. You can also find notebooks discussing the features of each class in the /notebooks/ folder.

Installation and testing

The stable version of the software can be installed via pip; if you want to use (or contribute to!) features that are still in-developement, you should install the software directly from the repository. Unit tests make use of py.test. Running the unit tests simply requires opening the folder in which users downloaded the repository, and running the command pytest in the command line.

Contributing

nDspec is a fully open source software, so we welcome your contribution and feedback! The best way to contact the developers is through the issues page - even a simple comment on what you find useful or intuitive (or vice versa) goes a long way in helping the project. If you would like to contribute a piece of code, you are welcome to do so either by opening an issue or submitting a pull request. Before you do so, you should read the code of conduct and coding conventions.

Citing

If you use nDspec in your work, please cite the following:

@ARTICLE{2026A&A...712A.225L,
       author = {{Lucchini}, Matteo and {Ricketts}, Benjamin and {Uttley}, Phil and {Huppenkothen}, Daniela},
        title = "{nDspec: A new Python library for modelling multi-dimensional datasets in X-ray astronomy}",
      journal = {\aap},
     keywords = {methods: data analysis, X-rays: general, High Energy Astrophysical Phenomena, Instrumentation and Methods for Astrophysics},
         year = 2026,
        month = aug,
       volume = {712},
          eid = {A225},
        pages = {A225},
          doi = {10.1051/0004-6361/202558521},
archivePrefix = {arXiv},
       eprint = {2512.10615},
 primaryClass = {astro-ph.HE},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2026A&A...712A.225L},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

License

All content © 2023 The Authors. The code is distributed under the MIT license; see LICENSE for details.

Metadata

Release files for ndspec 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ndspec 1.0.0
File Size Uploaded Provenance Actions
ndspec-1.0.0.tar.gz 35.1 MB With provenance Details for ndspec-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ndspec 1.0.0
File Interpreter ABI Platform Actions
ndspec-1.0.0-py3-none-any.whl Python 3 none any Details for ndspec-1.0.0-py3-none-any.whl

Total release size: 70.2 MB

Release files / ndspec-1.0.0.tar.gz

Download URL ndspec-1.0.0.tar.gz
Size 35.1 MB
Tags Source
SHA-256 checksum
How to use checksums
f14b797df599f1c48f66765a815c4122ec4d416545a0526c9639bae776732b12
BLAKE2b-256 checksum
How to use checksums
c6ff3063257a4bad97aabeea492ce3e5e9fbddb872165f6fa2b2e2f701c59264
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 28, 2026.

Transparency log

Release files / ndspec-1.0.0-py3-none-any.whl

Download URL ndspec-1.0.0-py3-none-any.whl
Size 35.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dda973358dfbc6bcd237f397935bf22a83a30ddf5ad36c8021ce916ddd3fa94a
BLAKE2b-256 checksum
How to use checksums
02540417fe1bc5d5f4cccc362a769fdaf20340db241a5db946c5424a83677d2c
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 28, 2026.

Transparency log

Security for ndspec 1.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.

Select from 2 files

Attestation for ndspec-1.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 28, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page