flaresimulations / synthesizer

Synthesizer - a code for creating synthetic astrophysical observables
https://flaresimulations.github.io/synthesizer/
GNU General Public License v3.0
17 stars 8 forks source link

Determine behavior of spec.get_fnu when redshift=0 #639

Closed virajpandya closed 4 months ago

virajpandya commented 4 months ago

Chris Lovell recommended creating this issue during an in-person hack at Flatiron.

Is your feature request related to a problem? Please describe. Suppose a galaxy is instantiated with a 2D SFZH array:

arr_stars = Stars(log10ages=np.log10(tbins), metallicities=10**logZbins,,sfzh = SFH_grid)
galaxy = Galaxy(arr_stars)
spec = galaxy3stars.get_spectra_incident(grid)

Then if we want to get the spectrum flux density F_nu in nanoJy for the galaxy at z>0, we can just do

spec.get_fnu(cosmo=Planck15,z=3.0,igm=None)

However, this fails if z=0 exactly -- this leads to very ~10^20 nanoJy in some examples Chris and I tried.

Describe the solution you'd like

Probably internally there should be some check if the user sets z=0 exactly, they want rest-frame quantities. In that case either use Lnu or Llam (the spectrum in units of luminosity density), or somehow assume that z=0 corresponds to placing the galaxy at 10 pc or something.

Describe alternatives you've considered

Additional context

WillJRoper commented 4 months ago

@christopherlovell doesn't it switch to using the definition at 10 parsecs at z=0? Hence the large value.

Otherwise if you left it with z=0 it would blow up and give a NaN.

WillJRoper commented 4 months ago

Indeed, it does: https://github.com/flaresimulations/synthesizer/blob/main/src/synthesizer/sed.py#L925

This is effectively the "rest-frame" flux.

christopherlovell commented 4 months ago

Oh, duh, knew we'd discussed it, didn't realise we'd implemented it