Skip to main content

Spectrum class that overloads operators.

Project description


Say Thanks! PyPI versionUpdatesPython 3

Documentation Status Build Status Coverage Status Codacy BadgeTest Coverage Code ClimateIssue Count


The purpose of this was project was to learn how to use and create Classes, and to create a Spectrum object to use within my Phd work.

The main goals of this project are basically complete.

  • create a class to contain spectrum
  • automatic interpolation
  • overloaded operators especially
  • Spectral division (spectrum_A / spectrum_B )
  • Spectral subtraction (spectrum_A - spectrum_B)
  • Powers/exponents (spectrum ** x)

Further documentation can be found on read the docs.

When the spectra have different wavelength vectors spectrum_overload interpolates
to the wavelength of the first spectrum. This may not suit your requirements.



pip install spectrum-overload

git / manual

Currently to install and use Spectrum class for your own projects.

clone the git repository where you want it then type:

git clone
cd spectrum_overload
python install

or python develop if you want to make changes.


To use import the class using :

from spectrum_overload import Spectrum
my_spectrum = Spectrum(flux, xaxis)

or :

from spectrum_overload.spectrum import Spectrum as spec
my_spectrum = spec(flux, xaxis)

or however else you would like to name it.

A tutorial is provided here to show an example of how to use this class.


Contributions are very welcome.

I would really appreciate user feedback or suggested improvements if you have any.

Feel free to submit issues or create pull requests.

Python 2.7

Python 2.7 is only supported in versions <0.2.1 (also available on pip) to make use of useful python3 features.

Other Spectrum Classes

There are many other spectrum classes around but I didn't see any that overload the operators. (I could be blind).

One of these may better suit your needs

Wow A lot. I probably should not reinvent the wheel too much then...

It turns out that astropy/specutils is very similar to what I have created but its direction is uncertain at the moment and they do not use overloaded operators and will not implement in the foreseeable future.


Some tasks still to do:

  • Improve Documentation
  • Generate Calibration solution (outside spectrum class)?

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spectrum_overload-0.3.tar.gz (858.0 kB view hashes)

Uploaded Source

Built Distribution

spectrum_overload-0.3-py3-none-any.whl (286.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page