Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing the emission line velocity width #229

Open
moustakas opened this issue Aug 29, 2023 · 8 comments
Open

changing the emission line velocity width #229

moustakas opened this issue Aug 29, 2023 · 8 comments

Comments

@moustakas
Copy link

Apologies if this information is in the documentation or in previously closed tickets, but I'd like to change (reduce) the velocity width of the emission lines without smoothing the stellar continuum. E.g., in the example below I would like to change the velocity width so the [OII] doublet is well-resolved.

According to the docs, smooth_velocity=True but smooth_lsf=False, by default, so there shouldn't be any supplemental smoothing. But clearly the lines are pretty broad (hard to tell, but I would guess >>100 km/s).

Any advice or guidance would be much-appreciated!

import fsps
import matplotlib.pyplot as plt

sp = fsps.StellarPopulation(compute_vega_mags=False, 
                            add_dust_emission=True,
                            add_neb_emission=True,
                            nebemlineinspec=True,
                            imf_type=1, # Chabrier
                            dust_type=0,
                            dust_index=-0.7,
                            sfh=0,
                            zcontinuous=1)
wave, flux = sp.get_spectrum(tage=1e-3, peraa=True)

I = (wave > 3697.) * (wave < 3757.)
fig, ax = plt.subplots()
ax.plot(wave[I], flux[I])
ax.set_xlabel('Wavelength (Angstrom)')
ax.set_ylabel('Flux')
fig.savefig('fsps-linewidth.png')

Screenshot 2023-08-29 at 2 29 40 PM

@bd-j
Copy link
Collaborator

bd-j commented Aug 29, 2023

Hi @moustakas!

The lines are added with a resolution set by the wavelength spacing of the stellar spectral library, which for MILES at these wavelengths is ~1AA. Unfortunately this resolution is not adjustable at run time (though I think it could be made a bit narrower and still be well-enough sampled - looking through the code it seems the lines have sigma=2*delta_lambda which is pretty broad)

One more general option might be to turn off the automatic addition of lines and construct them yourself from the computed nebular line luminosities and wavelengths (after augmenting the wavelength array...)

e.g.

sp.params["nebemlineinspec"] = False
wave, flux = sp.get_spectrum(tage=1e-3, peraa=True)
eline_lum = sp.emline_luminosity
eline_wave = sp.emline_wavelengths

and then use these to construct and normalize whichever line profiles you want.

@moustakas
Copy link
Author

Thanks for the quick response @bd-j! However, these models were computed with c3k_a library, which should be basically infinite resolution for my purposes, I think:

print(sp.libraries)
(b'mist', b'c3k_a', b'DL07')

Any thoughts what's going on?

Regardless, I think I'll follow your suggestion and instantiate the lines myself.

@moustakas
Copy link
Author

And can you confirm that for sfh=3 (tabular SFH), the units of sp.emline_luminosity are L/Lsun, integrated over the full line-profile (cf #117)?

@bd-j
Copy link
Collaborator

bd-j commented Aug 29, 2023

I think c3k_a is only R=3000 in the optical (but you can look at sp.resolutions for the velocity dispersion of the stellar library, in km/s) with just 2 pixels per FWHM, so delta_lambda ~ 0.6AA at lambda=3720

Yes, the units are L/L_sun when SFH=3 (and for other other SFHs are normalized by the total stellar mass formed)

@moustakas
Copy link
Author

I'm not seeing an sp.resolutions attribute with version 0.4.2 which I'm using; is this a more recent addition?

As for the resolution of c3k_a, according to this readme, R_FWHM=lambda/FWHM=3000 in the optical. But that corresponds to R_dlambda=lambda/dlambda=7065 or sigma_Gauss=c/R_dlambda= 42 km/s. Right??

However, if I model the [OIII] 5007 line with a single Gaussian, I get a sigma line-width of 1.676 Angstrom, or 100.4 km/s at a vacuum wavelength of 5008.238 Angstrom. But isn't that a factor of 2.355 too big? (Note: 100.4 / 2.355 = 42 km/s.)

So I feel like (1) I'm missing something / wrong; (2) the c3k_a resolution readme is incorrect; or (3) there's a bug in the emission-line code. Thoughts?

@bd-j
Copy link
Collaborator

bd-j commented Aug 30, 2023

sp.resolutions was added in 0.4.3 (v0.4.2...v0.4.3)

I agree the emission lines are broader than the resolution of the stellar library - I don't think the docs make a claim about the emission lines? As noted above, the emission lines are added with sigma=2 * delta_lambda = 2 * (lambda / R_FWHM /2) (see code at https://github.com/cconroy20/fsps/blob/master/src/add_nebular.f90#L45) which for c3k_a is a larger velocity dispersion than the stars by a factor of 2.35. I believe but am not sure that the reasoning was to be extra sure that emission line flux was conserved, though I do thank they could be made narrower and still be well-enough sampled.

Also note that the special libraries - WR stars, AGB stars, etc are added with resolutions that do not match the C3K (or even MILES) libraries.

@bd-j
Copy link
Collaborator

bd-j commented Aug 30, 2023

Basically, the emision lines are added based on the wavelength spacing of the stellar library, but there's no guarantee that will be closely related to the resolution of the stellar library. Even if dividing by a factor 2.355 in add_nebular, a library with > 2 pixels per FWHM would result in lines that were lower velocity dispersion than the stellar library.

Of course, now that we are more explicitly tracking the library resolution we could try to use that to set the nebular line widths. I will open an issue on FSPS for this.

@moustakas
Copy link
Author

Thanks @bd-j. I've followed your suggestion and I'm now creating the emission-line spectrum on-the-fly with my desired line-width. Feel free to close this ticket, but hopefully with cconroy20/fsps#69 the end-user can have the option of controlling the emission-line width separately from the wavelength spacing of the SPS model spectra.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants