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 truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #220

Open
arata314 opened this issue Mar 25, 2024 · 5 comments

Comments

@arata314
Copy link

This is showing me when I used show_fit. Any idea how to resolve this issue?

ValueError                                Traceback (most recent call last)
Cell In[7], line 1
----> 1 go()

File ~/.local/lib/python3.10/site-packages/bdsf/pybdsf.py:77, in go(cur_cmd)
     75     print('\033[31;1mERROR\033[0m: not a valid task')
     76     return
---> 77 cur_cmd()

File ~/.local/lib/python3.10/site-packages/bdsf/pybdsf.py:414, in show_fit(**kwargs)
    412     img_kwargs[k] = kwargs[k]
    413 try:
--> 414     success = _img.show_fit(**img_kwargs)
    415     if success:
    416         tput(quiet=True)

File ~/.local/lib/python3.10/site-packages/bdsf/image.py:175, in Image.show_fit(self, **kwargs)
    173     print('Image has not been processed. Please run process_image first.')
    174     return False
--> 175 plotresults.plotresults(self, **kwargs)
    176 return True

File ~/.local/lib/python3.10/site-packages/bdsf/plotresults.py:234, in plotresults(img, ch0_image, rms_image, mean_image, ch0_islands, gresid_image, sresid_image, gmodel_image, smodel_image, pyramid_srcs, source_seds, ch0_flagged, pi_image, psf_major, psf_minor, psf_pa, broadcast)
    232 print('  Press "n" ........ : Show / hide island IDs')
    233 print('  Press "0" ........ : Reset scaling to default')
--> 234 if 'seds' in images:
    235     print('  Press "c" ........ : Change source for SED plot')
    236 if ch0_islands and hasattr(img, 'ngaus'):

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

@Deekshit-Vedula
Copy link

Hi @arata314 . I am running into the same issue while running the show_fit command. Were you able to resolve this?

@vmahat
Copy link

vmahat commented Sep 24, 2024

Hello, has anyone found a fix for this?

@tammojan
Copy link
Collaborator

Probably due to a newer numpy version. Just looking at the logic above, an ugly fix would be replacing

if 'seds' in images:

by

if 'seds' in [img for img in images if type(img) == str]:

@arata314
Copy link
Author

arata314 commented Nov 9, 2024

@tammojan I tried this fix, so the error is fixed, but there is no image output. It's a blank screen now.

@arata314 arata314 closed this as completed Nov 9, 2024
@arata314
Copy link
Author

arata314 commented Nov 9, 2024

Hi @arata314 . I am running into the same issue while running the show_fit command. Were you able to resolve this?

No Brother

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

4 participants