[AstroPy] Vizier.query stopped working properly

Adam Ginsburg adam.g.ginsburg at gmail.com
Wed Feb 2 15:52:19 EST 2022


Hi Bob,

It might be helpful to post this sort of question as an Issue on the
astroquery github issue tracker (https://github.com/astropy/astroquery).

Anyway, I can't reproduce your exact issue.  When I run your code, I get a
multi-tiered error because the STAR_NAME is being treated as a coordinate:
"ValueError: Cannot parse first argument data "00 57 36.73" for attribute
ra"

This points to the solution: you should be using Vizier.query_object, not
query_region:

In [2]: >>> results = Vizier.query_object(STAR_NAME, radius=field_of_view *
u.deg, catalog = 'SDSS12')

In [3]: results
Out[3]:
TableList with 1 tables:
        '0:V/147/sdss12' with 23 column(s) and 2 row(s)

In [4]: results[0]
Out[4]:
<Table length=2>
 RA_ICRS    DE_ICRS    mode q_mode class        SDSS12       m_SDSS12
 ObsDate    Q     umag   e_umag   gmag   e_gmag   rmag   e_rmag   imag
e_imag   zmag   e_zmag   zsp     zph    e_zph   __zph_
   deg        deg
yr            mag     mag     mag     mag     mag     mag     mag     mag
  mag     mag
 float64    float64   uint8  str1  uint8        str19          str1
 float64  uint8 float32 float32 float32 float32 float32 float32 float32
float32 float32 float32 float64 float64 float64 float32
---------- ---------- ----- ------ ----- ------------------- --------
--------- ----- ------- ------- ------- ------- ------- ------- -------
------- ------- ------- ------- ------- ------- -------
 14.403077  12.131476     1      +     6 J005736.73+120753.3        *
2008.8279     3  18.459   0.018  17.151   0.005  16.611   0.005  16.414
0.006  16.327   0.009      --      --      --      --
 14.403551  12.130666     1            6 J005736.85+120750.3
 2008.8279     3  24.337   0.967  25.347   0.578  23.120   0.277  21.869
0.132  21.272   0.338      --      --      --      --

If you want to use query_region, first use
coordinates.SkyCoord.from_name(STAR_NAME) for the same result:

In [8]: Vizier.query_region(SkyCoord.from_name(STAR_NAME),
radius=field_of_view * u.deg, catalog = 'SDSS12')
Out[8]:
TableList with 1 tables:
        '0:V/147/sdss12' with 23 column(s) and 2 row(s)



The second issue you note is just because new GSC versions have been added
since the documentation was written.  We expect there to be more catalogs
for the same query over time.

On Wed, Feb 2, 2022 at 3:11 PM Robert Carr <rspencercarr at gmail.com> wrote:

> I am going crazy with a problem that should not be a problem at all.  I
> have run a section of code successfully probably two or three thousand
> times.  Today, it does not work.  The only thing that has changed on my end
> is that about a week ago I updated my installed modules in Python.
>
>
>
> The relevant section of my code, including installed modules, is:
>
> >>> from astropy.coordinates import SkyCoord
>
> >>> import astropy.units as u
>
> >>> from astroquery.vizier import Vizier
>
> >>>
>
> >>> STAR_NAME = 'J005736.73+120753.3'
>
> >>> field_of_view =0.001
>
> >>> results = Vizier.query_region(STAR_NAME, radius=field_of_view * u.deg,
> catalog = 'SDSS12')
>
> >>> results
>
>
>
> Until today, this returned coordinates and other information for the
> target STAR_NAME.  It now returns:
>
>                 >>> Empty TableList
>
>
>
> I have upgraded my modules.  I have tried playing with the “field_of_view”
> variable but have not been able to restore the desired behavior where
> Vizier returns results just for the target STAR_NAME.  (I use similar code
> with different “field_of_view” elsewhere in my program so I need to fix
> this in the general case.)
>
>
>
> Incidentally, I ran the sample code from astroquery:docs at *https://astroquery.readthedocs.io/en/latest/vizier/vizier.html
> <https://astroquery.readthedocs.io/en/latest/vizier/vizier.html>*
>
> >>> import astropy.units as u
>
> >>> result = Vizier.query_region("3C 273", radius=0.1*u.deg, catalog='GSC')
>
> >>> result
>
>
>
> This is supposed to return:
>
> TableList with 3 tables:
>
>    '0:I/254/out' with 10 column(s) and 17 row(s)
>
>    '1:I/271/out' with 11 column(s) and 50 row(s)
>
>    '2:I/305/out' with 11 column(s) and 50 row(s)
>
>
>
> But instead returns:
>
> TableList with 5 tables:
>
>         '0:I/254/out' with 10 column(s) and 17 row(s)
>
>         '1:I/255/out' with 9 column(s) and 17 row(s)
>
>         '2:I/271/out' with 11 column(s) and 53 row(s)
>
>         '3:I/305/out' with 11 column(s) and 206 row(s)
>
>         '4:I/353/gsc242' with 35 column(s) and 5370 row(s)
>
>
>
> Does this make any sense?  I appreciate any help!
>
> Bob Carr
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
>


-- 
Adam Ginsburg
Assistant Professor, Department of Astronomy
University of Florida, Gainesville
http://www.adamgginsburg.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20220202/f0cc2d79/attachment-0001.html>


More information about the AstroPy mailing list