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

The example on the home page does not work #59

Open
davidedelvento opened this issue Apr 14, 2024 · 4 comments
Open

The example on the home page does not work #59

davidedelvento opened this issue Apr 14, 2024 · 4 comments

Comments

@davidedelvento
Copy link

Example script from the home page:

$ cat test_align.py 
from image_registration import chi2_shift
from image_registration.fft_tools import shift
import image_registration

#Generate Sample Image
image = image_registration.tests.make_extended(100)
offset_image = image_registration.tests.make_offset_extended(image, 4.76666, -12.33333333333333333333333, noise=0.1)

#Get Fused Image
xoff, yoff, exoff, eyoff = chi2_shift(image, offset_image)
corrected_image2 = shift.shiftnd(offset_image, (-yoff, -xoff))

Fails with:

$ python test_align.py 
Traceback (most recent call last):
  File "test_align.py", line 7, in <module>
    offset_image = image_registration.tests.make_offset_extended(image, 4.76666, -12.33333333333333333333333, noise=0.1)
  File "/home/davide/venvs/astroimages/lib/python3.8/site-packages/image_registration/tests/registration_testing.py", line 124, in make_offset_extended
    newimage = np.real(shift.shiftnd(img, (ysh, xsh))+noise)
  File "/home/davide/venvs/astroimages/lib/python3.8/site-packages/image_registration/fft_tools/shift.py", line 100, in shiftnd
    freq_grid = np.sum(
  File "<__array_function__ internals>", line 200, in sum
  File "/home/davide/venvs/astroimages/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 2324, in sum
    return _wrapreduction(a, np.add, 'sum', axis, dtype, out, keepdims=keepdims,
  File "/home/davide/venvs/astroimages/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.
@keflavich
Copy link
Owner

I think this was fixed in #57 but I haven't issued a new release yet.

@keflavich
Copy link
Owner

@davidedelvento this looks fixed locally; could you install the latest and verify?

@davidedelvento
Copy link
Author

@keflavich Yes, if I install from github rather than PyPI it works correctly (as the dependencies do too). Perhaps I should rename the issue to "make a release and post it on PyPI"? 😄

@keflavich
Copy link
Owner

I made a new release this morning. 0.2.9 should have the fix

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