pythonastronomyastropyastroquery

Criteria Query on SIMBAD database with astroquery.simbad


I have a big amount of criteria queries to do on SIMBAD database like this one :

region(circle, 29.20 -0.214, 0.60d) & otypes in ('ClG','SCG','GrG','CGG','SC?','C?G','Gr?')& redshift > 0.037 & redshift < 0.0531

This query gives all objects of types ('ClG','SCG','GrG','CGG','SC?','C?G','Gr?') within a circle of 0.6 degrees centered at 29.20 -0.214, and with redshift between 0.037 and 0.0531. It works well on the web interface http://simbad.u-strasbg.fr/simbad/sim-fsam and for this example I get one object.

The problem is that I need to do a huge amount of query like this. I tried to use this package python http://astroquery.readthedocs.io/en/latest/simbad/simbad.html but I didn't succeed to do it work properly.

from astroquery.simbad import Simbad

from astropy import coordinates

query_cr="region(circle, 29.20 -0.214, 0.60d)" types=('ClG','SCG','GrG','CGG','SC?','C?G','Gr?') 
result =Simbad.query_criteria(query_cr, otype=types)

Like this it does not work at all.

I tried with putting just one item for the otype

types='ClG'

and with this I get a table with a huge amount ogf objects (even the circle selection at 0.6 degrees does not work)

My goal is to extract the name, type, coordinate and redshifts of each of the objects matched with my criteria query.

Thanks you very much in advance for your help !


Solution

  • You were pretty close with your original attempt:

    qry = ("region(circle, 29.20 -0.214, 0.60d) &"
           " otypes in ('ClG','SCG','GrG','CGG','SC?','C?G','Gr?') &"
           " redshift > 0.037 & redshift < 0.0531")
    result = Simbad.query_criteria(qry)
    result
    

    the result is:

    <Table masked=True length=1>
       MAIN_ID        RA        DEC    RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH     COO_BIBCODE
                   "h:m:s"    "d:m:s"                       mas          mas           deg
        object      str13      str13    int16   int16     float32      float32        int16       str1        str1             object
    ------------- ---------- --------- ------- -------- ------------ ------------ ------------- -------- -------------- -------------------
    SDSSCGB 51414 01 55 07.2 -00 11 04       5        5           --           --             0        D              O 2009MNRAS.395..255M
    

    Note that I only split this up into multiple lines for readability; qry is just the full string you would pass to SIMBAD. This is the resulting query astroquery sends:

    votable {main_id,coordinates}
    votable open
    query sample  region(circle, 29.20 -0.214, 0.60d) & otypes in ('ClG','SCG','GrG','CGG','SC?','C?G','Gr?')& redshift > 0.037 & redshift < 0.0531
    votable close