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

ENH add Interpolant classes #56

Merged
merged 44 commits into from
Oct 20, 2023
Merged

ENH add Interpolant classes #56

merged 44 commits into from
Oct 20, 2023

Conversation

beckermr
Copy link
Collaborator

@beckermr beckermr commented Sep 13, 2023

This PR adds the interpolant classes from galsim.

tests/conftest.py Outdated Show resolved Hide resolved
jax_galsim/gsparams.py Outdated Show resolved Hide resolved
jax_galsim/gsobject.py Outdated Show resolved Hide resolved
@beckermr beckermr changed the title WIP add interpolant classes ENH add Interpolant classes Sep 14, 2023
jax_galsim/interpolant.py Outdated Show resolved Hide resolved
jax_galsim/interpolant.py Outdated Show resolved Hide resolved
jax_galsim/interpolant.py Outdated Show resolved Hide resolved
@jecampagne
Copy link
Collaborator

jecampagne commented Sep 18, 2023

Hello Matthew,
I have tried to use your quintic interpolation code. In the following nb, I have C&P the code in the nb mentionned by @ismael-mendoza. I've also included some code that I've done for other things but it is limited. Although, I've difficulty to get right a test of obtaining a "high" resolution map from a "low" resolution one. I certainly not correctly adjusted the input argument of the quintic interpolation function.

see a Collab nb here

BTW: if you impose float32 variable init (cf. jnp.zero_like...) then the code crashes if I use a JAX config with float64 variables.

@beckermr
Copy link
Collaborator Author

I cannot access the notebook. However the code in this pr matches galsim to pretty high precision so I'm guessing there isn't a bug in the code here.

@jecampagne
Copy link
Collaborator

jecampagne commented Sep 18, 2023

I've opened the access, sorry. No doubt that is an argument miss fit

@beckermr
Copy link
Collaborator Author

Fixed here: https://colab.research.google.com/drive/1tk8vPSiZac5PytN639dParpam9pR695w?usp=sharing

It was indeed the jnp.zeros_like! Thanks for catching the bug and the tip!

@jecampagne
Copy link
Collaborator

I'm glad to see that I have made a valuable x-check of the code, thanks having spent a bit to correct the nb.

Copy link
Collaborator

@ismael-mendoza ismael-mendoza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a complex PR! As long as I can tell it's all correct, I carefully compared your implementation and constants with what is in Interpolants.cpp and Interpolants.h in Galsim. If there is anything I couldn't find or was unclear, I added a question below.

Of course, there's a chance I missed something so I also pinged @jecampagne for a review. But I think I would be ok approving once the questions below are clear (since all tests you added are passing and I think you are additional waiting for all InterpolatedImage tests in #60 to pass as well before merging this one)

jax_galsim/interpolant.py Show resolved Hide resolved
jax_galsim/interpolant.py Show resolved Hide resolved
jax_galsim/interpolant.py Show resolved Hide resolved
jax_galsim/interpolant.py Outdated Show resolved Hide resolved
jax_galsim/interpolant.py Show resolved Hide resolved
@beckermr beckermr marked this pull request as ready for review October 20, 2023 13:06
@beckermr
Copy link
Collaborator Author

OK @ismael-mendoza - this one is ready to merge. I am still working on the interpolated image itself but I don't foresee a ton of changes here.

Copy link
Collaborator

@ismael-mendoza ismael-mendoza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just had a small comment @beckermr

Is there any part of the code that significantly changed since my last review (or did you just rebased the branch)? Didn't notice anything but let me know otherwise

)

@staticmethod
def from_name(name, tol=None, gsparams=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not wrap this docstring?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason. The code base is not consistent on this, but I am leaving that to another PR.

@beckermr
Copy link
Collaborator Author

I just rebased yes.

@beckermr beckermr merged commit 0d547a0 into GalSim-developers:main Oct 20, 2023
3 checks passed
@beckermr beckermr deleted the interp branch October 20, 2023 18:30
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.

3 participants