[AstroPy] Astroquery Using Vizier: How Do I Retrieve SDSS Photo Object Attribute "flags"? (Adam Ginsburg)

Robert Carr rspencercarr at gmail.com
Sat Jul 25 20:19:06 EDT 2020


Thank you, Prof Ginsburg.  Your advice was very helpful.  It was good to
know that the flags were accessible.  The tweak worked fine on a standalone
basis but within my code perhaps it hit another constraint.

When I run    *calibrators = Vizier.query_region(coord.SkyCoord(ra=TRA,
dec=TDEC, unit=(u.deg, u.deg),frame='icrs'), radius=field_of_view * u.deg,
catalog = 'SDSS12')*
I get 3361 calibrators for my parameters, which I subsequently whittle down

When I run    *calibrators =
Vizier(columns=['**']).query_region(coord.SkyCoord(ra=TRA, dec=TDEC,
unit=(u.deg, u.deg),frame='icrs'), radius=field_of_view * u.deg, catalog =
'SDSS12') *
I get only 50 calibrators for my parameters, which leaves me with nothing
to whittle!

Am I running afoul of a constraint?  Vizier pulls down 23 default columns
and there are 140 or so total, so the cut seems a bit too dramatic.  If I
am hitting a constraint, I will need to specify each of my columns up front.

Thanks again,

Bob C.

----------------------------------------------------------------------

Message: 1
Date: Tue, 21 Jul 2020 10:44:16 -0400
From: Adam Ginsburg <adam.g.ginsburg at gmail.com>
To: Astronomical Python mailing list <astropy at python.org>
Subject: Re: [AstroPy] Astroquery Using Vizier: How Do I Retrieve SDSS
        Photo Object Attribute "flags"?
Message-ID:
        <CAEBNSwbh1HEbsz3mRSVBFN0dq=BCfUV2+o6VOmwaAm_zCjaCRA at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

If you want to include additional columns in vizier queries, follow these
instructions:
https://astroquery.readthedocs.io/en/latest/vizier/vizier.html#specifying-keywords-output-columns-and-constraints-on-columns


for example, to get *all* columns, you would do:
Vizier(columns=["**"]).query_region(coordinates.SkyCoord(180*u.deg,
0*u.deg, frame='fk5'), radius=field_of_view * u.deg, catalog = 'SDSS12')
note the double-asterisks

On Tue, Jul 21, 2020 at 10:30 AM Robert Carr <rspencercarr at gmail.com> wrote:

> I hope that this question is "in bounds," Astroquery being an Astropy
 affiliated
> package.
>
> I am querying the SDSS-12 catalog for photometric data using Vizier.  The
> SDSS field "flags" would be ideal to help me assess the photometric
quality
> of the SDSS measurements for each object: this field includes a
hexadecimal
> code that captures issues with the photometry such as pixel saturation,
> etc.
>
> My query line is:
>         targetobj = Vizier.query_region(STAR_NAME, radius=field_of_view *
> u.deg, catalog = 'SDSS12')
>
> The line in my code to collect 'flags' does not work (where
> targetobjresults is my results from querying SDSS):
>
> targetobjresults.append({'flags': targetobj[0]['flags'][0]})
>
>
> I receive the following error message, which I have discovered is because
Vizier
> returns only 23 columns of the SDSS data.
>          Traceback (most recent call last):
>
>   File "<stdin>", line 32, in <module>
>
>   File
> "C:\Users\mawgui\AppData\Local\Programs\Python\Python36\lib\site-packages\
> astropy\table\table.py", line 1222, in __getitem__
>
>     return self.columns[item]
>
>   File
> "C:\Users\mawgui\AppData\Local\Programs\Python\Python36\lib\site-packages\
> astropy\table\table.py", line 106, in __getitem__
>
>     return OrderedDict.__getitem__(self, item)
>
> KeyError: 'flags'
>
>
> Is there a way to query SDSS through Vizier to get the hexadecimal 'flags'
> for each object?  Or is there another workaround?  I appreciate guidance
on
> how to make this happen.
>
> Thank you!
>
> Bob C

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20200725/1736c44f/attachment.html>


More information about the AstroPy mailing list