-
Notifications
You must be signed in to change notification settings - Fork 1
adding jax code #30
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
base: main
Are you sure you want to change the base?
adding jax code #30
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #30 +/- ##
==========================================
- Coverage 99.05% 96.94% -2.11%
==========================================
Files 20 28 +8
Lines 1689 2421 +732
==========================================
+ Hits 1673 2347 +674
- Misses 16 74 +58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| - ngmix | ||
| - numba | ||
| - numpy | ||
| - jax<0.7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you comment on this restriction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it related to JAX-GalSim?
beckermr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor changes, but looks great!
| return True | ||
|
|
||
|
|
||
| def ngmix_obs_to_dfmd_obs(obs: ngmix.observation.Observation) -> DFMdetObservation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a doc string.
| ) | ||
|
|
||
|
|
||
| def dfmd_obs_to_ngmix_obs(dfmd_obs) -> Observation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a doc string.
|
|
||
|
|
||
| def get_gauss_reconv_psf_galsim(psf, step=DEFAULT_STEP, flux=1): | ||
| def get_gauss_reconv_psf_galsim(psf, step=DEFAULT_STEP, flux=1, dk=None, kim_size=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dk is not in the doc string.
|
|
||
| def _render_psf_and_build_obs(image, obs, reconv_psf, weight_fac=1): | ||
| def _render_psf_and_build_obs( | ||
| image, obs, reconv_psf, weight_fac=1, max_min_fft_size=None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this max_min_fft_size just fft_size since it is used to set the FFT size directly. We should make this change everywhere.
| if dfmd_obs1.has_bmask() or dfmd_obs2.has_bmask(): | ||
| new_bmask = _extract_attr(dfmd_obs1, "bmask", jnp.int32) | _extract_attr( | ||
| dfmd_obs2, "bmask", jnp.int32 | ||
| ) | ||
|
|
||
| if dfmd_obs1.has_ormask() or dfmd_obs2.has_ormask(): | ||
| new_ormask = _extract_attr(dfmd_obs1, "ormask", jnp.int32) | _extract_attr( | ||
| dfmd_obs2, "ormask", jnp.int32 | ||
| ) | ||
|
|
||
| if dfmd_obs1.has_noise() or dfmd_obs2.has_noise(): | ||
| new_noise = _extract_attr(dfmd_obs1, "noise") + _extract_attr( | ||
| dfmd_obs2, "noise" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does JIT properly handle these if statements. Have you tested that?
| ) | ||
|
|
||
| # now add in noise corr to make it match the wide noise | ||
| # TODO: is it after to vextorize? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to address this item?
| force_maxk_psf=0.0, | ||
| max_min_fft_size=1024, | ||
| ): | ||
| """Do metacalibration for a combination of wide+deep datasets.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should have a complete doc string.
| mcal_res[k] = dfmd_obs_to_ngmix_obs(mcal_res[k]) | ||
| mcal_res[k].psf.galsim_obj = reconv_psf | ||
|
|
||
| return mcal_res, kinfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return only one value if we can.
| force_maxk_psf=0.0, | ||
| max_min_fft_size=1024, | ||
| ) -> dict: | ||
| """Run deep-field metadetection for a simple scenario of a single band |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc string is not complete.
Co-authored-by: Matthew R. Becker <[email protected]>
No description provided.