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

Attempts to fix #27, currently fails due to keyword arguments in interp_kind #28

Closed
wants to merge 1 commit into from

Conversation

dncnwtts
Copy link
Contributor

Including the new scipy API for cubic interpolation has brought to light certain subtleties in how interpolation should be done for albedos and phase functions at scattering wavelengths.

@dncnwtts dncnwtts marked this pull request as draft April 29, 2024 13:57
@MetinSa MetinSa self-assigned this Apr 29, 2024
@MetinSa MetinSa linked an issue Apr 29, 2024 that may be closed by this pull request
@MetinSa MetinSa mentioned this pull request Apr 29, 2024
16 tasks
@MetinSa
Copy link
Collaborator

MetinSa commented Apr 30, 2024

I was discussing the interpolation of just three points with @eirikgje and @unfunfunt and what was suggested was that we use linear interpolation with for instance np.interp for interpolation and for extrapolation we just pick the edge values. Thoughts @dncnwtts ?

@dncnwtts
Copy link
Contributor Author

I would like something like this:

Linear interpretation:
Fit lines between all non-zero points, and set to constant outside

Cubic interpolation:
Fit cubic splines between all non-zero points, but allow for extrapolation beyond that. The problem right now is that there are only three nonzero points, so this would be used only when we have more bands.

What do you think of this?

@hermda02
Copy link
Collaborator

hermda02 commented May 1, 2024

Seems reasonable and easy enough to implement. Over a certain number of bands, a cubic spine is used. Perhaps some light testing against simulated data to determine at what point we should switch from linear to cubic.

@MetinSa
Copy link
Collaborator

MetinSa commented May 1, 2024

Seems reasonable and easy enough to implement. Over a certain number of bands, a cubic spine is used. Perhaps some light testing against simulated data to determine at what point we should switch from linear to cubic.

As in, if a model parameter is tabulated for more than N frequencies, we use cubic spline?

Btw @dncnwtts regarding the use of np.nan instead of 0 for albedoes and phase coefficients: Tried this in #29 and forgot that this then means that there is a non-zero scattering contribution at all wavelenghts, which does not reproduce the K98 model simulations. I think we just set it to 0 like in the K98 model.

@MetinSa MetinSa closed this Jul 25, 2024
@MetinSa MetinSa deleted the scipy_interpolation branch July 25, 2024 13:36
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

Successfully merging this pull request may close these issues.

Replace SciPy's interp1d with new intended interpolation API
3 participants