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

shift() not working #26

Open
lukfd opened this issue Apr 27, 2020 · 2 comments
Open

shift() not working #26

lukfd opened this issue Apr 27, 2020 · 2 comments

Comments

@lukfd
Copy link

lukfd commented Apr 27, 2020

Hello,

When I try to run chi2_shift() and the shift.shiftnd() the resulting picture will not have any shifting applied to the rgb.

The code that I wrote is, in which variables r,g,b are the np.array got from r = fits.open("data/"+"M66-Red.fts")[0].data :

image = r
shifted = g
dx,dy,edx,edy = image_registration.chi2_shift(image, shifted, upsample_factor='auto')
g = shift.shiftnd(shifted, (dx, dy))

image = r
shifted = b
dx,dy,edx,edy = image_registration.chi2_shift(image, shifted, upsample_factor='auto')
b = shift.shiftnd(shifted, (dx, dy))

and on the console I am getting a Future warning:

C:\Users\Luca\Git\ustobservatory\newscripts\image_registration\image_registration\fft_tools\zoom.py:101: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  outarr[ii] = outarr_d[dims]
C:\Users\Luca\Git\ustobservatory\newscripts\image_registration\image_registration\fft_tools\shift.py:103: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  for dim,(off,nx) in enumerate(zip(offset,data.shape))],

Am I using the methods in a wrong way? Should I use another method to make the shift of the images?

This is the final image, as you see the
M66_rgb

Thank you so much! Really appreciate all the work !

@keflavich
Copy link
Owner

Very cool image! At a glance, though, the problem is almost certainly that your image is totally dominated by the sky background. The galaxies and stars are only a tiny perturbation on that huge sky emission. You should try to remove the background first - for the image_registration algorithm to work, it needs the background to be close to zero on average.

If you can't get rid of the background by flat fielding, a good thing to try with an image like this might be to perform a really big median filter, then subtract that from your original image, then do the shift measurement. You can then take the measured shift and apply it to the original photo.

@keflavich
Copy link
Owner

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