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

nircam and miri SGD notebook error due to NANs #1

Open
abhijithrajan opened this issue Aug 16, 2017 · 4 comments
Open

nircam and miri SGD notebook error due to NANs #1

abhijithrajan opened this issue Aug 16, 2017 · 4 comments

Comments

@abhijithrajan
Copy link

abhijithrajan commented Aug 16, 2017

Hello,

I have been testing the MIRI SGD notebook and running into issues when generating the KLIP reference. This is related to uncorrected nan's in the SGD reference images, possibly due to saturation artifacts, that cause the code to crash.

Here's what is in the original code -

reg = analysis.register_to_target(slope,target_slope,rescale_reference=True)
sgd_reg.append(reg)
sgd_reg = np.array(sgd_reg) 

I modified it in the following manner -

slope[np.isnan(slope)] = 0
reg = analysis.register_to_target(slope,target_slope,rescale_reference=True)
sgd_reg.append(reg) 

This does result in the central PSF artifact not getting completely removed in the target-reference but that could be corrected by drawing a mask on the central 0.1-0.2 arcsec.

@mperrin
Copy link
Collaborator

mperrin commented Aug 16, 2017

I would think in general we ought to try to avoid saturating the reference stars, right? But your code makes sense to work around if that does happen.

Where exactly is this code - is it in the notebook or in one of the .py files?

@abhijithrajan
Copy link
Author

So I definitely think we should attempt to avoid saturating the reference stars. However, the code crashes if NANs are present, and so it's worth doing the check. Or making the code robust to NANs.

The snippet of code I showed above are in both MIRI and NIRCAM SGD notebooks. In fact @kvangorkom does something similar in the miri_photon_noise_and_contrast example notebook under the section labeled Post Processing, where he replaces the NANs with the max. Not sure whether it should be the max, I believe Jason changes NANs to 0 in pyklip.

@kvangorkom
Copy link
Collaborator

register_to_target does support passing in a mask, so NaNs could also be handled that way.

Is the code actually crashing when NaNs are present, or is it simply giving the wrong answer?

@abhijithrajan
Copy link
Author

It crashes the call to analysis.klip_projection(), with the following error -

LinAlgError: Array must not contain infs or NaNs

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

3 participants