# [AstroPy] Query for Messier objects in a given region

Eric Jensen ejensen1 at swarthmore.edu
Sun Apr 11 10:40:29 EDT 2021

```Hi Jim,

The total number of Messier objects is small, so I think you might just want to download and store locally a table of their coordinates and properties (e.g. in a spreadsheet) that you could read into your code each time.  Then in your Python code you could do something like this:

- convert to astropy table (Table.from_pandas)
- use astropy coordinate routines to calculate angular distance from your field center to each object in the table
- apply a filter to keep only those objects within a given angular distance.

This would have the advantage that you could edit that Messier list to tweak it however you wanted, e.g. to combine columns from different sources if one has coords and another has magnitudes.

If you can’t find a suitable Messier list, you could even write a one-time routine to loop over Simbad calls to build and store it, but I bet you can find most/all of what you need already formatted somewhere.

Astropy docs will help you with specific syntax, but this should get you started.

Eric

> On Apr 11, 2021, at 9:08 AM, Jim Singh <jimmyboysingh at gmail.com> wrote:
>
> ﻿
> Hi, I've put together a sky simulation using mathplotlib to display and name the bright stars (size based on magnitude) within a certain radius of a given planet. I convert the RA/Dec of each object to Alt/Az based on my location and current time, and then flip the Az axis so that the field plot matches the sky through my finderscope. What I'd like to finally do is include and label any Messier catalog object in the same FOV of the plot.
> So is there an online catalog you would suggest that can be queried by region to return the following for objects in said region:
> -Messier Number
> -Apparent Magnitude (preferable but not essential)
> -RA/Dec
> I see SIMBAD supports  query for a specified Messier object like this:
> result_table = Simbad.query_object("m83")
> and there's also Simbad.query_region and Simbad.query_criteria
> but I am not sure how they might be used for the stated objective (if at all)?
> Regards,
> Jim
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2483 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/astropy/attachments/20210411/39457442/attachment-0001.bin>
```