This example shows how to loop over a list of sources and query each of them in turn. It will be slow if you have a large number of objects, but astroquery will cache your results to make subsequent searches faster. Of course, if you want to re-query the archive each time, you can just pass the keyword cache=False
to disable it.
First, import the ALMA tool:
from astroquery.alma import Alma
Just to make sure you're up to date, you can check the version:
import astroquery
print(astroquery.__version__)
0.3.dev2853
We'll do a search for all 110 Messier objects
MessierNames = ["M{0:d}".format(ii) for ii in range(1,111)]
Alma.query_object
will query an object by name after sending the name to the SIMBAD/SESAME name resolver. cache=True
is the default, but you can change it here if you'd like.
MessierALMAData = {name: Alma.query_object(name, cache=True) for name in MessierNames}
Each entry in the dictionary is a an astropy.table.Table
, which contains a lot more information than you probably want at first glance (but you may want it all later). So we'll just find out the unique set of ALMA bands that have been observed toward each source.
MessierALMABands = {name: set(MessierALMAData[name]['Band']) for name in MessierALMAData}
Then we filter that result by Messier objects that have been observed in at least one band. (an empty set is False
)
observed_messier_objects = {name: MessierALMABands[name] for name in MessierALMABands if MessierALMABands[name]}
observed_messier_objects
{'M104': {3, 6, 7, 9}, 'M17': {6}, 'M18': {6}, 'M42': {3, 6, 7, 9}, 'M43': {3, 6, 7, 9}, 'M58': {3}, 'M65': {3}, 'M66': {3}, 'M77': {3, 7, 9}, 'M80': {6, 7}, 'M83': {3}, 'M87': {7}}
len(observed_messier_objects)
12
So there are 12 observed Messier objects as of writing this document (April 13, 2015).
What if you have positions, not names?
from astropy import coordinates
from astropy import units as u
Make your coordinate list. I've chosen Galactic coordinates because I know they're at least moderately interesting. The last of these is Sgr B2, so it definitely has hits, but the others are unlikely to be observed.
coord_list = coordinates.SkyCoord([(1.0, 2.0), (-50.0, 1.0), (0.6667,-0.03)]*u.deg, frame='galactic')
coord_list
<SkyCoord (Galactic): (l, b) in deg [(1.0, 2.0), (310.0, 1.0), (0.6667, -0.03)]>
You need to use the query_region
method for coordinates. radius
is optional:
results = [Alma.query_region(coord, radius=1*u.arcmin) for coord in coord_list]
Each entry in the results
list is an astropy Table
. You can just look at its length to figure out if there were any observations performed.
[len(x) for x in results]
[0, 0, 9]
The last entry has some hits! We can inspect the table directly:
results[-1]
Project code | Source name | RA | Dec | Band | Frequency resolution | Integration | Release date | Frequency support | Velocity resolution | Pol products | Observation date | PI name | PWV | Member ous id | Asdm uid | Project title | Project type | Scan intent |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | kHz | s | GHz | m / s | mm | ||||||||||||
string128 | string2048 | float64 | float64 | int32 | float64 | float64 | object | string21600 | float64 | string512 | object | string2048 | float32 | string256 | string256 | string2048 | string128 | string2048 |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 304.88400000000001 | 2014-09-12 | [95.02..96.90GHz,488.28kHz, XX] U [96.85..98.72GHz,488.28kHz, XX] U [107.02..108.89GHz,488.28kHz, XX] U [108.84..110.72GHz,488.28kHz, XX] | 1422.9831324665756 | XX | 2012-07-04 05:37:48 | Belloche, Arnaud | 2.033288 | uid://A002/X327408/X14 | uid://A002/X44ddb2/X64a | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 376.07100000000003 | 2014-09-12 | [87.72..89.60GHz,488.28kHz, XX] U [89.55..91.42GHz,488.28kHz, XX] U [99.72..101.60GHz,488.28kHz, XX] U [101.55..103.42GHz,488.28kHz, XX] | 1531.6503853223319 | XX | 2012-06-05 09:03:02 | Belloche, Arnaud | 0.66231287 | uid://A002/X327408/X10 | uid://A002/X41f8d2/X8e0 | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 547.71100000000001 | 2014-09-12 | [95.02..96.90GHz,488.28kHz, XX] U [96.85..98.72GHz,488.28kHz, XX] U [107.02..108.89GHz,488.28kHz, XX] U [108.84..110.72GHz,488.28kHz, XX] | 1422.9831324665756 | XX | 2012-08-01 02:31:53 | Belloche, Arnaud | 1.3851253 | uid://A002/X327408/X14 | uid://A002/X47ed8e/X3cd | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 550.17899999999997 | 2014-09-12 | [95.02..96.90GHz,488.28kHz, XX] U [96.85..98.72GHz,488.28kHz, XX] U [107.02..108.89GHz,488.28kHz, XX] U [108.84..110.72GHz,488.28kHz, XX] | 1422.9831324665756 | XX | 2012-08-10 00:45:31 | Belloche, Arnaud | 1.7215753 | uid://A002/X327408/X14 | uid://A002/X494155/X23a | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 619.88800000000003 | 2014-09-12 | [87.72..89.60GHz,488.28kHz, XX] U [89.55..91.42GHz,488.28kHz, XX] U [99.72..101.60GHz,488.28kHz, XX] U [101.55..103.42GHz,488.28kHz, XX] | 1531.6503853223319 | XX | 2012-07-01 07:03:55 | Belloche, Arnaud | 0.47709116 | uid://A002/X327408/X10 | uid://A002/X449249/Xde | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 624.85599999999999 | 2014-09-12 | [91.37..93.25GHz,488.28kHz, XX] U [93.20..95.07GHz,488.28kHz, XX] U [103.37..105.25GHz,488.28kHz, XX] U [105.19..107.07GHz,488.28kHz, XX] | 1475.3184447597021 | XX | 2012-06-06 08:20:02 | Belloche, Arnaud | 0.52463043 | uid://A002/X327408/X12 | uid://A002/X4210d0/X815 | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 629.65200000000004 | 2014-09-12 | [91.37..93.25GHz,488.28kHz, XX] U [93.20..95.07GHz,488.28kHz, XX] U [103.37..105.25GHz,488.28kHz, XX] U [105.19..107.07GHz,488.28kHz, XX] | 1475.3184447597021 | XX | 2012-06-18 07:29:08 | Belloche, Arnaud | 1.1841874 | uid://A002/X327408/X12 | uid://A002/X436934/X28 | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 753.61000000000001 | 2014-09-12 | [87.72..89.60GHz,488.28kHz, XX] U [89.55..91.42GHz,488.28kHz, XX] U [99.72..101.60GHz,488.28kHz, XX] U [101.55..103.42GHz,488.28kHz, XX] | 1531.6503853223319 | XX | 2012-07-03 06:36:37 | Belloche, Arnaud | 1.5690569 | uid://A002/X327408/X10 | uid://A002/X44c3c1/X6cc | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
2011.0.00017.S | SgrB2-N | 266.83279166666671 | -28.371111111111112 | 3 | 488.28125 | 855.72400000000005 | 2014-09-12 | [84.09..85.96GHz,488.28kHz, XX] U [85.90..87.77GHz,488.28kHz, XX] U [96.15..98.02GHz,488.28kHz, XX] U [97.90..99.77GHz,488.28kHz, XX] | 1591.7887038699191 | XX | 2012-08-27 01:05:09 | Belloche, Arnaud | 2.884989 | uid://A002/X327408/Xe | uid://A002/X4b29af/X403 | Expanding the frontiers of chemical complexity with ALMA | S | TARGET |
Or you can look at what bands were observed:
set(results[-1]['Band'])
{3}