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

Interpolating between points on a model grid #41

Open
kfkaplan opened this issue May 12, 2022 · 1 comment
Open

Interpolating between points on a model grid #41

kfkaplan opened this issue May 12, 2022 · 1 comment

Comments

@kfkaplan
Copy link
Collaborator

kfkaplan commented May 12, 2022

This is partly a feature request but also partly an example of how this might be done.

You can load a grid of models, for example PHOENIX models like so

grid = PHOENIXGrid(wl_lo=wave_range[0], wl_hi=wave_range[1], path=path_to_pheonix_models, teff_range=[8000, 11000], logg_range=[3.5, 5.0], metallicity_range=[-0.5,0.5])

which you can then fit with the dashboard (for example see this Tutorial https://gollum-astro.readthedocs.io/en/latest/tutorials/gollum_demo_Sonora_and_BDSS.html).

grid.show_dashboard(data=std_spec)

While (as far as I know) there is no current implementation of interpolating between models on a grid, I found I could load two models and combine them, given a chosen fraction of how much to use from each. In the following example, I combine two PHOENIX model synthetic spectra which are identical, but one has a log g=4.5 and the other has log g =5.0, into one and then proceed to process and normalize it:

synth_spec_uno = PHOENIXSpectrum(path=path_to_pheonix_models, wl_lo=wave_range[0], wl_hi=wave_range[1],
    teff=10000, logg=4.5, metallicity=-0.5)
synth_spec_dos = PHOENIXSpectrum(path=path_to_pheonix_models, wl_lo=wave_range[0], wl_hi=wave_range[1],
    teff=10000, logg=5.0, metallicity=-0.5)

uno_fraction = 0.55
dos_fraction = 1.0 - uno_fraction
synth_spec = synth_spec_uno * uno_fraction + synth_spec_dos * dos_fraction

synth_spec = synth_spec.normalize(percentile=90.0)
synth_spec = synth_spec.rotationally_broaden(15.0)
synth_spec = synth_spec.rv_shift(25.0)

Something like this could form the basis for interpolating between points on a model grid to generate synthetic spectra with stellar parameters with values between grid points. In the meantime, the above example I have seems to work, for anyone who needs this functionality.

@gully
Copy link
Member

gully commented May 23, 2022

Thank you Kyle! I am happy that gollum makes it possible to make a coarse interpolation of grid points that may be suitable to your needs.

I'm hesitant to build intra-grid interpolation into gollum itself, since I think of that process as an inference procedure: attempting to infer what an unseen grid point would have looked like requires some assumptions about how the grid varies.

Starfish probably remains the state-of-the-art for such an inference procedure, since it returns both a reconstructed spectrum, but also a non-stationary "discretization uncertainty matrix" correlation matrix, codifying how much information was lost by each pixel due to the coarse grid spacing.

To some extent gollum replicates existing grid interfacing in Starfish, but goes beyond, by offering an easy to use dashboard and method chaining.

Some recent overhauling of Starfish should make it much faster and more user friendly, so it may be worth a look if you have previously struggled to get it working.

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