SpectRes - simple spectral resampling in Python.

When I started my PhD I quickly came up against the problem of resampling spectra and their associated uncertainties onto different sets of wavelength values. It turns out there were a lot of other people in astronomy looking for an answer to the same problem, so I decided to write and publish SpectRes, a Python function for spectral resampling.

The function works with any grid of wavelength values, including non-uniform sampling, and preserves the integrated flux. This may be of use for binning data to increase the signal to noise ratio, obtaining synthetic photometry, or resampling model spectra to match the sampling of observational data.

The code can be installed using pip with "pip install spectres", you can also clone the GitHub repository directly. Documentation for using the code is available at spectres.readthedocs.io. I also published a short research note on arXiv explaining the method the code applies.

The most important thing to remember about using the code is that if you're resampling in such a way that there's a contribution to the fluxes at two of your new wavelength points from the same original flux value then those two wavelength points are now corellated with each other. The code doesn't currently return the covariance matrix for the new fluxes, but I'm happy to add this if it would be a useful feature. The best way to avoid introducing corellated noise into your flux values is to make sure that each of the original fluxes only contributes to one of your new fluxes (effectively binning the data by an integer factor).

Written on May 15, 2017