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

Diffraction spikes show artifacts after shifting by shiftnd #29

Open
astrobatty opened this issue Jan 26, 2021 · 6 comments
Open

Diffraction spikes show artifacts after shifting by shiftnd #29

astrobatty opened this issue Jan 26, 2021 · 6 comments

Comments

@astrobatty
Copy link

Hi,

I'm trying to shift some CCD FITS images using chi2_shift then shiftnd. The x and y offsets between two images are calculated without any problem. However, when I try to shift my images with shiftnd the new images show some artifacts. There are diffraction spikes around the bright(ish) targets, and these features are shifted in a very strange way. Here is a plot, where the upper panel shows the original image and the bottom shows the shifted.

image

I can see a periodicity with a period of 1 pixel in the spikes which is introduced by shiftnd. This affects the photometry in a bad way. My only solution is to use integer offsets, but this means +/- 0.5 pixel uncertainty, which is greater than I can accept. Has anyone encountered this issue? Any solution?

Thanks

@keflavich
Copy link
Owner

Interesting, this is almost certainly an aliasing issue. A simple fix might be to apply a low-pass filter. Can't come up with an example right now, but if you fft, shift it, zero the corners, then shift back, it might fix this.

@astrobatty
Copy link
Author

I tried to set the corners to zero, but as the information is in the high frequencies the result is a blurred image. Another try was zero-padding the original image, but the result didn't change.

@keflavich
Copy link
Owner

just setting the corners to zero shouldn't result in blurring. But some sort of tapering function is needed to prevent this ringing.

@astrobatty
Copy link
Author

astrobatty commented Jan 27, 2021

I set more than 1-1 value to zero. So, if I set only the corners to zero, then this is the result.

(Edit: changed the figure to a better example.)

image

@keflavich
Copy link
Owner

I think this is coming from a couple of super-bright, maybe saturated pixels? If they are genuinely saturated, try replacing them with the local median, then re-shifting. If they're not saturated and the star really is that bright, I'm afraid you have some dynamic range issues and I'm not 100% sure how to deal with them.

@astrobatty
Copy link
Author

I checked all the stars and all of these problematic cases have at least one saturated pixel, that is the problem. Thanks for the suggestions.

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

2 participants