kmhess / SoFiA-image-pipeline

Generate figures of spectral line sources, for publication or quick inspection, based on SoFiA-2 output catalog and fits files.
GNU General Public License v3.0
16 stars 7 forks source link

Astroquery not able to retrieve survey images #92

Closed kmhess closed 5 months ago

kmhess commented 5 months ago

This seems to have started happening out of the blue, despite no changes to the code where I get the following error when trying to retrieve a survey image with astroquery:

  File "/Users/hess/SoFiA-image-pipeline/environment/bin/sofia_image_pipeline", line 33, in <module>
    sys.exit(load_entry_point('sofia-image-pipeline==1.2.5', 'console_scripts', 'sofia_image_pipeline')())
  File "/Users/hess/SoFiA-image-pipeline/src/image_pipeline.py", line 190, in main
    make_images.main(source, src_basename, opt_view=opt_view, suffix=suffix, sofia=sofia, beam=beam,
  File "/Users/hess/SoFiA-image-pipeline/src/make_images.py", line 1089, in main
    overlay_image = get_skyview(hi_pos_common, opt_view=opt_view, survey=survey)
  File "/Users/hess/SoFiA-image-pipeline/src/modules/get_ancillary.py", line 38, in get_skyview
    path = SkyView.get_images(position=hi_pos.to_string('hmsdms'), coordinates='ICRS', width=opt_view[0],
  File "/Users/hess/SoFiA-image-pipeline/environment/lib/python3.9/site-packages/astroquery/skyview/core.py", line 200, in get_images
    readable_objects = self.get_images_async(position, survey, coordinates,
  File "/Users/hess/SoFiA-image-pipeline/environment/lib/python3.9/site-packages/astroquery/skyview/core.py", line 221, in get_images_async
    image_urls = self.get_image_list(position, survey, coordinates,
  File "/Users/hess/SoFiA-image-pipeline/environment/lib/python3.9/site-packages/astroquery/skyview/core.py", line 255, in get_image_list
    elif width and height:
  File "/Users/hess/SoFiA-image-pipeline/environment/lib/python3.9/site-packages/astropy/units/quantity.py", line 1334, in __bool__
    raise ValueError(
ValueError: Quantity truthiness is ambiguous, especially for logarithmic units and temperatures. Use explicit comparisons.

I tracked this back to:

<ipython-input-7-53c67b8fadd2> in <module>
----> 1 path = SkyView.get_images(position=hi_pos_s.to_string('hmsdms'),coordinates='ICRS', width=[6]*u.arcmin,height=[6]*u.arcmin,survey='DSS2 Blue',pixels=720)
...
~/SoFiA-image-pipeline/environment/lib/python3.9/site-packages/astroquery/skyview/core.py in get_image_list(self, position, survey, coordinates, projection, pixels, scaling, sampler, resolver, deedger, lut, grid, gridlabels, radius, width, height, cache)
    253         if radius is not None:
    254             size_deg = str(radius.to(u.deg).value)
--> 255         elif width and height:
    256             size_deg = "{0},{1}".format(width.to(u.deg).value,
    257                                         height.to(u.deg).value)

~/SoFiA-image-pipeline/environment/lib/python3.9/site-packages/astropy/units/quantity.py in __bool__(self)
   1332         especially for logarithmic units and temperatures. Use explicit comparisons.
   1333         """
-> 1334         raise ValueError(
   1335             f"{type(self).__name__} truthiness is ambiguous, especially for logarithmic units"
   1336             " and temperatures. Use explicit comparisons."

ValueError: Quantity truthiness is ambiguous, especially for logarithmic units and temperatures. Use explicit comparisons.

but if I run the same command without units, it complains on the next line after the elif statement that list or int objects have no attribute 'to'.

If I run SkyView.get_images without height and width, it will return an image, but then I have no control over the size.

kmhess commented 5 months ago

Upgrading to astroquery 0.4.7 appears to solve the problem. But the change in behavior still doesn't make sense...is this happening locally or on the server side?