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

How to construct model without downloading #7

Open
pllim opened this issue Jul 9, 2019 · 1 comment
Open

How to construct model without downloading #7

pllim opened this issue Jul 9, 2019 · 1 comment

Comments

@pllim
Copy link

pllim commented Jul 9, 2019

Follow up of #1 and #6 -- What if I don't want to download from SVO? What if I already have a sampled transmission curve locally but I want to use your package to turn it into a parametrize Astropy model?

@bmorris3
Copy link
Owner

This is the section of the source where that magic happens:

tynt/tynt/download.py

Lines 143 to 162 in 04e0b7c

diff_wl = np.diff(wl)
delta_lambda = np.nanmedian(diff_wl[diff_wl != 0])
lambda_0 = wl.min()
n_lambda = len(wl)
# Create a simplified wavelength grid:
simplified_wavelength = np.arange(lambda_0, (n_lambda + 1) *
delta_lambda + lambda_0,
delta_lambda)
tr_max = tr.max()
# Interpolate transmittance onto simplified wavelength grid:
tr_interp = np.interp(simplified_wavelength, wl, tr)
# Take the DFT of the interpolated transmittance curve
fft = np.fft.fft(tr_interp)[:n_terms]
# Save results in a dictionary
row = [n_lambda, lambda_0, delta_lambda, tr_max] + fft.tolist()

I agree that it would be handy to split this out of the DownloadManager object and into a standalone function, so users can tinker with it. PRs are welcome!

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