Skip to content

Instantly share code, notes, and snippets.

@d3v-null
Last active March 11, 2025 03:43
Show Gist options
  • Save d3v-null/fd89524a12f2653383879c29b0d9cb7f to your computer and use it in GitHub Desktop.
Save d3v-null/fd89524a12f2653383879c29b0d9cb7f to your computer and use it in GitHub Desktop.
MWA + SRCNet TAP demo
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# MWA + SRCNet TAP demo\n",
"\n",
"First, we will query the MWA TAP database for available MWA observations,\n",
"\n",
"then we will query the SRCNet TAP database."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pyvo\n",
"from astropy.time import Time, TimeDelta\n",
"from sys import stderr, argv\n",
"\n",
"# get gpstime of proprietary period, 18 months (548 days) ago\n",
"proprietary = (Time.now() - TimeDelta(548, format=\"jd\")).gps\n",
"tap = pyvo.dal.TAPService(\"http://vo.mwatelescope.org/mwa_asvo/tap\")\n",
"obs = (\n",
" tap.search(\n",
" f\"\"\"\n",
"SELECT TOP 50\n",
" obs_id, starttime_utc, ra_pointing, dec_pointing, channel_numbers_csv,\n",
" mwa_array_configuration, good_tiles, dataquality, sun_elevation,\n",
" deleted_flag, gpubox_files_archived, total_archived_data_bytes,\n",
" freq_res, int_time\n",
"FROM mwa.observation\n",
"WHERE CONTAINS(\n",
" POINT('ICRS', ra_pointing, dec_pointing), -- pointing center\n",
" CIRCLE('ICRS', 201.3667, -43.0192, 5) -- is 5 degrees off CenA\n",
") = 1\n",
"AND channel_numbers_csv LIKE '%137%' -- has channel 137 (175MHz)\n",
"AND obs_id < {proprietary} -- nonproprietary\n",
"AND good_tiles >= 112 -- 14 good receivers\n",
"AND dataquality <= 1 -- no known issues\n",
"AND sun_elevation < 0 -- sun is not up\n",
"AND deleted_flag!='TRUE' -- not deleted\n",
"AND gpubox_files_archived > 1 -- data available\n",
"-- AND freq_res <= 10 -- (optional) 10kHz resolution or less\n",
"-- AND int_time <= 1 -- (optional) 1s integration or less\n",
"-- AND mwa_array_configuration = 'Phase II Compact' -- (optional) compact => more short baselines\n",
"ORDER BY obs_id DESC\n",
"\"\"\"\n",
" )\n",
" .to_table()\n",
" .to_pandas()\n",
" .dropna(axis=1, how=\"all\")\n",
")\n",
"obs[\"config\"] = obs[\"mwa_array_configuration\"].str.split(\" \").str[-1]\n",
"del obs[\"mwa_array_configuration\"]\n",
"obs[\"gigabytes\"] = obs[\"total_archived_data_bytes\"] / 1e9\n",
"del obs[\"total_archived_data_bytes\"]\n",
"display(obs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tap_srcnet = pyvo.dal.TAPService('https://dachs.ivoa.srcnet.skao.int:443/tap')\n",
"obs_srcnet = tap_srcnet.search(\"\"\"\n",
"SELECT * FROM ivoa.obscore where instrument_name = 'MWA'\n",
"\"\"\").to_table().to_pandas().dropna(axis=1, how='all')\n",
"if not len(obs_srcnet):\n",
" print(\"no obs found!\")\n",
"else:\n",
" display(obs_srcnet.iloc[0])"
]
}
],
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment