Python Tip: Re-sampling spectra with pysynphot
This post was inspired by a question from John Johnson.
Have you ever wanted to plot a model spectrum at lower resolution? Or compare a model spectrum with an observed spectrum? Have you ever wanted to shift several observed spectra to a common redshift to stack them up? In all these cases, you would need to resample the spectrum. Just such a scenario arose and I was asked:
What is the recommended way to resample a 1D spectrum?
I recalled using pysynphot, which is very useful for working with 1D spectra. However, the documentation is still a bit thin. After a bit of of exploring, here is an example that John Johnson and I wrote to illustrate our answer to the question. This package takes care to resample while preserving flux. We hope you find this useful! Or leave your alternative answer in the comments below.
For those bleeding-edge python users out there, pysynphot is becoming an astropy affiliated package. You can download this new version from the pysynphot GitHub repository and test it out.
From: http://www.astrobetter.com/python-tip-re-sampling-spectra-with-pysynphot/
没有评论:
发表评论