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

Adam Ginsburg adam.g.ginsburg at gmail.com
Tue Jul 21 10:44:16 EDT 2020


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>
> <#m_4046137496446091284_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> _______________________________________________
> 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: <http://mail.python.org/pipermail/astropy/attachments/20200721/773be4c1/attachment.html>


More information about the AstroPy mailing list