-
Notifications
You must be signed in to change notification settings - Fork 12
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
Improvements to Bad Pixel Detection and Cleaning #194
Conversation
TODO:
|
Hi @AarynnCarter! I had a look at your changes and only found a few small things that I would like to discuss. The one additional important thing is that I cannot see any EDIT: I did miss it, never mind! |
threshold = sigclip_kwargs['sigma'] * data_std | ||
mask_new = diff > threshold | ||
|
||
data_temp[i][mask_new] = np.nan |
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.
Seems redundant to new line number 1303?
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.
I don't think so? The line numbers shuffled a little, but this can't be redundant as the mask_new is calculated on the line above.
log.info(' --> Unknown method ' + method_split[k] + ': skipped') | ||
|
||
# The new DQ will just be the pxdq_temp we've been modifying | ||
new_dq = pxdq_temp.astype(np.uint32) |
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.
I think we need to be more carful here to ensure that subsequent routines will still be working correctly. The DQ array should remain as before, with the only change being the newly identified bad pixels getting DQ value 1 instead of 0. Everything else, like non-science pixels, shall remain.
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.
I don't think that's necessarily the case, as you might want to focus a routine on a certain collection of pixels flagged by a particular routine. I have added a toggle so that you can decide whether to start from an empty DQ array or adjust the existing one.
… or start a new clean one.
This PR make some changes to the bad pixel detection and cleaning routines, specific updates include:
This change will break backwards compatibility with previous versions of spaceKLIP, as the
fix_bad_pixels()
function has been fundamentally changed. While this isn't ideal, the new structure should allow for more flexibility moving forward, where further breaks to backwards compatibility are unlikely.