nb3. Query objects by proposal id or bibliography code |
The relevant columns in the ALMA TAP service are
We first import the required modules, and link to the TAP service.
import numpy as np
import pyvo
import pandas as pd
pd.set_option('display.max_columns', None)
service = pyvo.dal.TAPService("https://almascience.eso.org/tap") # for the EU ALMA TAP service
# service = pyvo.dal.TAPService("https://almascience.nao.ac.jp/tap") # for the EA ALMA TAP service
# service = pyvo.dal.TAPService("https://almascience.nrao.edu/tap") # for the NA ALMA TAP service
def query_proposal_id(service, proposal_id):
"""Queries for an ALMA project code
service pyvo TAPService instance
proposal_id ALMA proposal id in the form "2012.1.00123.S" or in the form "ADS/JAO.ALMA#2012.1.00123.S"
returns pandas table
"""
query = f"""
SELECT *
FROM ivoa.obscore
WHERE obs_publisher_did like '%{proposal_id}%'
"""
return service.search(query).to_table().to_pandas()
def query_bib_reference(service, bibcode):
"""Queries for ALMA observations that have been used in a particular observation
service pyvo TAPService instance
bibcode BibCode in the NASA ADS format, e.g. "2017ApJ...834..140R. ""
Also supports part of the BibCode, e.g. "Natur"
returns pandas table
"""
query = f"""
SELECT *
FROM ivoa.obscore
WHERE bib_reference like '%{bibcode}%'
"""
return service.search(query).to_table().to_pandas()
This function queries Member Observation Unit Set (OUS) IDs. Member OUS correspond to an independent dataset.
def query_member_ous(service, member_ous_id):
"""Queries for an ALMA Member OUS dataset
service pyvo TAPService instance
member_ous_id ALMA Member OUS dataset ID in the form "uid://A001/X123/X456"
or in the form "uid___A001_X123_X456"
returns pandas table
"""
query = f"""
SELECT *
FROM ivoa.obscore
WHERE member_ous_uid = '{member_ous_id.replace("___","://").replace("_","/")}'
"""
return service.search(query).to_table().to_pandas()
def query_proposal_id_and_alma_source_name(service, proposal_id, source_name):
"""queries for a an ALMA project code and also for an ALMA source name
service pyvo TAPService instance
proposal_id ALMA proposal id in the form "2012.1.00123.S" or
in the form "ADS/JAO.ALMA#2012.1.00123.S"
source_name ALMA source name as given by the PI in the proposal
returns pandas table
"""
query = f"""
SELECT *
FROM ivoa.obscore
WHERE obs_publisher_did like '%{proposal_id}%'
AND target_name like '%{source_name}%'
"""
return service.search(query).to_table().to_pandas()
output = query_proposal_id(service, '2016.1.01308.S')
output.head(5) ### showing only 5 rows
access_url | access_format | proposal_id | data_rights | gal_longitude | gal_latitude | obs_publisher_did | obs_collection | facility_name | instrument_name | obs_id | dataproduct_type | calib_level | target_name | s_ra | s_dec | s_fov | s_region | s_resolution | t_min | t_max | t_exptime | t_resolution | em_min | em_max | em_res_power | pol_states | o_ucd | band_list | em_resolution | authors | pub_abstract | publication_year | proposal_abstract | schedblock_name | proposal_authors | sensitivity_10kms | cont_sensitivity_bandwidth | pwv | group_ous_uid | member_ous_uid | asdm_uid | obs_title | type | scan_intent | science_observation | spatial_scale_max | bandwidth | antenna_arrays | is_mosaic | obs_release_date | spatial_resolution | frequency_support | frequency | velocity_resolution | obs_creator_name | pub_title | first_author | qa2_passed | bib_reference | science_keyword | scientific_category | lastModified | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | http://almascience.org/aq?member_ous_id=uid://... | text/html | 2016.1.01308.S | Public | 77.437948 | -38.582458 | ADS/JAO.ALMA#2016.1.01308.S | ALMA | JAO | ALMA | uid://A001/X879/X314 | cube | 2 | J2232+1143 | 338.151704 | 11.730807 | 0.015766 | Polygon ICRS 338.151704 11.722924 338.150195 1... | 0.576869 | 57699.019868 | 57895.462736 | 907.20 | 907.20 | 0.003058 | 0.003118 | 100396.011062 | /XX/YY/ | phot.flux.density;phys.polarization | 3 | 307.023917 | Banerji, Manda; Jones, Gareth C.; Carniani, St... | We present an unprecedented view of the morpho... | 2018 | Newly discovered hyper-luminous, dusty broad-l... | ULASJ231_a_03_TM1 | Jones, Gareth; Wethers, Clare; Hewett, Paul; M... | 1.390184 | 0.029457 | 1.78126 | uid://A001/X879/X313 | uid://A001/X879/X314 | uid://A002/Xba460f/X1d9 | Do Hyper-Luminous Dusty Quasars at z=2.5 Live ... | S | BANDPASS FLUX WVR | F | 6.946170 | 1.875000e+09 | A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D... | F | 2018-08-12T19:08:02.000 | 0.576869 | [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,... | 102.591895 | 2706.661386 | Banerji, Manda | Jet-driven Galaxy-scale Gas Outflows in the Hy... | Banerji, Manda Husemann, Bernd | T | 2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN... | High-z Active Galactic Nuclei (AGN) | Active galaxies | 2021-09-30T16:34:41.133 |
1 | http://almascience.org/aq?member_ous_id=uid://... | text/html | 2016.1.01308.S | Public | 77.437948 | -38.582458 | ADS/JAO.ALMA#2016.1.01308.S | ALMA | JAO | ALMA | uid://A001/X879/X314 | cube | 2 | J2232+1143 | 338.151704 | 11.730807 | 0.015766 | Polygon ICRS 338.151704 11.722924 338.150195 1... | 0.576869 | 57699.019868 | 57895.462736 | 907.20 | 907.20 | 0.003090 | 0.003150 | 99372.311222 | /XX/YY/ | phot.flux.density;phys.polarization | 3 | 307.023917 | Banerji, Manda; Jones, Gareth C.; Carniani, St... | We present an unprecedented view of the morpho... | 2018 | Newly discovered hyper-luminous, dusty broad-l... | ULASJ231_a_03_TM1 | Jones, Gareth; Wethers, Clare; Hewett, Paul; M... | 1.509001 | 0.029457 | 1.78126 | uid://A001/X879/X313 | uid://A001/X879/X314 | uid://A002/Xba460f/X1d9 | Do Hyper-Luminous Dusty Quasars at z=2.5 Live ... | S | BANDPASS FLUX WVR | F | 6.946170 | 1.875000e+09 | A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D... | F | 2018-08-12T19:08:02.000 | 0.576869 | [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,... | 102.591895 | 2706.661386 | Banerji, Manda | Jet-driven Galaxy-scale Gas Outflows in the Hy... | Banerji, Manda Husemann, Bernd | T | 2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN... | High-z Active Galactic Nuclei (AGN) | Active galaxies | 2021-09-30T16:34:41.133 |
2 | http://almascience.org/aq?member_ous_id=uid://... | text/html | 2016.1.01308.S | Public | 77.437948 | -38.582458 | ADS/JAO.ALMA#2016.1.01308.S | ALMA | JAO | ALMA | uid://A001/X879/X314 | cube | 2 | J2232+1143 | 338.151704 | 11.730807 | 0.015766 | Polygon ICRS 338.151704 11.722924 338.150195 1... | 0.576869 | 57699.019868 | 57895.462736 | 907.20 | 907.20 | 0.002725 | 0.002772 | 110760.976427 | /XX/YY/ | phot.flux.density;phys.polarization | 3 | 307.023917 | Banerji, Manda; Jones, Gareth C.; Carniani, St... | We present an unprecedented view of the morpho... | 2018 | Newly discovered hyper-luminous, dusty broad-l... | ULASJ231_a_03_TM1 | Jones, Gareth; Wethers, Clare; Hewett, Paul; M... | 1.315095 | 0.029457 | 1.78126 | uid://A001/X879/X313 | uid://A001/X879/X314 | uid://A002/Xba460f/X1d9 | Do Hyper-Luminous Dusty Quasars at z=2.5 Live ... | S | BANDPASS FLUX WVR | F | 6.946170 | 1.875000e+09 | A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D... | F | 2018-08-12T19:08:02.000 | 0.576869 | [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,... | 102.591895 | 2706.661386 | Banerji, Manda | Jet-driven Galaxy-scale Gas Outflows in the Hy... | Banerji, Manda Husemann, Bernd | T | 2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN... | High-z Active Galactic Nuclei (AGN) | Active galaxies | 2021-09-30T16:34:41.133 |
3 | http://almascience.org/aq?member_ous_id=uid://... | text/html | 2016.1.01308.S | Public | 77.437948 | -38.582458 | ADS/JAO.ALMA#2016.1.01308.S | ALMA | JAO | ALMA | uid://A001/X879/X314 | cube | 2 | J2232+1143 | 338.151704 | 11.730807 | 0.015766 | Polygon ICRS 338.151704 11.722924 338.150195 1... | 0.576869 | 57699.019868 | 57895.462736 | 907.20 | 907.20 | 0.002750 | 0.002798 | 109737.271411 | /XX/YY/ | phot.flux.density;phys.polarization | 3 | 307.023917 | Banerji, Manda; Jones, Gareth C.; Carniani, St... | We present an unprecedented view of the morpho... | 2018 | Newly discovered hyper-luminous, dusty broad-l... | ULASJ231_a_03_TM1 | Jones, Gareth; Wethers, Clare; Hewett, Paul; M... | 1.320847 | 0.029457 | 1.78126 | uid://A001/X879/X313 | uid://A001/X879/X314 | uid://A002/Xba460f/X1d9 | Do Hyper-Luminous Dusty Quasars at z=2.5 Live ... | S | BANDPASS FLUX WVR | F | 6.946170 | 1.875000e+09 | A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D... | F | 2018-08-12T19:08:02.000 | 0.576869 | [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,... | 102.591895 | 2706.661386 | Banerji, Manda | Jet-driven Galaxy-scale Gas Outflows in the Hy... | Banerji, Manda Husemann, Bernd | T | 2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN... | High-z Active Galactic Nuclei (AGN) | Active galaxies | 2021-09-30T16:34:41.133 |
4 | http://almascience.org/aq?member_ous_id=uid://... | text/html | 2016.1.01308.S | Public | 80.570801 | -53.100330 | ADS/JAO.ALMA#2016.1.01308.S | ALMA | JAO | ALMA | uid://A001/X879/X314 | cube | 2 | ULASJ2315+0143 | 348.984300 | 1.730694 | 0.015766 | Polygon ICRS 348.984300 1.738577 348.985778 1.... | 0.576861 | 57699.019868 | 57895.486087 | 5866.56 | 5866.56 | 0.002750 | 0.002798 | 109737.271411 | /XX/YY/ | phot.flux.density;phys.polarization | 3 | 307.019722 | Banerji, Manda; Jones, Gareth C.; Carniani, St... | We present an unprecedented view of the morpho... | 2018 | Newly discovered hyper-luminous, dusty broad-l... | ULASJ231_a_03_TM1 | Jones, Gareth; Wethers, Clare; Hewett, Paul; M... | 0.486219 | 0.010837 | 1.78126 | uid://A001/X879/X313 | uid://A001/X879/X314 | uid://A002/Xba460f/X1d9 | Do Hyper-Luminous Dusty Quasars at z=2.5 Live ... | S | TARGET | T | 6.946075 | 1.875000e+09 | A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D... | F | 2018-08-12T19:08:02.000 | 0.576861 | [95.16..97.03GHz,976.56kHz,554uJy/beam@10km/s,... | 102.593370 | 2706.661386 | Banerji, Manda | Jet-driven Galaxy-scale Gas Outflows in the Hy... | Banerji, Manda Husemann, Bernd | T | 2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN... | High-z Active Galactic Nuclei (AGN) | Active galaxies | 2021-09-30T16:34:41.133 |
Which were the science targets in these observations?
np.unique(output[output['science_observation']=='T']['target_name'])
array(['ULASJ1234+0907', 'ULASJ2315+0143'], dtype=object)
Which were the calibrators used in these observations?
np.unique(output[output['science_observation']=='F']['target_name'])
array(['Ganymede', 'J1229+0203', 'J1238+0723', 'J1239+0730', 'J2232+1143', 'J2320+0513', 'J2326+0112', 'Neptune'], dtype=object)
Query the ASDM UIDs associated with a specific source observed multiple times within different observation sets.
source_name = 'J1229+0203'
# List of data sets where this source might be included
proposal_id_list =['ADS/JAO.ALMA#2015.1.00129.S', 'ADS/JAO.ALMA#2015.1.00329.S', 'ADS/JAO.ALMA#2015.1.00587.S', 'ADS/JAO.ALMA#2015.1.01012.S', 'ADS/JAO.ALMA#2016.1.00972.S', 'ADS/JAO.ALMA#2016.1.01308.S']
uids = []
for proposal_id in proposal_id_list:
output = query_proposal_id_and_alma_source_name(service, proposal_id, source_name)
if len(output) > 0:
print(f"source {source_name} found in {proposal_id}")
print(f"Is a science observation? {output['science_observation'].values}")
uids += list(np.unique(output['member_ous_uid']))
else:
print(f"source {source_name} NOT found in {proposal_id}")
print("List of member_ous_uid that contain the particular source name and that are part of the proposal id list:")
print(uids)
source J1229+0203 NOT found in ADS/JAO.ALMA#2015.1.00129.S source J1229+0203 found in ADS/JAO.ALMA#2015.1.00329.S Is a science observation? ['F' 'F' 'F' 'F'] source J1229+0203 found in ADS/JAO.ALMA#2015.1.00587.S Is a science observation? ['F' 'F' 'F' 'F' 'F' 'F' 'F' 'F'] source J1229+0203 found in ADS/JAO.ALMA#2015.1.01012.S Is a science observation? ['F' 'F' 'F' 'F'] source J1229+0203 found in ADS/JAO.ALMA#2016.1.00972.S Is a science observation? ['F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F'] source J1229+0203 found in ADS/JAO.ALMA#2016.1.01308.S Is a science observation? ['F' 'F' 'F' 'F' 'F' 'F' 'F' 'F'] List of member_ous_uid that contain the particular source name and that are part of the proposal id list: ['uid://A001/X2fe/Xbd5', 'uid://A001/X2fe/X80', 'uid://A001/X2fe/X82', 'uid://A001/X5a3/X83', 'uid://A001/X87d/X6d4', 'uid://A001/X899/X7e', 'uid://A001/X899/X82', 'uid://A001/X879/X318', 'uid://A001/X879/X31c']