{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "<table width=\"100%\" style=\"padding:0; margin-left:-6px;\">\n",
    "    <tr style=\"padding=0;\" width=\"100%\">\n",
    "        <td width=\"auto\">\n",
    "           <hr style=\"border:2px solid darkblue\">\n",
    "            <h1> nb3. Query objects by proposal id or bibliography code</h1>\n",
    "           <hr style=\"border:2px solid darkblue\">\n",
    "        </td>\n",
    "        <td width=\"60px\">\n",
    "           <img src=\"ALMAsmall.png\" align=\"right\"/> \n",
    "        </td>\n",
    "    </tr>\n",
    "</table>    \n",
    "        \n",
    "\n",
    "The relevant columns in the ALMA TAP service are \n",
    "* *proposal_id*\n",
    "* *obs_publisher_did* \n",
    "* *bib_reference*\n",
    "* *member_ous_uid*\n",
    "--------- ----- -----\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We first import the required modules, and link to the TAP service."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:39.740498Z",
     "iopub.status.busy": "2021-11-16T10:26:39.739513Z",
     "iopub.status.idle": "2021-11-16T10:26:40.666782Z",
     "shell.execute_reply": "2021-11-16T10:26:40.665788Z"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pyvo\n",
    "import pandas as pd\n",
    "pd.set_option('display.max_columns', None)\n",
    "\n",
    "service = pyvo.dal.TAPService(\"https://almascience.eso.org/tap\")      # for the EU ALMA TAP service\n",
    "\n",
    "# service = pyvo.dal.TAPService(\"https://almascience.nao.ac.jp/tap\")  # for the EA ALMA TAP service\n",
    "# service = pyvo.dal.TAPService(\"https://almascience.nrao.edu/tap\")   # for the NA ALMA TAP service"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<hr style=\"border:2px solid darkblue\"> </hr>\n",
    "\n",
    "## Query a proposal ID\n",
    "\n",
    "<hr style=\"border:2px solid darkblue\"> </hr>\n",
    "\n",
    "This function queries ALMA proposal IDs, also called project codes.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:40.675200Z",
     "iopub.status.busy": "2021-11-16T10:26:40.674575Z",
     "iopub.status.idle": "2021-11-16T10:26:40.677518Z",
     "shell.execute_reply": "2021-11-16T10:26:40.676528Z"
    }
   },
   "outputs": [],
   "source": [
    "def query_proposal_id(service, proposal_id):\n",
    "    \"\"\"Queries for an ALMA project code\n",
    "    \n",
    "       service         pyvo TAPService instance\n",
    "       proposal_id     ALMA proposal id in the form \"2012.1.00123.S\" or in the form \"ADS/JAO.ALMA#2012.1.00123.S\"\n",
    "       \n",
    "       returns         pandas table\n",
    "       \"\"\"\n",
    "\n",
    "    query = f\"\"\" \n",
    "            SELECT *  \n",
    "            FROM ivoa.obscore  \n",
    "            WHERE obs_publisher_did like '%{proposal_id}%' \n",
    "            \"\"\"    \n",
    "    \n",
    "    return service.search(query).to_table().to_pandas()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<hr style=\"border:2px solid darkblue\"> </hr>\n",
    "\n",
    "\n",
    "## Query a bibliography code\n",
    "\n",
    "<hr style=\"border:2px solid darkblue\"> </hr>\n",
    "\n",
    "This function queries (part of) BibCodes as given out by [NASA ADS](https://ui.adsabs.harvard.edu).\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:40.684191Z",
     "iopub.status.busy": "2021-11-16T10:26:40.683418Z",
     "iopub.status.idle": "2021-11-16T10:26:40.686748Z",
     "shell.execute_reply": "2021-11-16T10:26:40.686054Z"
    }
   },
   "outputs": [],
   "source": [
    "def query_bib_reference(service, bibcode):\n",
    "    \"\"\"Queries for ALMA observations that have been used in a particular observation\n",
    "    \n",
    "       service         pyvo TAPService instance\n",
    "       bibcode         BibCode in the NASA ADS format, e.g. \"2017ApJ...834..140R. \"\"\n",
    "                       Also supports part of the BibCode, e.g. \"Natur\"\n",
    "       \n",
    "       returns         pandas table\n",
    "    \"\"\"\n",
    "    \n",
    "    query = f\"\"\" \n",
    "            SELECT *  \n",
    "            FROM ivoa.obscore  \n",
    "            WHERE bib_reference like '%{bibcode}%' \n",
    "            \"\"\"\n",
    "\n",
    "    return service.search(query).to_table().to_pandas()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<hr style=\"border:2px solid darkblue\"> </hr>\n",
    "\n",
    "\n",
    "## Query a Member OUS ID\n",
    "<hr style=\"border:2px solid darkblue\"> </hr>\n",
    "\n",
    "This function queries Member Observation Unit Set (OUS) IDs. Member OUS correspond to an independent dataset."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:40.692578Z",
     "iopub.status.busy": "2021-11-16T10:26:40.691821Z",
     "iopub.status.idle": "2021-11-16T10:26:40.694953Z",
     "shell.execute_reply": "2021-11-16T10:26:40.694265Z"
    }
   },
   "outputs": [],
   "source": [
    "def query_member_ous(service, member_ous_id):\n",
    "    \"\"\"Queries for an ALMA Member OUS dataset\n",
    "    \n",
    "       service         pyvo TAPService instance\n",
    "       member_ous_id   ALMA Member OUS dataset ID in the form \"uid://A001/X123/X456\" \n",
    "                       or in the form \"uid___A001_X123_X456\"\n",
    "                       \n",
    "       returns         pandas table\n",
    "    \"\"\"                       \n",
    "    \n",
    "    query = f\"\"\" \n",
    "            SELECT * \n",
    "            FROM ivoa.obscore  \n",
    "            WHERE member_ous_uid = '{member_ous_id.replace(\"___\",\"://\").replace(\"_\",\"/\")}'  \n",
    "            \"\"\"\n",
    "    \n",
    "    return service.search(query).to_table().to_pandas()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<hr style=\"border:2px solid darkblue\"> </hr>\n",
    "\n",
    "## Query a publication ID and a specific source\n",
    "<hr style=\"border:2px solid darkblue\"> </hr>\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:40.701453Z",
     "iopub.status.busy": "2021-11-16T10:26:40.700588Z",
     "iopub.status.idle": "2021-11-16T10:26:40.704207Z",
     "shell.execute_reply": "2021-11-16T10:26:40.703209Z"
    }
   },
   "outputs": [],
   "source": [
    "def query_proposal_id_and_alma_source_name(service, proposal_id, source_name):\n",
    "    \"\"\"queries for a an ALMA project code and also for an ALMA source name\n",
    "    \n",
    "       service         pyvo TAPService instance\n",
    "       proposal_id     ALMA proposal id in the form \"2012.1.00123.S\" or \n",
    "                       in the form \"ADS/JAO.ALMA#2012.1.00123.S\"\n",
    "       source_name     ALMA source name as given by the PI in the proposal                \n",
    "       \n",
    "       returns         pandas table\n",
    "    \"\"\"    \n",
    "    \n",
    "    query = f\"\"\"  \n",
    "            SELECT  *  \n",
    "            FROM ivoa.obscore  \n",
    "            WHERE obs_publisher_did like '%{proposal_id}%' \n",
    "            AND target_name like '%{source_name}%'  \n",
    "            \"\"\"\n",
    "    \n",
    "    return service.search(query).to_table().to_pandas()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "------------------------\n",
    "\n",
    "## Example 3a: List all observations carried on under a proposal ID"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:40.710844Z",
     "iopub.status.busy": "2021-11-16T10:26:40.710067Z",
     "iopub.status.idle": "2021-11-16T10:26:41.031593Z",
     "shell.execute_reply": "2021-11-16T10:26:41.030411Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>access_url</th>\n",
       "      <th>access_format</th>\n",
       "      <th>proposal_id</th>\n",
       "      <th>data_rights</th>\n",
       "      <th>gal_longitude</th>\n",
       "      <th>gal_latitude</th>\n",
       "      <th>obs_publisher_did</th>\n",
       "      <th>obs_collection</th>\n",
       "      <th>facility_name</th>\n",
       "      <th>instrument_name</th>\n",
       "      <th>obs_id</th>\n",
       "      <th>dataproduct_type</th>\n",
       "      <th>calib_level</th>\n",
       "      <th>target_name</th>\n",
       "      <th>s_ra</th>\n",
       "      <th>s_dec</th>\n",
       "      <th>s_fov</th>\n",
       "      <th>s_region</th>\n",
       "      <th>s_resolution</th>\n",
       "      <th>t_min</th>\n",
       "      <th>t_max</th>\n",
       "      <th>t_exptime</th>\n",
       "      <th>t_resolution</th>\n",
       "      <th>em_min</th>\n",
       "      <th>em_max</th>\n",
       "      <th>em_res_power</th>\n",
       "      <th>pol_states</th>\n",
       "      <th>o_ucd</th>\n",
       "      <th>band_list</th>\n",
       "      <th>em_resolution</th>\n",
       "      <th>authors</th>\n",
       "      <th>pub_abstract</th>\n",
       "      <th>publication_year</th>\n",
       "      <th>proposal_abstract</th>\n",
       "      <th>schedblock_name</th>\n",
       "      <th>proposal_authors</th>\n",
       "      <th>sensitivity_10kms</th>\n",
       "      <th>cont_sensitivity_bandwidth</th>\n",
       "      <th>pwv</th>\n",
       "      <th>group_ous_uid</th>\n",
       "      <th>member_ous_uid</th>\n",
       "      <th>asdm_uid</th>\n",
       "      <th>obs_title</th>\n",
       "      <th>type</th>\n",
       "      <th>scan_intent</th>\n",
       "      <th>science_observation</th>\n",
       "      <th>spatial_scale_max</th>\n",
       "      <th>bandwidth</th>\n",
       "      <th>antenna_arrays</th>\n",
       "      <th>is_mosaic</th>\n",
       "      <th>obs_release_date</th>\n",
       "      <th>spatial_resolution</th>\n",
       "      <th>frequency_support</th>\n",
       "      <th>frequency</th>\n",
       "      <th>velocity_resolution</th>\n",
       "      <th>obs_creator_name</th>\n",
       "      <th>pub_title</th>\n",
       "      <th>first_author</th>\n",
       "      <th>qa2_passed</th>\n",
       "      <th>bib_reference</th>\n",
       "      <th>science_keyword</th>\n",
       "      <th>scientific_category</th>\n",
       "      <th>lastModified</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>http://almascience.org/aq?member_ous_id=uid://...</td>\n",
       "      <td>text/html</td>\n",
       "      <td>2016.1.01308.S</td>\n",
       "      <td>Public</td>\n",
       "      <td>77.437948</td>\n",
       "      <td>-38.582458</td>\n",
       "      <td>ADS/JAO.ALMA#2016.1.01308.S</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>JAO</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>cube</td>\n",
       "      <td>2</td>\n",
       "      <td>J2232+1143</td>\n",
       "      <td>338.151704</td>\n",
       "      <td>11.730807</td>\n",
       "      <td>0.015766</td>\n",
       "      <td>Polygon ICRS 338.151704 11.722924 338.150195 1...</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>57699.019868</td>\n",
       "      <td>57895.462736</td>\n",
       "      <td>907.20</td>\n",
       "      <td>907.20</td>\n",
       "      <td>0.003058</td>\n",
       "      <td>0.003118</td>\n",
       "      <td>100396.011062</td>\n",
       "      <td>/XX/YY/</td>\n",
       "      <td>phot.flux.density;phys.polarization</td>\n",
       "      <td>3</td>\n",
       "      <td>307.023917</td>\n",
       "      <td>Banerji, Manda; Jones, Gareth C.; Carniani, St...</td>\n",
       "      <td>We present an unprecedented view of the morpho...</td>\n",
       "      <td>2018</td>\n",
       "      <td>Newly discovered hyper-luminous, dusty broad-l...</td>\n",
       "      <td>ULASJ231_a_03_TM1</td>\n",
       "      <td>Jones, Gareth; Wethers, Clare; Hewett, Paul; M...</td>\n",
       "      <td>1.390184</td>\n",
       "      <td>0.029457</td>\n",
       "      <td>1.78126</td>\n",
       "      <td>uid://A001/X879/X313</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>uid://A002/Xba460f/X1d9</td>\n",
       "      <td>Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...</td>\n",
       "      <td>S</td>\n",
       "      <td>BANDPASS FLUX WVR</td>\n",
       "      <td>F</td>\n",
       "      <td>6.946170</td>\n",
       "      <td>1.875000e+09</td>\n",
       "      <td>A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...</td>\n",
       "      <td>F</td>\n",
       "      <td>2018-08-12T19:08:02.000</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>[95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...</td>\n",
       "      <td>102.591895</td>\n",
       "      <td>2706.661386</td>\n",
       "      <td>Banerji, Manda</td>\n",
       "      <td>Jet-driven Galaxy-scale Gas Outflows in the Hy...</td>\n",
       "      <td>Banerji, Manda Husemann, Bernd</td>\n",
       "      <td>T</td>\n",
       "      <td>2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...</td>\n",
       "      <td>High-z Active Galactic Nuclei (AGN)</td>\n",
       "      <td>Active galaxies</td>\n",
       "      <td>2021-09-30T16:34:41.133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>http://almascience.org/aq?member_ous_id=uid://...</td>\n",
       "      <td>text/html</td>\n",
       "      <td>2016.1.01308.S</td>\n",
       "      <td>Public</td>\n",
       "      <td>77.437948</td>\n",
       "      <td>-38.582458</td>\n",
       "      <td>ADS/JAO.ALMA#2016.1.01308.S</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>JAO</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>cube</td>\n",
       "      <td>2</td>\n",
       "      <td>J2232+1143</td>\n",
       "      <td>338.151704</td>\n",
       "      <td>11.730807</td>\n",
       "      <td>0.015766</td>\n",
       "      <td>Polygon ICRS 338.151704 11.722924 338.150195 1...</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>57699.019868</td>\n",
       "      <td>57895.462736</td>\n",
       "      <td>907.20</td>\n",
       "      <td>907.20</td>\n",
       "      <td>0.003090</td>\n",
       "      <td>0.003150</td>\n",
       "      <td>99372.311222</td>\n",
       "      <td>/XX/YY/</td>\n",
       "      <td>phot.flux.density;phys.polarization</td>\n",
       "      <td>3</td>\n",
       "      <td>307.023917</td>\n",
       "      <td>Banerji, Manda; Jones, Gareth C.; Carniani, St...</td>\n",
       "      <td>We present an unprecedented view of the morpho...</td>\n",
       "      <td>2018</td>\n",
       "      <td>Newly discovered hyper-luminous, dusty broad-l...</td>\n",
       "      <td>ULASJ231_a_03_TM1</td>\n",
       "      <td>Jones, Gareth; Wethers, Clare; Hewett, Paul; M...</td>\n",
       "      <td>1.509001</td>\n",
       "      <td>0.029457</td>\n",
       "      <td>1.78126</td>\n",
       "      <td>uid://A001/X879/X313</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>uid://A002/Xba460f/X1d9</td>\n",
       "      <td>Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...</td>\n",
       "      <td>S</td>\n",
       "      <td>BANDPASS FLUX WVR</td>\n",
       "      <td>F</td>\n",
       "      <td>6.946170</td>\n",
       "      <td>1.875000e+09</td>\n",
       "      <td>A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...</td>\n",
       "      <td>F</td>\n",
       "      <td>2018-08-12T19:08:02.000</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>[95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...</td>\n",
       "      <td>102.591895</td>\n",
       "      <td>2706.661386</td>\n",
       "      <td>Banerji, Manda</td>\n",
       "      <td>Jet-driven Galaxy-scale Gas Outflows in the Hy...</td>\n",
       "      <td>Banerji, Manda Husemann, Bernd</td>\n",
       "      <td>T</td>\n",
       "      <td>2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...</td>\n",
       "      <td>High-z Active Galactic Nuclei (AGN)</td>\n",
       "      <td>Active galaxies</td>\n",
       "      <td>2021-09-30T16:34:41.133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>http://almascience.org/aq?member_ous_id=uid://...</td>\n",
       "      <td>text/html</td>\n",
       "      <td>2016.1.01308.S</td>\n",
       "      <td>Public</td>\n",
       "      <td>77.437948</td>\n",
       "      <td>-38.582458</td>\n",
       "      <td>ADS/JAO.ALMA#2016.1.01308.S</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>JAO</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>cube</td>\n",
       "      <td>2</td>\n",
       "      <td>J2232+1143</td>\n",
       "      <td>338.151704</td>\n",
       "      <td>11.730807</td>\n",
       "      <td>0.015766</td>\n",
       "      <td>Polygon ICRS 338.151704 11.722924 338.150195 1...</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>57699.019868</td>\n",
       "      <td>57895.462736</td>\n",
       "      <td>907.20</td>\n",
       "      <td>907.20</td>\n",
       "      <td>0.002725</td>\n",
       "      <td>0.002772</td>\n",
       "      <td>110760.976427</td>\n",
       "      <td>/XX/YY/</td>\n",
       "      <td>phot.flux.density;phys.polarization</td>\n",
       "      <td>3</td>\n",
       "      <td>307.023917</td>\n",
       "      <td>Banerji, Manda; Jones, Gareth C.; Carniani, St...</td>\n",
       "      <td>We present an unprecedented view of the morpho...</td>\n",
       "      <td>2018</td>\n",
       "      <td>Newly discovered hyper-luminous, dusty broad-l...</td>\n",
       "      <td>ULASJ231_a_03_TM1</td>\n",
       "      <td>Jones, Gareth; Wethers, Clare; Hewett, Paul; M...</td>\n",
       "      <td>1.315095</td>\n",
       "      <td>0.029457</td>\n",
       "      <td>1.78126</td>\n",
       "      <td>uid://A001/X879/X313</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>uid://A002/Xba460f/X1d9</td>\n",
       "      <td>Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...</td>\n",
       "      <td>S</td>\n",
       "      <td>BANDPASS FLUX WVR</td>\n",
       "      <td>F</td>\n",
       "      <td>6.946170</td>\n",
       "      <td>1.875000e+09</td>\n",
       "      <td>A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...</td>\n",
       "      <td>F</td>\n",
       "      <td>2018-08-12T19:08:02.000</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>[95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...</td>\n",
       "      <td>102.591895</td>\n",
       "      <td>2706.661386</td>\n",
       "      <td>Banerji, Manda</td>\n",
       "      <td>Jet-driven Galaxy-scale Gas Outflows in the Hy...</td>\n",
       "      <td>Banerji, Manda Husemann, Bernd</td>\n",
       "      <td>T</td>\n",
       "      <td>2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...</td>\n",
       "      <td>High-z Active Galactic Nuclei (AGN)</td>\n",
       "      <td>Active galaxies</td>\n",
       "      <td>2021-09-30T16:34:41.133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>http://almascience.org/aq?member_ous_id=uid://...</td>\n",
       "      <td>text/html</td>\n",
       "      <td>2016.1.01308.S</td>\n",
       "      <td>Public</td>\n",
       "      <td>77.437948</td>\n",
       "      <td>-38.582458</td>\n",
       "      <td>ADS/JAO.ALMA#2016.1.01308.S</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>JAO</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>cube</td>\n",
       "      <td>2</td>\n",
       "      <td>J2232+1143</td>\n",
       "      <td>338.151704</td>\n",
       "      <td>11.730807</td>\n",
       "      <td>0.015766</td>\n",
       "      <td>Polygon ICRS 338.151704 11.722924 338.150195 1...</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>57699.019868</td>\n",
       "      <td>57895.462736</td>\n",
       "      <td>907.20</td>\n",
       "      <td>907.20</td>\n",
       "      <td>0.002750</td>\n",
       "      <td>0.002798</td>\n",
       "      <td>109737.271411</td>\n",
       "      <td>/XX/YY/</td>\n",
       "      <td>phot.flux.density;phys.polarization</td>\n",
       "      <td>3</td>\n",
       "      <td>307.023917</td>\n",
       "      <td>Banerji, Manda; Jones, Gareth C.; Carniani, St...</td>\n",
       "      <td>We present an unprecedented view of the morpho...</td>\n",
       "      <td>2018</td>\n",
       "      <td>Newly discovered hyper-luminous, dusty broad-l...</td>\n",
       "      <td>ULASJ231_a_03_TM1</td>\n",
       "      <td>Jones, Gareth; Wethers, Clare; Hewett, Paul; M...</td>\n",
       "      <td>1.320847</td>\n",
       "      <td>0.029457</td>\n",
       "      <td>1.78126</td>\n",
       "      <td>uid://A001/X879/X313</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>uid://A002/Xba460f/X1d9</td>\n",
       "      <td>Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...</td>\n",
       "      <td>S</td>\n",
       "      <td>BANDPASS FLUX WVR</td>\n",
       "      <td>F</td>\n",
       "      <td>6.946170</td>\n",
       "      <td>1.875000e+09</td>\n",
       "      <td>A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...</td>\n",
       "      <td>F</td>\n",
       "      <td>2018-08-12T19:08:02.000</td>\n",
       "      <td>0.576869</td>\n",
       "      <td>[95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...</td>\n",
       "      <td>102.591895</td>\n",
       "      <td>2706.661386</td>\n",
       "      <td>Banerji, Manda</td>\n",
       "      <td>Jet-driven Galaxy-scale Gas Outflows in the Hy...</td>\n",
       "      <td>Banerji, Manda Husemann, Bernd</td>\n",
       "      <td>T</td>\n",
       "      <td>2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...</td>\n",
       "      <td>High-z Active Galactic Nuclei (AGN)</td>\n",
       "      <td>Active galaxies</td>\n",
       "      <td>2021-09-30T16:34:41.133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>http://almascience.org/aq?member_ous_id=uid://...</td>\n",
       "      <td>text/html</td>\n",
       "      <td>2016.1.01308.S</td>\n",
       "      <td>Public</td>\n",
       "      <td>80.570801</td>\n",
       "      <td>-53.100330</td>\n",
       "      <td>ADS/JAO.ALMA#2016.1.01308.S</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>JAO</td>\n",
       "      <td>ALMA</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>cube</td>\n",
       "      <td>2</td>\n",
       "      <td>ULASJ2315+0143</td>\n",
       "      <td>348.984300</td>\n",
       "      <td>1.730694</td>\n",
       "      <td>0.015766</td>\n",
       "      <td>Polygon ICRS 348.984300 1.738577 348.985778 1....</td>\n",
       "      <td>0.576861</td>\n",
       "      <td>57699.019868</td>\n",
       "      <td>57895.486087</td>\n",
       "      <td>5866.56</td>\n",
       "      <td>5866.56</td>\n",
       "      <td>0.002750</td>\n",
       "      <td>0.002798</td>\n",
       "      <td>109737.271411</td>\n",
       "      <td>/XX/YY/</td>\n",
       "      <td>phot.flux.density;phys.polarization</td>\n",
       "      <td>3</td>\n",
       "      <td>307.019722</td>\n",
       "      <td>Banerji, Manda; Jones, Gareth C.; Carniani, St...</td>\n",
       "      <td>We present an unprecedented view of the morpho...</td>\n",
       "      <td>2018</td>\n",
       "      <td>Newly discovered hyper-luminous, dusty broad-l...</td>\n",
       "      <td>ULASJ231_a_03_TM1</td>\n",
       "      <td>Jones, Gareth; Wethers, Clare; Hewett, Paul; M...</td>\n",
       "      <td>0.486219</td>\n",
       "      <td>0.010837</td>\n",
       "      <td>1.78126</td>\n",
       "      <td>uid://A001/X879/X313</td>\n",
       "      <td>uid://A001/X879/X314</td>\n",
       "      <td>uid://A002/Xba460f/X1d9</td>\n",
       "      <td>Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...</td>\n",
       "      <td>S</td>\n",
       "      <td>TARGET</td>\n",
       "      <td>T</td>\n",
       "      <td>6.946075</td>\n",
       "      <td>1.875000e+09</td>\n",
       "      <td>A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...</td>\n",
       "      <td>F</td>\n",
       "      <td>2018-08-12T19:08:02.000</td>\n",
       "      <td>0.576861</td>\n",
       "      <td>[95.16..97.03GHz,976.56kHz,554uJy/beam@10km/s,...</td>\n",
       "      <td>102.593370</td>\n",
       "      <td>2706.661386</td>\n",
       "      <td>Banerji, Manda</td>\n",
       "      <td>Jet-driven Galaxy-scale Gas Outflows in the Hy...</td>\n",
       "      <td>Banerji, Manda Husemann, Bernd</td>\n",
       "      <td>T</td>\n",
       "      <td>2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...</td>\n",
       "      <td>High-z Active Galactic Nuclei (AGN)</td>\n",
       "      <td>Active galaxies</td>\n",
       "      <td>2021-09-30T16:34:41.133</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                          access_url access_format  \\\n",
       "0  http://almascience.org/aq?member_ous_id=uid://...     text/html   \n",
       "1  http://almascience.org/aq?member_ous_id=uid://...     text/html   \n",
       "2  http://almascience.org/aq?member_ous_id=uid://...     text/html   \n",
       "3  http://almascience.org/aq?member_ous_id=uid://...     text/html   \n",
       "4  http://almascience.org/aq?member_ous_id=uid://...     text/html   \n",
       "\n",
       "      proposal_id data_rights  gal_longitude  gal_latitude  \\\n",
       "0  2016.1.01308.S      Public      77.437948    -38.582458   \n",
       "1  2016.1.01308.S      Public      77.437948    -38.582458   \n",
       "2  2016.1.01308.S      Public      77.437948    -38.582458   \n",
       "3  2016.1.01308.S      Public      77.437948    -38.582458   \n",
       "4  2016.1.01308.S      Public      80.570801    -53.100330   \n",
       "\n",
       "             obs_publisher_did obs_collection facility_name instrument_name  \\\n",
       "0  ADS/JAO.ALMA#2016.1.01308.S           ALMA           JAO            ALMA   \n",
       "1  ADS/JAO.ALMA#2016.1.01308.S           ALMA           JAO            ALMA   \n",
       "2  ADS/JAO.ALMA#2016.1.01308.S           ALMA           JAO            ALMA   \n",
       "3  ADS/JAO.ALMA#2016.1.01308.S           ALMA           JAO            ALMA   \n",
       "4  ADS/JAO.ALMA#2016.1.01308.S           ALMA           JAO            ALMA   \n",
       "\n",
       "                 obs_id dataproduct_type  calib_level     target_name  \\\n",
       "0  uid://A001/X879/X314             cube            2      J2232+1143   \n",
       "1  uid://A001/X879/X314             cube            2      J2232+1143   \n",
       "2  uid://A001/X879/X314             cube            2      J2232+1143   \n",
       "3  uid://A001/X879/X314             cube            2      J2232+1143   \n",
       "4  uid://A001/X879/X314             cube            2  ULASJ2315+0143   \n",
       "\n",
       "         s_ra      s_dec     s_fov  \\\n",
       "0  338.151704  11.730807  0.015766   \n",
       "1  338.151704  11.730807  0.015766   \n",
       "2  338.151704  11.730807  0.015766   \n",
       "3  338.151704  11.730807  0.015766   \n",
       "4  348.984300   1.730694  0.015766   \n",
       "\n",
       "                                            s_region  s_resolution  \\\n",
       "0  Polygon ICRS 338.151704 11.722924 338.150195 1...      0.576869   \n",
       "1  Polygon ICRS 338.151704 11.722924 338.150195 1...      0.576869   \n",
       "2  Polygon ICRS 338.151704 11.722924 338.150195 1...      0.576869   \n",
       "3  Polygon ICRS 338.151704 11.722924 338.150195 1...      0.576869   \n",
       "4  Polygon ICRS 348.984300 1.738577 348.985778 1....      0.576861   \n",
       "\n",
       "          t_min         t_max  t_exptime  t_resolution    em_min    em_max  \\\n",
       "0  57699.019868  57895.462736     907.20        907.20  0.003058  0.003118   \n",
       "1  57699.019868  57895.462736     907.20        907.20  0.003090  0.003150   \n",
       "2  57699.019868  57895.462736     907.20        907.20  0.002725  0.002772   \n",
       "3  57699.019868  57895.462736     907.20        907.20  0.002750  0.002798   \n",
       "4  57699.019868  57895.486087    5866.56       5866.56  0.002750  0.002798   \n",
       "\n",
       "    em_res_power pol_states                                o_ucd band_list  \\\n",
       "0  100396.011062    /XX/YY/  phot.flux.density;phys.polarization         3   \n",
       "1   99372.311222    /XX/YY/  phot.flux.density;phys.polarization         3   \n",
       "2  110760.976427    /XX/YY/  phot.flux.density;phys.polarization         3   \n",
       "3  109737.271411    /XX/YY/  phot.flux.density;phys.polarization         3   \n",
       "4  109737.271411    /XX/YY/  phot.flux.density;phys.polarization         3   \n",
       "\n",
       "   em_resolution                                            authors  \\\n",
       "0     307.023917  Banerji, Manda; Jones, Gareth C.; Carniani, St...   \n",
       "1     307.023917  Banerji, Manda; Jones, Gareth C.; Carniani, St...   \n",
       "2     307.023917  Banerji, Manda; Jones, Gareth C.; Carniani, St...   \n",
       "3     307.023917  Banerji, Manda; Jones, Gareth C.; Carniani, St...   \n",
       "4     307.019722  Banerji, Manda; Jones, Gareth C.; Carniani, St...   \n",
       "\n",
       "                                        pub_abstract  publication_year  \\\n",
       "0  We present an unprecedented view of the morpho...              2018   \n",
       "1  We present an unprecedented view of the morpho...              2018   \n",
       "2  We present an unprecedented view of the morpho...              2018   \n",
       "3  We present an unprecedented view of the morpho...              2018   \n",
       "4  We present an unprecedented view of the morpho...              2018   \n",
       "\n",
       "                                   proposal_abstract    schedblock_name  \\\n",
       "0  Newly discovered hyper-luminous, dusty broad-l...  ULASJ231_a_03_TM1   \n",
       "1  Newly discovered hyper-luminous, dusty broad-l...  ULASJ231_a_03_TM1   \n",
       "2  Newly discovered hyper-luminous, dusty broad-l...  ULASJ231_a_03_TM1   \n",
       "3  Newly discovered hyper-luminous, dusty broad-l...  ULASJ231_a_03_TM1   \n",
       "4  Newly discovered hyper-luminous, dusty broad-l...  ULASJ231_a_03_TM1   \n",
       "\n",
       "                                    proposal_authors  sensitivity_10kms  \\\n",
       "0  Jones, Gareth; Wethers, Clare; Hewett, Paul; M...           1.390184   \n",
       "1  Jones, Gareth; Wethers, Clare; Hewett, Paul; M...           1.509001   \n",
       "2  Jones, Gareth; Wethers, Clare; Hewett, Paul; M...           1.315095   \n",
       "3  Jones, Gareth; Wethers, Clare; Hewett, Paul; M...           1.320847   \n",
       "4  Jones, Gareth; Wethers, Clare; Hewett, Paul; M...           0.486219   \n",
       "\n",
       "   cont_sensitivity_bandwidth      pwv         group_ous_uid  \\\n",
       "0                    0.029457  1.78126  uid://A001/X879/X313   \n",
       "1                    0.029457  1.78126  uid://A001/X879/X313   \n",
       "2                    0.029457  1.78126  uid://A001/X879/X313   \n",
       "3                    0.029457  1.78126  uid://A001/X879/X313   \n",
       "4                    0.010837  1.78126  uid://A001/X879/X313   \n",
       "\n",
       "         member_ous_uid                 asdm_uid  \\\n",
       "0  uid://A001/X879/X314  uid://A002/Xba460f/X1d9   \n",
       "1  uid://A001/X879/X314  uid://A002/Xba460f/X1d9   \n",
       "2  uid://A001/X879/X314  uid://A002/Xba460f/X1d9   \n",
       "3  uid://A001/X879/X314  uid://A002/Xba460f/X1d9   \n",
       "4  uid://A001/X879/X314  uid://A002/Xba460f/X1d9   \n",
       "\n",
       "                                           obs_title type        scan_intent  \\\n",
       "0  Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...    S  BANDPASS FLUX WVR   \n",
       "1  Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...    S  BANDPASS FLUX WVR   \n",
       "2  Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...    S  BANDPASS FLUX WVR   \n",
       "3  Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...    S  BANDPASS FLUX WVR   \n",
       "4  Do Hyper-Luminous Dusty Quasars at z=2.5 Live ...    S             TARGET   \n",
       "\n",
       "  science_observation  spatial_scale_max     bandwidth  \\\n",
       "0                   F           6.946170  1.875000e+09   \n",
       "1                   F           6.946170  1.875000e+09   \n",
       "2                   F           6.946170  1.875000e+09   \n",
       "3                   F           6.946170  1.875000e+09   \n",
       "4                   T           6.946075  1.875000e+09   \n",
       "\n",
       "                                      antenna_arrays is_mosaic  \\\n",
       "0  A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...         F   \n",
       "1  A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...         F   \n",
       "2  A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...         F   \n",
       "3  A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...         F   \n",
       "4  A001:DA59 A002:DA49 A004:DA41 A006:DV15 A009:D...         F   \n",
       "\n",
       "          obs_release_date  spatial_resolution  \\\n",
       "0  2018-08-12T19:08:02.000            0.576869   \n",
       "1  2018-08-12T19:08:02.000            0.576869   \n",
       "2  2018-08-12T19:08:02.000            0.576869   \n",
       "3  2018-08-12T19:08:02.000            0.576869   \n",
       "4  2018-08-12T19:08:02.000            0.576861   \n",
       "\n",
       "                                   frequency_support   frequency  \\\n",
       "0  [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...  102.591895   \n",
       "1  [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...  102.591895   \n",
       "2  [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...  102.591895   \n",
       "3  [95.16..97.03GHz,976.56kHz,1.5mJy/beam@10km/s,...  102.591895   \n",
       "4  [95.16..97.03GHz,976.56kHz,554uJy/beam@10km/s,...  102.593370   \n",
       "\n",
       "   velocity_resolution obs_creator_name  \\\n",
       "0          2706.661386   Banerji, Manda   \n",
       "1          2706.661386   Banerji, Manda   \n",
       "2          2706.661386   Banerji, Manda   \n",
       "3          2706.661386   Banerji, Manda   \n",
       "4          2706.661386   Banerji, Manda   \n",
       "\n",
       "                                           pub_title  \\\n",
       "0  Jet-driven Galaxy-scale Gas Outflows in the Hy...   \n",
       "1  Jet-driven Galaxy-scale Gas Outflows in the Hy...   \n",
       "2  Jet-driven Galaxy-scale Gas Outflows in the Hy...   \n",
       "3  Jet-driven Galaxy-scale Gas Outflows in the Hy...   \n",
       "4  Jet-driven Galaxy-scale Gas Outflows in the Hy...   \n",
       "\n",
       "                     first_author qa2_passed  \\\n",
       "0  Banerji, Manda Husemann, Bernd          T   \n",
       "1  Banerji, Manda Husemann, Bernd          T   \n",
       "2  Banerji, Manda Husemann, Bernd          T   \n",
       "3  Banerji, Manda Husemann, Bernd          T   \n",
       "4  Banerji, Manda Husemann, Bernd          T   \n",
       "\n",
       "                                       bib_reference  \\\n",
       "0  2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...   \n",
       "1  2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...   \n",
       "2  2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...   \n",
       "3  2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...   \n",
       "4  2018MNRAS.479.1154B 2019ApJ...879...75H 2021MN...   \n",
       "\n",
       "                       science_keyword scientific_category  \\\n",
       "0  High-z Active Galactic Nuclei (AGN)     Active galaxies   \n",
       "1  High-z Active Galactic Nuclei (AGN)     Active galaxies   \n",
       "2  High-z Active Galactic Nuclei (AGN)     Active galaxies   \n",
       "3  High-z Active Galactic Nuclei (AGN)     Active galaxies   \n",
       "4  High-z Active Galactic Nuclei (AGN)     Active galaxies   \n",
       "\n",
       "              lastModified  \n",
       "0  2021-09-30T16:34:41.133  \n",
       "1  2021-09-30T16:34:41.133  \n",
       "2  2021-09-30T16:34:41.133  \n",
       "3  2021-09-30T16:34:41.133  \n",
       "4  2021-09-30T16:34:41.133  "
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output = query_proposal_id(service, '2016.1.01308.S')\n",
    "output.head(5) ### showing only 5 rows"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Which were the science targets in these observations?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:41.040986Z",
     "iopub.status.busy": "2021-11-16T10:26:41.039955Z",
     "iopub.status.idle": "2021-11-16T10:26:41.045081Z",
     "shell.execute_reply": "2021-11-16T10:26:41.044044Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['ULASJ1234+0907', 'ULASJ2315+0143'], dtype=object)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.unique(output[output['science_observation']=='T']['target_name'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Which were the calibrators used in these observations?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:41.052525Z",
     "iopub.status.busy": "2021-11-16T10:26:41.051741Z",
     "iopub.status.idle": "2021-11-16T10:26:41.056032Z",
     "shell.execute_reply": "2021-11-16T10:26:41.055192Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['Ganymede', 'J1229+0203', 'J1238+0723', 'J1239+0730', 'J2232+1143',\n",
       "       'J2320+0513', 'J2326+0112', 'Neptune'], dtype=object)"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.unique(output[output['science_observation']=='F']['target_name'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---------------------------------------------------\n",
    "\n",
    "## Example 3b: Search for one specific source (J1229+0203, calibrator) in a list of proposal IDs\n",
    "Query the ASDM UIDs associated with a specific source observed multiple times within different observation sets."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-11-16T10:26:41.067600Z",
     "iopub.status.busy": "2021-11-16T10:26:41.066895Z",
     "iopub.status.idle": "2021-11-16T10:26:42.113566Z",
     "shell.execute_reply": "2021-11-16T10:26:42.113019Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "source J1229+0203 NOT found in ADS/JAO.ALMA#2015.1.00129.S\n",
      "source J1229+0203 found in ADS/JAO.ALMA#2015.1.00329.S\n",
      "Is a science observation? ['F' 'F' 'F' 'F']\n",
      "source J1229+0203 found in ADS/JAO.ALMA#2015.1.00587.S\n",
      "Is a science observation? ['F' 'F' 'F' 'F' 'F' 'F' 'F' 'F']\n",
      "source J1229+0203 found in ADS/JAO.ALMA#2015.1.01012.S\n",
      "Is a science observation? ['F' 'F' 'F' 'F']\n",
      "source J1229+0203 found in ADS/JAO.ALMA#2016.1.00972.S\n",
      "Is a science observation? ['F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F' 'F']\n",
      "source J1229+0203 found in ADS/JAO.ALMA#2016.1.01308.S\n",
      "Is a science observation? ['F' 'F' 'F' 'F' 'F' 'F' 'F' 'F']\n",
      "List of member_ous_uid that contain the particular source name and that are part of the proposal id list:\n",
      "['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']\n"
     ]
    }
   ],
   "source": [
    "source_name = 'J1229+0203'\n",
    "\n",
    "# List of data sets where this source might be included\n",
    "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']\n",
    "\n",
    "uids = []\n",
    "for proposal_id in proposal_id_list:\n",
    "    output = query_proposal_id_and_alma_source_name(service, proposal_id, source_name)\n",
    "    if len(output) > 0:\n",
    "       print(f\"source {source_name} found in {proposal_id}\")\n",
    "       print(f\"Is a science observation? {output['science_observation'].values}\")\n",
    "       uids += list(np.unique(output['member_ous_uid']))       \n",
    "    else:\n",
    "       print(f\"source {source_name} NOT found in {proposal_id}\") \n",
    "        \n",
    "print(\"List of member_ous_uid that contain the particular source name and that are part of the proposal id list:\")\n",
    "print(uids)    \n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
