<p>This is exactly what is done for template fitting. The shifted SED is one of the intermediate data products of template fitting codes such as <a href="https://ui.adsabs.harvard.edu/abs/2011ascl.soft08009A/abstract" rel="nofollow noreferrer">Le Phare</a> or <a href="http://aspbooks.org/custom/publications/paper/521-0169.html" rel="nofollow noreferrer">Phosphoros</a>.</p>

<p>For instance, with Phosphoros, you can shift your SEDs to any number of redshifts, then find the shifted SEDs (also called model grids) in the IntermediateProducts folder in the Phosphoros directory. </p>

<p>Based on your comment, you are also applying a filter to the shifted SEDs. This can also be done with Phosphoros, and you can directly get the flux through each filter for the shifted SEDs.</p>

<p>Phosphoros can be used from the command line, so you use the Python library <a href="https://docs.python.org/3/library/subprocess.html" rel="nofollow noreferrer">subprocess</a> to make calls to Phosphoros from your Python script. </p>

CC BY-SA 4.0
2020-02-25T13:26:35.380Z
2020-02-25T13:26:35.380Z
usernumber
<p>$\lambda_{rest} \times (1 + z) = \lambda_{obs}$</p>

<p>where $\lambda_{rest}$ is your restframe wavelength template.</p>

CC BY-SA 4.0
2018-05-15T20:30:22.360Z
This is not enough. Since photons are spread out in wavelength, the flux _density_ decreases by (1+z). For broadband photometry, that means that the flux decreases, but if your flux is line-dominated, the SED stays more or less the same.
pela
CC BY-SA 4.0
2018-05-16T11:52:43.493Z
The question asked about shifting the restframe wavelength from the template, so the relationship is as stated. Calibrating flux is a different story. At least, that is what I have been done in my research. I would love to hear different approaches though.
Kornpob Bhirombhakdi
CC BY-SA 4.0
2018-05-16T20:09:40.380Z
The question is about shifting a template SED, right? You're absolutely right that the _wavelength_ shifts in this way. But just calculating a new wavelength doesn't really make the SED useful for anything — you also need to know the flux/magnitudes. This is not about calibrating, it's about knowing how the amplitude changes as you shift the spectrum.
pela
CC BY-SA 4.0
2018-05-16T21:14:11.883Z
I can explain further in an answer, but I think J. Chomel is right: the OP should first explain what she tried.
pela
CC BY-SA 4.0
2018-05-17T14:38:48.283Z
I guess the person might try ti fit the template with observation. In that case, you shift with the known redshift, and let scale parameter as a fitting parameter. Therefore, you do not need to know flux/mad system. Anyway, again, flux/mag system seems irrelevant in this question to me. So, why don't we just wait if there will be more info?
Kornpob Bhirombhakdi
CC BY-SA 4.0
2018-05-19T16:44:10.487Z
Sounds like a good idea :)
pela
CC BY-SA 4.0
2018-05-15T13:06:55.483Z
2018-05-15T13:06:55.483Z
Kornpob Bhirombhakdi
<p>I have a template spectral energy distribution (SED) at z=0. I want to shift the template SED to an arbitrary redshift (z>0), how to do this in python?</p>

CC BY-SA 4.0
2018-05-14T09:01:35.627Z
What have you tried so far? Why do you want to do this? You must show a little background search and context. Please take the https://astronomy.stackexchange.com/tour
J. Chomel
CC BY-SA 4.0
2018-05-18T01:34:45.687Z
I have created spectra of simulated galaxy using library from Bruzual & Charlot 2003. I tried to create mock observation (eg AB magnitude in several bands) so I need to redshift my template spectra before applying filter response. I did shift it using (1+z)*wavelength but I did not change the flux (literally just shift the spectrum along the wavelength), and I got wrong result compared to more established sed code.
Dian Puspita Triani
<observational-astronomy><galaxy><redshift><spectroscopy>
Redshifting restframe SED
Dian Puspita Triani
# Redshifting restframe SED

(Asked by: username_0 on 2018-05-14)

I have a template spectral energy distribution (SED) at z=0. I want to shift the template SED to an arbitrary redshift (z>0), how to do this in python?

**Tags:** observational-astronomy, galaxy, redshift, spectroscopy
> **Comments:**
> **username_1**: What have you tried so far? Why do you want to do this? You must show a little background search and context. Please take the https://astronomy.stackexchange.com/tour  
> **username_0**: I have created spectra of simulated galaxy using library from Bruzual & Charlot 2003. I tried to create mock observation (eg AB magnitude in several bands) so I need to redshift my template spectra before applying filter response. I did shift it using (1+z)*wavelength but I did not change the flux (literally just shift the spectrum along the wavelength), and I got wrong result compared to more established sed code.  

---

## 2 answers

### Answer by username_2 on 2020-02-25. Score: 1

This is exactly what is done for template fitting. The shifted SED is one of the intermediate data products of template fitting codes such as [Le Phare](https://ui.adsabs.harvard.edu/abs/2011ascl.soft08009A/abstract) or [Phosphoros](http://aspbooks.org/custom/publications/paper/521-0169.html).

For instance, with Phosphoros, you can shift your SEDs to any number of redshifts, then find the shifted SEDs (also called model grids) in the IntermediateProducts folder in the Phosphoros directory.

Based on your comment, you are also applying a filter to the shifted SEDs. This can also be done with Phosphoros, and you can directly get the flux through each filter for the shifted SEDs.

Phosphoros can be used from the command line, so you use the Python library [subprocess](https://docs.python.org/3/library/subprocess.html) to make calls to Phosphoros from your Python script.


---

### Answer by username_3 on 2018-05-15. Score: 0

$\lambda\_{rest} \times (1 + z) = \lambda\_{obs}$

where $\lambda\_{rest}$ is your restframe wavelength template.

> **Comments:**
> **username_4**: This is not enough. Since photons are spread out in wavelength, the flux _density_ decreases by (1+z). For broadband photometry, that means that the flux decreases, but if your flux is line-dominated, the SED stays more or less the same.  
> **username_3**: The question asked about shifting the restframe wavelength from the template, so the relationship is as stated. Calibrating flux is a different story. At least, that is what I have been done in my research. I would love to hear different approaches though.  
> **username_4**: The question is about shifting a template SED, right? You're absolutely right that the _wavelength_ shifts in this way. But just calculating a new wavelength doesn't really make the SED useful for anything — you also need to know the flux/magnitudes. This is not about calibrating, it's about knowing how the amplitude changes as you shift the spectrum.  
> **username_4**: I can explain further in an answer, but I think J. Chomel is right: the OP should first explain what she tried.  
> **username_3**: I guess the person might try ti fit the template with observation. In that case, you shift with the known redshift, and let scale parameter as a fitting parameter. Therefore, you do not need to know flux/mad system. Anyway, again, flux/mag system seems irrelevant in this question to me. So, why don't we just wait if there will be more info?  
> **username_4**: Sounds like a good idea :)  

---

