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

Forced float for psf_pixel_scale in ParametricOpticalSystem #279

Open
maxecharles opened this issue Nov 27, 2024 · 2 comments
Open

Forced float for psf_pixel_scale in ParametricOpticalSystem #279

maxecharles opened this issue Nov 27, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@maxecharles
Copy link
Collaborator

Hi louis,
So currently the ParametricOpticalSystem hardcodes the psf_pixel_scale to be a float, such that even if you pass it in as a jax array it will convert at init time. I was wondering if there was a reason this happens.

I'm trying to fit for the psf_pixel_scale for Toliman and running into our favourite cause of NaNs (parameter isn't a jax array). I tried just removing the hardcoding as float from ParametricOpticalSystem on a branch and this fixes my issue.

don't read this until you get back from CA <3 <3
Max

@maxecharles maxecharles added the question Further information is requested label Nov 27, 2024
@maxecharles
Copy link
Collaborator Author

Created branch float

@LouisDesdoigts
Copy link
Owner

This is essentially the same issue as #264. The enforced float was originally chosen as a way to enhance the readability of the models (as arrays appear as 'f64[]'), so this is mostly a style decision.

I am aware this can cause issues with equinox not recognizing floats as default jax-types (LouisDesdoigts/zodiax#35 (comment)). I'm still on the fence as to where this fix should be implemented, I still like the idea of increasing the visualization with float-types and having zodiax methods that pre-transform all python-types to jax types any time they are passed through zodiax, but that still leaves open the issue of users doing their own transformations and being unaware of this.

There is also the possibility of overwriting the pretty-printing method in Zodiax.Base in order to just print jax-array scalars with their value, but I'm not sure what the best answer is.

We can talk about this when you get back and implement a solution soon.

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

No branches or pull requests

2 participants