How to use Astropy/Astroquery to get Sloan magnitudes

1.5k Views Asked by At

I would like to create a script to download the magnitudes from a set of objects. For example the ones which appear here:

http://mirror.sdss3.org/spectrumDetail?plateid=556&mjd=51991&fiber=312

As an input I have the object coordinates (which I get from the astroquery get_spec method as I know the object's mjd, plate and fiber). I am trying to use the example on the astroquery site:

from astropy import coordinates as coords
from astroquery.sdss import SDSS

co = coords.SkyCoord(143.50993, 55.239775, unit="deg")
result = SDSS.query_region(co)
imgs = SDSS.get_images(co, band = ['g', 'r'])

However, from the images downloaded I cannot find the magnitudes. How can I find the magnitudes of my objects?

1

There are 1 best solutions below

1
Simon Gibbons On BEST ANSWER

From the sound of things instead you want the properties of your object that are spat out of the SDSS pipeline, crossmatched by coordinates.

To do this have a look at the SDSS.query_crossid method. This allows you to specify which of the photometry columns that you want.

As I don't know the science that you are doing you'll have to work out what would be best for your targets. Have a look here for the various measures of magnitude that are available.

As an example if I wanted the g and r band model magnitudes for your object I would do:

In [31]: result = SDSS.query_crossid(co, photoobj_fields=['modelMag_g', 'modelMag_i'])

In [32]: print result
Out[32]: 
obj_id        objID        modelMag_g modelMag_i       obj_id1        type 
 str5         int64         float64    float64          int64         str6 
------ ------------------- ---------- ---------- ------------------- ------
 obj_0 1237654382516699210   17.57231   18.13992 1237654382516699210 GALAXY