{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# II - Accessing Astronomical Data From Python\n", "\n", "## 0.- Installing necessary packages\n", "* ``conda install astropy``\n", "* ``conda install -c astropy aplpy astroquery``\n", "\n", "Before doing to data analysis, we need to find, load and pre-process data!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1.- Astronomical Data from WebPages" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Function to retrieve the tarball and the fits file." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import os\n", "import urllib\n", "import tarfile\n", "import sys\n", "#%matplotlib inline\n", "%matplotlib notebook\n", "global DOWNLOADS_DIR \n", "DOWNLOADS_DIR= '.'\n", "\n", "def download_and_extract(url):\n", " # Obtain the filename\n", " name = url.rsplit('/', 1)[-1]\n", " filename = os.path.join(DOWNLOADS_DIR, name)\n", " # Download the file if not found\n", " if not os.path.isfile(filename):\n", " urllib.urlretrieve(url, filename)\n", " # Decompress (if needed) and copy the selected file to the DOWNLOADS_DIR\n", " sdir=filename.rsplit('ReferenceImages',1)[0]+\"ReferenceImages\"\n", " if not os.path.isdir(sdir):\n", " tar = tarfile.open(filename)\n", " tar.extractall(path=DOWNLOADS_DIR)\n", " tar.close()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "TWHydra_CO3_2line.image.fits\r\n", "TWHydra_CO3_2line.image.mom.weighted_coord.fits\r\n", "TWHydra_CO3_2line.image.mom.weighted_dispersion_coord.fits\r\n", "TWHydra_CO3_2line.image.mom0.fits\r\n", "TWHydra_HCOplusline.image.fits\r\n", "TWHydra_HCOplusline.image.mom.weighted_coord.fits\r\n", "TWHydra_HCOplusline.image.mom.weighted_dispersion_coord.fits\r\n", "TWHydra_HCOplusline.image.mom0.fits\r\n", "TWHydra_contall_apcal.image.fits\r\n" ] } ], "source": [ "# Data from ALMA science verification \n", "twhydra_url = 'https://almascience.nrao.edu/almadata/sciver/TWHya/TWHYA_BAND7_ReferenceImages.tgz'\n", "download_and_extract(twhydra_url)\n", "\n", "!ls TWHYA_BAND7_ReferenceImages" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2.- Loading and a Quick Look at the Data" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'2.0'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from astropy.io import fits\n", "import logging\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "\n", "# Load File\n", "hdulist = fits.open(\"TWHYA_BAND7_ReferenceImages/TWHydra_CO3_2line.image.mom0.fits\")\n", "twhydra = hdulist[0]\n", "import astropy\n", "astropy.version.version" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Show the header" ] }, { "cell_type": "code", "execution_count": 62, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "SIMPLE = T /Standard FITS \n", "BITPIX = -32 /Floating point (32 bit) \n", "NAXIS = 4 \n", "NAXIS1 = 100 \n", "NAXIS2 = 100 \n", "NAXIS3 = 1 \n", "NAXIS4 = 1 \n", "BSCALE = 1.000000000000E+00 /PHYSICAL = PIXEL*BSCALE + BZERO \n", "BZERO = 0.000000000000E+00 \n", "BMAJ = 4.668472210566E-04 \n", "BMIN = 4.255372948117E-04 \n", "BPA = 2.230152130127E+01 \n", "BTYPE = 'Intensity' \n", "OBJECT = 'TW Hya ' \n", " \n", "BUNIT = 'JY/BEAM.KM/S' /Brightness (pixel) unit \n", "EQUINOX = 2.000000000000E+03 \n", "LONPOLE = 1.800000000000E+02 \n", "LATPOLE = -3.470476691248E+01 \n", "PC001001= 1.000000000000E+00 \n", "PC002001= 0.000000000000E+00 \n", "PC003001= 0.000000000000E+00 \n", "PC004001= 0.000000000000E+00 \n", "PC001002= 0.000000000000E+00 \n", "PC002002= 1.000000000000E+00 \n", "PC003002= 0.000000000000E+00 \n", "PC004002= 0.000000000000E+00 \n", "PC001003= 0.000000000000E+00 \n", "PC002003= 0.000000000000E+00 \n", "PC003003= 1.000000000000E+00 \n", "PC004003= 0.000000000000E+00 \n", "PC001004= 0.000000000000E+00 \n", "PC002004= 0.000000000000E+00 \n", "PC003004= 0.000000000000E+00 \n", "PC004004= 1.000000000000E+00 \n", "CTYPE1 = 'RA---SIN' \n", "CRVAL1 = 1.654660207616E+02 \n", "CDELT1 = -8.333333333333E-05 \n", "CRPIX1 = 5.100000000000E+01 \n", "CUNIT1 = 'deg ' \n", "CTYPE2 = 'DEC--SIN' \n", "CRVAL2 = -3.470476691248E+01 \n", "CDELT2 = 8.333333333333E-05 \n", "CRPIX2 = 5.100000000000E+01 \n", "CUNIT2 = 'deg ' \n", "CTYPE3 = 'FREQ ' \n", "CRVAL3 = 3.458006038050E+11 \n", "CDELT3 = -1.384141518555E+05 \n", "CRPIX3 = -3.900000000000E+01 \n", "CUNIT3 = 'HZ ' \n", "CTYPE4 = 'STOKES ' \n", "CRVAL4 = 1.000000000000E+00 \n", "CDELT4 = 1.000000000000E+00 \n", "CRPIX4 = 1.000000000000E+00 \n", "CUNIT4 = ' ' \n", "PV2_1 = 0.000000000000E+00 \n", "PV2_2 = 0.000000000000E+00 \n", "RESTFRQ = 3.457959900000E+11 /Rest Frequency (Hz) \n", "SPECSYS = 'LSRK ' /Spectral reference frame \n", "ALTRVAL = -3.999999947043E+03 /Alternate frequency reference value \n", "ALTRPIX = -3.900000000000E+01 /Alternate frequency reference pixel \n", "VELREF = 257 /1 LSR, 2 HEL, 3 OBS, +256 Radio \n", "COMMENT casacore non-standard usage: 4 LSD, 5 GEO, 6 SOU, 7 GAL \n", "TELESCOP= 'ALMA ' \n", "OBSERVER= 'Unknown ' \n", "DATE-OBS= '2011-04-22T00:15:41.760000' \n", "TIMESYS = 'UTC ' \n", "OBSRA = 1.654660207616E+02 \n", "OBSDEC = -3.470476691248E+01 \n", "OBSGEO-X= 2.225142180269E+06 \n", "OBSGEO-Y= -5.440307370349E+06 \n", "OBSGEO-Z= -2.481029851874E+06 \n", "DATE = '2011-05-30T22:09:28.571000' /Date FITS file was written \n", "ORIGIN = 'CASA casacore alma-evla ' \n", "HISTORY CASA START LOGTABLE \n", "HISTORY 2011-05-27T17:37:11 INFO SRCCODE='imager::clean()' \n", "HISTORY 2011-05-27T17:37:11 INFO SRCCODE='imager::clean()' \n", "HISTORY Tue May 24 20:37:43 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Tue May 24 20:38:01 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] vis = \"X3c1.ms\" \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] gaintable = \"['X3c1.tsys\n", "HISTORY >.fdm', 'wvr_X3c1.cal']\" \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] gainfield = \"['0']\" \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest']\" \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] calwt = True \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Tue May 24 20:38:04 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Tue May 24 20:38:05 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Tue May 24 20:38:21 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] vis = \"X3c1.ms\" \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] gaintable = \"['X3c1.tsys\n", "HISTORY >.fdm', 'wvr_X3c1.cal']\" \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] gainfield = \"['1']\" \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest']\" \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Tue May 24 20:38:24 2011 HISTORY applycal [] calwt = True \n", "HISTORY Tue May 24 20:38:25 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Tue May 24 20:38:25 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Tue May 24 20:38:25 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Tue May 24 20:38:42 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] vis = \"X3c1.ms\" \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] gaintable = \"['X3c1.tsys\n", "HISTORY >.fdm', 'wvr_X3c1.cal']\" \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] gainfield = \"['2']\" \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest']\" \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] calwt = True \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Tue May 24 20:39:46 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Tue May 24 20:39:47 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Tue May 24 20:40:04 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] vis = \"X3c1.ms\" \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] gaintable = \"['X3c1.tsys\n", "HISTORY >.fdm', 'wvr_X3c1.cal']\" \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] gainfield = \"['4']\" \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest']\" \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] calwt = True \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Tue May 24 20:40:27 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Tue May 24 20:51:12 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Tue May 24 20:51:26 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] vis = \"X3c1.ms\" \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] gaintable = \"['X3c1.tsys\n", "HISTORY >.fdm', 'wvr_X3c1.cal']\" \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] gainfield = \"['4', '3']\"\n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest']\" \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] calwt = True \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Tue May 24 20:51:37 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY ms::split() [fieldids= spwids=17,19,21\n", "HISTORY >,23 step=[1] which='corrected'] X3c1_wvrtsys.ms split from /export/data\n", "HISTORY >1/data_2/SV_data/test_TWHydra_may24/X3c1.ms \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] taskname=split \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] vis = \"X3c1.ms\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] outputvis = \"X3c1_wvrtsys.m\n", "HISTORY >s\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] datacolumn = \"corrected\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] field = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] spw = \"17,19,21,23\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] width = 1 \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] antenna = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] timebin = \"0.0s\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] timerange = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] scan = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] array = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] uvrange = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] correlation = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] combine = \"\" \n", "HISTORY Tue May 24 20:56:25 2011 HISTORY split [] keepflags = True \n", "HISTORY Tue May 24 22:01:42 2011 HISTORY flagdata [] taskname = flagdata \n", "HISTORY Tue May 24 22:01:42 2011 HISTORY flagdata [] vis = \"X3c1_wvrtsys.m\n", "HISTORY >s\" \n", "HISTORY Tue May 24 22:01:42 2011 HISTORY flagdata [] mode = \"manualflag\" \n", "HISTORY Tue May 24 22:02:43 2011 HISTORY flagdata [] taskname = flagdata \n", "HISTORY Tue May 24 22:02:43 2011 HISTORY flagdata [] vis = \"X3c1_wvrtsys.m\n", "HISTORY >s\" \n", "HISTORY Tue May 24 22:02:43 2011 HISTORY flagdata [] mode = \"manualflag\" \n", "HISTORY Wed May 25 14:40:38 2011 HISTORY flagdata [] taskname = flagdata \n", "HISTORY Wed May 25 14:40:38 2011 HISTORY flagdata [] vis = \"X3c1_wvrtsys.m\n", "HISTORY >s\" \n", "HISTORY Wed May 25 14:40:38 2011 HISTORY flagdata [] mode = \"manualflag\" \n", "HISTORY Wed May 25 14:40:58 2011 HISTORY flagdata [] taskname = flagdata \n", "HISTORY Wed May 25 14:40:58 2011 HISTORY flagdata [] vis = \"X3c1_wvrtsys.m\n", "HISTORY >s\" \n", "HISTORY Wed May 25 14:40:58 2011 HISTORY flagdata [] mode = \"shadow\" \n", "HISTORY Wed May 25 14:41:19 2011 HISTORY flagdata [] taskname = flagdata \n", "HISTORY Wed May 25 14:41:19 2011 HISTORY flagdata [] vis = \"X3c1_wvrtsys.m\n", "HISTORY >s\" \n", "HISTORY Wed May 25 14:41:19 2011 HISTORY flagdata [] mode = \"manualflag\" \n", "HISTORY Wed May 25 22:02:19 2011 HISTORY concat [] taskname=concat \n", "HISTORY Wed May 25 22:02:19 2011 HISTORY concat [] vis = \"Band7multi_ap\n", "HISTORY >ril22.ms\" \n", "HISTORY Wed May 25 22:02:19 2011 HISTORY concat [] concatvis = \"X5d8_wvrtsys.\n", "HISTORY >ms\" \n", "HISTORY Wed May 25 22:02:19 2011 HISTORY concat [] freqtol = \"\" \n", "HISTORY Wed May 25 22:02:19 2011 HISTORY concat [] dirtol = \"\" \n", "HISTORY Wed May 25 22:05:04 2011 HISTORY concat [] taskname=concat \n", "HISTORY Wed May 25 22:05:04 2011 HISTORY concat [] vis = \"Band7multi_ap\n", "HISTORY >ril22.ms\" \n", "HISTORY Wed May 25 22:05:04 2011 HISTORY concat [] concatvis = \"X7ef_wvrtsys.\n", "HISTORY >ms\" \n", "HISTORY Wed May 25 22:05:04 2011 HISTORY concat [] freqtol = \"\" \n", "HISTORY Wed May 25 22:05:04 2011 HISTORY concat [] dirtol = \"\" \n", "HISTORY Wed May 25 22:34:09 2011 HISTORY im::calc_uvw() (file /var/rpmbuild/BUI\n", "HISTORY >LD/casapy/casapy-32.0.15111/code/synthesis/implement/Utilities/FixVis.c\n", "HISTORY >, line 435) [] UVWs calculated for fields [-1, 1, -1, -1, -1] \n", "HISTORY Wed May 25 22:39:41 2011 HISTORY flagdata [] taskname = flagdata \n", "HISTORY Wed May 25 22:39:41 2011 HISTORY flagdata [] vis = \"Band7multi_apr\n", "HISTORY >il22.ms\" \n", "HISTORY Wed May 25 22:39:41 2011 HISTORY flagdata [] mode = \"manualflag\" \n", "HISTORY Wed May 25 22:40:40 2011 HISTORY flagdata [] taskname = flagdata \n", "HISTORY Wed May 25 22:40:40 2011 HISTORY flagdata [] vis = \"Band7multi_apr\n", "HISTORY >il22.ms\" \n", "HISTORY Wed May 25 22:40:40 2011 HISTORY flagdata [] mode = \"manualflag\" \n", "HISTORY Wed May 25 22:40:44 2011 HISTORY imager::data selection [mode=channel n\n", "HISTORY >chan=[0] start=[0] step=[1] mstart='Radialvelocity: 0' mstep='Radialvel\n", "HISTORY >city: 0' spectralwindowids=[0] fieldids=[1] msselect=] \n", "HISTORY Wed May 25 22:40:47 2011 HISTORY imager::data selection [mode=channel n\n", "HISTORY >chan=[0] start=[0] step=[1] mstart='Radialvelocity: 0' mstep='Radialvel\n", "HISTORY >city: 0' spectralwindowids=[1] fieldids=[1] msselect=] \n", "HISTORY Wed May 25 22:40:49 2011 HISTORY imager::data selection [mode=channel n\n", "HISTORY >chan=[0] start=[0] step=[1] mstart='Radialvelocity: 0' mstep='Radialvel\n", "HISTORY >city: 0' spectralwindowids=[2] fieldids=[1] msselect=] \n", "HISTORY Wed May 25 22:40:51 2011 HISTORY imager::data selection [mode=channel n\n", "HISTORY >chan=[0] start=[0] step=[1] mstart='Radialvelocity: 0' mstep='Radialvel\n", "HISTORY >city: 0' spectralwindowids=[3] fieldids=[1] msselect=] \n", "HISTORY Wed May 25 22:40:51 2011 HISTORY imager::data selection [] Selecting da\n", "HISTORY >ta \n", "HISTORY Wed May 25 22:40:52 2011 HISTORY setjy::imager::data selection [] Selec\n", "HISTORY >ted 810 out of 188460 visibilities. \n", "HISTORY Wed May 25 22:40:54 2011 HISTORY setjy [] taskname = setjy \n", "HISTORY Wed May 25 22:40:54 2011 HISTORY setjy [] vis = \"Band7multi_apr\n", "HISTORY >il22.ms\" \n", "HISTORY Wed May 25 22:40:54 2011 HISTORY setjy [] field = \"1\" \n", "HISTORY Wed May 25 22:40:54 2011 HISTORY setjy [] spw = \n", "HISTORY Wed May 25 22:40:54 2011 HISTORY setjy [] modimage = \n", "HISTORY Wed May 25 22:40:54 2011 HISTORY setjy [] fluxdensity = -1 \n", "HISTORY Wed May 25 22:40:54 2011 HISTORY setjy [] standard = \"Butler-JPL-Hor\n", "HISTORY >izons 2010\" \n", "HISTORY Wed May 25 22:43:43 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Wed May 25 22:43:44 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] vis = \"Band7multi_\n", "HISTORY >april22.ms\" \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] gaintable = \"['bandpass.\n", "HISTORY >bcal', 'intphase.gcal', 'flux.cal']\" \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] gainfield = \"['0', '0', \n", "HISTORY > '0']\" \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest', 'nearest']\" \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] calwt = True \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Wed May 25 22:43:50 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Wed May 25 22:44:10 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Wed May 25 22:44:10 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] vis = \"Band7multi_\n", "HISTORY >april22.ms\" \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] gaintable = \"['bandpass.\n", "HISTORY >bcal', 'intphase.gcal', 'flux.cal']\" \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] gainfield = \"['0', '1', \n", "HISTORY > '1']\" \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest', 'nearest']\" \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] calwt = True \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Wed May 25 22:44:15 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Wed May 25 22:44:44 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Wed May 25 22:44:44 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] vis = \"Band7multi_\n", "HISTORY >april22.ms\" \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] gaintable = \"['bandpass.\n", "HISTORY >bcal', 'intphase.gcal', 'flux.cal']\" \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] gainfield = \"['0', '3', \n", "HISTORY > '3']\" \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest', 'nearest']\" \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] calwt = True \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Wed May 25 22:45:05 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Wed May 25 22:45:46 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Wed May 25 22:45:47 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] vis = \"Band7multi_\n", "HISTORY >april22.ms\" \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] gaintable = \"['bandpass.\n", "HISTORY >bcal', 'intphase.gcal', 'flux.cal']\" \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] gainfield = \"['0', '4', \n", "HISTORY > '4']\" \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'nearest', 'nearest']\" \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] calwt = True \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Wed May 25 22:46:56 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Wed May 25 22:47:14 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Wed May 25 22:47:15 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] vis = \"Band7multi_\n", "HISTORY >april22.ms\" \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] gaintable = \"['bandpass.\n", "HISTORY >bcal', 'scanphase.gcal', 'flux.cal']\" \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] gainfield = \"['0', '3,4'\n", "HISTORY >, '3,4']\" \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] interp = \"['nearest',\n", "HISTORY > 'linear', 'linear']\" \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] calwt = True \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Wed May 25 22:52:06 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY ms::split() [fieldids=2 spwids=* step=\n", "HISTORY >[1] which='corrected'] TWHydra_corrected.ms split from /export/data_1/d\n", "HISTORY >ta_2/SV_data/test_TWHydra_may24/Band7multi_april22.ms \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] taskname=split \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] vis = \"Band7multi_apr\n", "HISTORY >il22.ms\" \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] outputvis = \"TWHydra_correc\n", "HISTORY >ted.ms\" \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] datacolumn = \"corrected\" \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] field = \"2\" \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] spw = \"\" \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] width = 1 \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] antenna = \"\" \n", "HISTORY Wed May 25 23:09:03 2011 HISTORY split [] timebin = \"0.0s\" \n", "HISTORY Wed May 25 23:09:04 2011 HISTORY split [] timerange = \"\" \n", "HISTORY Wed May 25 23:09:04 2011 HISTORY split [] scan = \"\" \n", "HISTORY Wed May 25 23:09:04 2011 HISTORY split [] array = \"\" \n", "HISTORY Wed May 25 23:09:04 2011 HISTORY split [] uvrange = \"\" \n", "HISTORY Wed May 25 23:09:04 2011 HISTORY split [] correlation = \"\" \n", "HISTORY Wed May 25 23:09:04 2011 HISTORY split [] combine = \"\" \n", "HISTORY Wed May 25 23:09:04 2011 HISTORY split [] keepflags = True \n", "HISTORY Thu May 26 18:08:07 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Thu May 26 18:08:08 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] vis = \"TWHydra_cor\n", "HISTORY >rected.ms\" \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] gaintable = \"['self_2.pc\n", "HISTORY >al', 'self_ap.cal']\" \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] gainfield = \"['']\" \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] interp = \"['linear']\"\n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] calwt = False \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Thu May 26 18:12:43 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Thu May 26 21:55:23 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Thu May 26 21:55:24 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] vis = \"TWHydra_cor\n", "HISTORY >rected.ms\" \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] gaintable = \"['self_2.pc\n", "HISTORY >al', 'self_ap.cal']\" \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] gainfield = \"['']\" \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] interp = \"['linear']\"\n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] calwt = False \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Thu May 26 21:59:16 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Fri May 27 14:46:25 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Fri May 27 14:46:26 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] taskname = applycal \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] vis = \"TWHydra_cor\n", "HISTORY >rected.ms\" \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] msselect = \"\" \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] gaintable = \"['self_2.pc\n", "HISTORY >al', 'self_ap.cal']\" \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] gainfield = \"['']\" \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] interp = \"['linear']\"\n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] spwmap = [] \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] calwt = False \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] gaincurve = False \n", "HISTORY Fri May 27 14:49:55 2011 HISTORY applycal [] opacity = 0.0 \n", "HISTORY Fri May 27 14:55:23 2011 HISTORY ms::split() [fieldids= spwids=2 step=[\n", "HISTORY >1] which='corrected'] TWHydra_CO3_2.ms split from /export/data_1/data_2\n", "HISTORY >SV_data/test_TWHydra_may24/TWHydra_corrected.ms \n", "HISTORY Fri May 27 14:55:23 2011 HISTORY split [] taskname=split \n", "HISTORY Fri May 27 14:55:23 2011 HISTORY split [] vis = \"TWHydra_correc\n", "HISTORY >ted.ms\" \n", "HISTORY Fri May 27 14:55:23 2011 HISTORY split [] outputvis = \"TWHydra_CO3_2.\n", "HISTORY >ms\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] datacolumn = \"corrected\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] field = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] spw = \"2\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] width = 1 \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] antenna = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] timebin = \"0.0s\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] timerange = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] scan = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] array = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] uvrange = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] correlation = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] combine = \"\" \n", "HISTORY Fri May 27 14:55:24 2011 HISTORY split [] keepflags = True \n", "HISTORY Fri May 27 15:28:58 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Fri May 27 15:29:02 2011 HISTORY calibrater::solve [] Beginning solve--\n", "HISTORY >--------------------------- \n", "HISTORY Fri May 27 15:31:11 2011 HISTORY calibrater::setdata [Beginning selectv\n", "HISTORY >is--(MSSelection version)-------, chanmode=none nchan=1 start=0 step=1 \n", "HISTORY >Start='0km/s' mStep='0km/s' msSelect=''] \n", "HISTORY Fri May 27 15:31:12 2011 HISTORY calibrater::correct [] Beginning corre\n", "HISTORY >ct--------------------------- \n", "HISTORY Fri May 27 15:37:15 2011 HISTORY ms::split() [fieldids= spwids=* step=[\n", "HISTORY >1] which='corrected'] TWHydra_CO3_2.ms.contsub split from /export/data_\n", "HISTORY >/data_2/SV_data/test_TWHydra_may24/TWHydra_CO3_2.ms.contsubxS1huJ \n", "HISTORY Fri May 27 15:37:15 2011 HISTORY uvcontsub2 [] taskname = uvcontsub2 \n", "HISTORY Fri May 27 15:37:15 2011 HISTORY uvcontsub2 [] vis = TWHydra_CO3_\n", "HISTORY >2.ms \n", "HISTORY Fri May 27 15:37:15 2011 HISTORY uvcontsub2 [] field = \"\" \n", "HISTORY Fri May 27 15:37:15 2011 HISTORY uvcontsub2 [] fitspw = \"0:20~2000,0\n", "HISTORY >:2400~3800\" \n", "HISTORY Fri May 27 15:37:15 2011 HISTORY uvcontsub2 [] solint = int \n", "HISTORY Fri May 27 15:37:15 2011 HISTORY uvcontsub2 [] fitorder = 1 \n", "HISTORY Fri May 27 15:37:16 2011 HISTORY uvcontsub2 [] spw = \"\" \n", "HISTORY Fri May 27 15:37:16 2011 HISTORY uvcontsub2 [] want_cont = False \n", "HISTORY Fri May 27 16:15:09 2011 HISTORY imager::data selection [mode=none ncha\n", "HISTORY >n=[-1] start=[0] step=[1] mstart='Radialvelocity: 0' mstep='Radialveloc\n", "HISTORY >ty: 0' spectralwindowids=[] fieldids=[] msselect=] \n", "HISTORY Fri May 27 16:15:13 2011 HISTORY imager::defineimage() [Defining image \n", "HISTORY > properties:nx=100 ny=100 cellx='0.3arcsec' celly='0.3arcsec' stokes=I'\n", "HISTORY > mode=RADIOVELOCITY nchan=118 start=-1 step=0 spwids=[-1] fieldid=0 fac\n", "HISTORY >ts=1 frame=1 distance='0', phaseCenter='field-0 ' mStart='Radialveloci\n", "HISTORY >y: -4000' qStep='0.12 km/s'' mFreqStart='Frequency: 0] \n", "HISTORY Fri May 27 16:15:15 2011 HISTORY imager::data selection [mode=none ncha\n", "HISTORY >n=[-1] start=[0] step=[1] mstart='Radialvelocity: 0' mstep='Radialveloc\n", "HISTORY >ty: 0' spectralwindowids=[] fieldids=[] msselect=] \n", "HISTORY Fri May 27 16:15:16 2011 HISTORY imager::data selection [mode=none ncha\n", "HISTORY >n=[-1] start=[0] step=[1] mstart='Radialvelocity: 0' mstep='Radialveloc\n", "HISTORY >ty: 0' spectralwindowids=[] fieldids=[] msselect=] \n", "HISTORY Fri May 27 16:15:16 2011 HISTORY imager::weight() [] Weighting MS: Imag\n", "HISTORY >ing weights will be changed \n", "HISTORY Fri May 27 16:15:16 2011 HISTORY imager::weight() [] Briggs weighting: \n", "HISTORY > sidelobes will be suppressed over full image \n", "HISTORY Fri May 27 16:15:23 2011 HISTORY imager::clean() [] Using multifield Cl\n", "HISTORY >ark clean \n", "HISTORY Fri May 27 16:15:23 2011 HISTORY imager::clean() [] Clean gain = 0.1, N\n", "HISTORY >iter = 0, Threshold = 1 mJy \n", "HISTORY Fri May 27 16:15:23 2011 HISTORY imager::clean() [] Continuing deconvol\n", "HISTORY >ution \n", "HISTORY Fri May 27 16:16:48 2011 HISTORY imager::clean() [] Threshhold not reac\n", "HISTORY >hed yet. \n", "HISTORY Fri May 27 16:16:48 2011 HISTORY imager::clean() [] Fitted beam used in\n", "HISTORY > restoration: 1.68065 by 1.53193 (arcsec) at pa 22.3015 (deg) \n", "HISTORY Fri May 27 16:17:45 2011 HISTORY imager::clean() [] Clean gain = 0.1, N\n", "HISTORY >iter = 500, Threshold = 1 mJy \n", "HISTORY Fri May 27 16:17:45 2011 HISTORY imager::clean() [] Starting deconvolut\n", "HISTORY >ion \n", "HISTORY Fri May 27 16:23:21 2011 HISTORY imager::clean() [] Threshhold not reac\n", "HISTORY >hed yet. \n", "HISTORY Fri May 27 16:23:21 2011 HISTORY imager::clean() [] Beam used in restor\n", "HISTORY >ation: 1.68065 by 1.53193 (arcsec) at pa 22.3015 (deg) \n", "HISTORY Fri May 27 16:26:42 2011 HISTORY imager::clean() [] Clean gain = 0.1, N\n", "HISTORY >iter = 300, Threshold = 1 mJy \n", "HISTORY Fri May 27 16:26:42 2011 HISTORY imager::clean() [] Continuing deconvol\n", "HISTORY >ution \n", "HISTORY Fri May 27 16:28:52 2011 HISTORY imager::clean() [] Threshhold not reac\n", "HISTORY >hed yet. \n", "HISTORY Fri May 27 17:35:52 2011 HISTORY imager::clean() [] Clean gain = 0.1, N\n", "HISTORY >iter = 300, Threshold = 1 mJy \n", "HISTORY Fri May 27 17:35:52 2011 HISTORY imager::clean() [] Continuing deconvol\n", "HISTORY >ution \n", "HISTORY Fri May 27 17:37:10 2011 HISTORY imager::clean() [] Threshhold not reac\n", "HISTORY >hed yet. \n", "HISTORY CASA END LOGTABLE " ] }, "execution_count": 62, "metadata": {}, "output_type": "execute_result" } ], "source": [ "twhydra.header" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Quick Look\n", "We can use matplotlib" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/javascript": [ "/* Put everything inside the global mpl namespace */\n", "window.mpl = {};\n", "\n", "\n", "mpl.get_websocket_type = function() {\n", " if (typeof(WebSocket) !== 'undefined') {\n", " return WebSocket;\n", " } else if (typeof(MozWebSocket) !== 'undefined') {\n", " return MozWebSocket;\n", " } else {\n", " alert('Your browser does not have WebSocket support.' +\n", " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", " 'Firefox 4 and 5 are also supported but you ' +\n", " 'have to enable WebSockets in about:config.');\n", " };\n", "}\n", "\n", "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n", " this.id = figure_id;\n", "\n", " this.ws = websocket;\n", "\n", " this.supports_binary = (this.ws.binaryType != undefined);\n", "\n", " if (!this.supports_binary) {\n", " var warnings = document.getElementById(\"mpl-warnings\");\n", " if (warnings) {\n", " warnings.style.display = 'block';\n", " warnings.textContent = (\n", " \"This browser does not support binary websocket messages. \" +\n", " \"Performance may be slow.\");\n", " }\n", " }\n", "\n", " this.imageObj = new Image();\n", "\n", " this.context = undefined;\n", " this.message = undefined;\n", " this.canvas = undefined;\n", " this.rubberband_canvas = undefined;\n", " this.rubberband_context = undefined;\n", " this.format_dropdown = undefined;\n", "\n", " this.image_mode = 'full';\n", "\n", " this.root = $('
');\n", " this._root_extra_style(this.root)\n", " this.root.attr('style', 'display: inline-block');\n", "\n", " $(parent_element).append(this.root);\n", "\n", " this._init_header(this);\n", " this._init_canvas(this);\n", " this._init_toolbar(this);\n", "\n", " var fig = this;\n", "\n", " this.waiting = false;\n", "\n", " this.ws.onopen = function () {\n", " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n", " fig.send_message(\"send_image_mode\", {});\n", " if (mpl.ratio != 1) {\n", " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n", " }\n", " fig.send_message(\"refresh\", {});\n", " }\n", "\n", " this.imageObj.onload = function() {\n", " if (fig.image_mode == 'full') {\n", " // Full images could contain transparency (where diff images\n", " // almost always do), so we need to clear the canvas so that\n", " // there is no ghosting.\n", " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", " }\n", " fig.context.drawImage(fig.imageObj, 0, 0);\n", " };\n", "\n", " this.imageObj.onunload = function() {\n", " this.ws.close();\n", " }\n", "\n", " this.ws.onmessage = this._make_on_message_function(this);\n", "\n", " this.ondownload = ondownload;\n", "}\n", "\n", "mpl.figure.prototype._init_header = function() {\n", " var titlebar = $(\n", " '
');\n", " var titletext = $(\n", " '
');\n", " titlebar.append(titletext)\n", " this.root.append(titlebar);\n", " this.header = titletext[0];\n", "}\n", "\n", "\n", "\n", "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "\n", "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "mpl.figure.prototype._init_canvas = function() {\n", " var fig = this;\n", "\n", " var canvas_div = $('
');\n", "\n", " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n", "\n", " function canvas_keyboard_event(event) {\n", " return fig.key_event(event, event['data']);\n", " }\n", "\n", " canvas_div.keydown('key_press', canvas_keyboard_event);\n", " canvas_div.keyup('key_release', canvas_keyboard_event);\n", " this.canvas_div = canvas_div\n", " this._canvas_extra_style(canvas_div)\n", " this.root.append(canvas_div);\n", "\n", " var canvas = $('');\n", " canvas.addClass('mpl-canvas');\n", " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n", "\n", " this.canvas = canvas[0];\n", " this.context = canvas[0].getContext(\"2d\");\n", "\n", " var backingStore = this.context.backingStorePixelRatio ||\n", "\tthis.context.webkitBackingStorePixelRatio ||\n", "\tthis.context.mozBackingStorePixelRatio ||\n", "\tthis.context.msBackingStorePixelRatio ||\n", "\tthis.context.oBackingStorePixelRatio ||\n", "\tthis.context.backingStorePixelRatio || 1;\n", "\n", " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n", "\n", " var rubberband = $('');\n", " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n", "\n", " var pass_mouse_events = true;\n", "\n", " canvas_div.resizable({\n", " start: function(event, ui) {\n", " pass_mouse_events = false;\n", " },\n", " resize: function(event, ui) {\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " stop: function(event, ui) {\n", " pass_mouse_events = true;\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " });\n", "\n", " function mouse_event_fn(event) {\n", " if (pass_mouse_events)\n", " return fig.mouse_event(event, event['data']);\n", " }\n", "\n", " rubberband.mousedown('button_press', mouse_event_fn);\n", " rubberband.mouseup('button_release', mouse_event_fn);\n", " // Throttle sequential mouse events to 1 every 20ms.\n", " rubberband.mousemove('motion_notify', mouse_event_fn);\n", "\n", " rubberband.mouseenter('figure_enter', mouse_event_fn);\n", " rubberband.mouseleave('figure_leave', mouse_event_fn);\n", "\n", " canvas_div.on(\"wheel\", function (event) {\n", " event = event.originalEvent;\n", " event['data'] = 'scroll'\n", " if (event.deltaY < 0) {\n", " event.step = 1;\n", " } else {\n", " event.step = -1;\n", " }\n", " mouse_event_fn(event);\n", " });\n", "\n", " canvas_div.append(canvas);\n", " canvas_div.append(rubberband);\n", "\n", " this.rubberband = rubberband;\n", " this.rubberband_canvas = rubberband[0];\n", " this.rubberband_context = rubberband[0].getContext(\"2d\");\n", " this.rubberband_context.strokeStyle = \"#000000\";\n", "\n", " this._resize_canvas = function(width, height) {\n", " // Keep the size of the canvas, canvas container, and rubber band\n", " // canvas in synch.\n", " canvas_div.css('width', width)\n", " canvas_div.css('height', height)\n", "\n", " canvas.attr('width', width * mpl.ratio);\n", " canvas.attr('height', height * mpl.ratio);\n", " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n", "\n", " rubberband.attr('width', width);\n", " rubberband.attr('height', height);\n", " }\n", "\n", " // Set the figure to an initial 600x600px, this will subsequently be updated\n", " // upon first draw.\n", " this._resize_canvas(600, 600);\n", "\n", " // Disable right mouse context menu.\n", " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n", " return false;\n", " });\n", "\n", " function set_focus () {\n", " canvas.focus();\n", " canvas_div.focus();\n", " }\n", "\n", " window.setTimeout(set_focus, 100);\n", "}\n", "\n", "mpl.figure.prototype._init_toolbar = function() {\n", " var fig = this;\n", "\n", " var nav_element = $('
')\n", " nav_element.attr('style', 'width: 100%');\n", " this.root.append(nav_element);\n", "\n", " // Define a callback function for later on.\n", " function toolbar_event(event) {\n", " return fig.toolbar_button_onclick(event['data']);\n", " }\n", " function toolbar_mouse_event(event) {\n", " return fig.toolbar_button_onmouseover(event['data']);\n", " }\n", "\n", " for(var toolbar_ind in mpl.toolbar_items) {\n", " var name = mpl.toolbar_items[toolbar_ind][0];\n", " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", " var image = mpl.toolbar_items[toolbar_ind][2];\n", " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", "\n", " if (!name) {\n", " // put a spacer in here.\n", " continue;\n", " }\n", " var button = $('');\n", " button.click(method_name, toolbar_event);\n", " button.mouseover(tooltip, toolbar_mouse_event);\n", " nav_element.append(button);\n", " }\n", "\n", " // Add the status bar.\n", " var status_bar = $('');\n", " nav_element.append(status_bar);\n", " this.message = status_bar[0];\n", "\n", " // Add the close button to the window.\n", " var buttongrp = $('
');\n", " var button = $('');\n", " button.click(function (evt) { fig.handle_close(fig, {}); } );\n", " button.mouseover('Stop Interaction', toolbar_mouse_event);\n", " buttongrp.append(button);\n", " var titlebar = this.root.find($('.ui-dialog-titlebar'));\n", " titlebar.prepend(buttongrp);\n", "}\n", "\n", "mpl.figure.prototype._root_extra_style = function(el){\n", " var fig = this\n", " el.on(\"remove\", function(){\n", "\tfig.close_ws(fig, {});\n", " });\n", "}\n", "\n", "mpl.figure.prototype._canvas_extra_style = function(el){\n", " // this is important to make the div 'focusable\n", " el.attr('tabindex', 0)\n", " // reach out to IPython and tell the keyboard manager to turn it's self\n", " // off when our div gets focus\n", "\n", " // location in version 3\n", " if (IPython.notebook.keyboard_manager) {\n", " IPython.notebook.keyboard_manager.register_events(el);\n", " }\n", " else {\n", " // location in version 2\n", " IPython.keyboard_manager.register_events(el);\n", " }\n", "\n", "}\n", "\n", "mpl.figure.prototype._key_event_extra = function(event, name) {\n", " var manager = IPython.notebook.keyboard_manager;\n", " if (!manager)\n", " manager = IPython.keyboard_manager;\n", "\n", " // Check for shift+enter\n", " if (event.shiftKey && event.which == 13) {\n", " this.canvas_div.blur();\n", " // select the cell after this one\n", " var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n", " IPython.notebook.select(index + 1);\n", " }\n", "}\n", "\n", "mpl.figure.prototype.handle_save = function(fig, msg) {\n", " fig.ondownload(fig, null);\n", "}\n", "\n", "\n", "mpl.find_output_cell = function(html_output) {\n", " // Return the cell and output element which can be found *uniquely* in the notebook.\n", " // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n", " // IPython event is triggered only after the cells have been serialised, which for\n", " // our purposes (turning an active figure into a static one), is too late.\n", " var cells = IPython.notebook.get_cells();\n", " var ncells = cells.length;\n", " for (var i=0; i= 3 moved mimebundle to data attribute of output\n", " data = data.data;\n", " }\n", " if (data['text/html'] == html_output) {\n", " return [cell, data, j];\n", " }\n", " }\n", " }\n", " }\n", "}\n", "\n", "// Register the function which deals with the matplotlib target/channel.\n", "// The kernel may be null if the page has been refreshed.\n", "if (IPython.notebook.kernel != null) {\n", " IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n", "}\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "INFO: Auto-setting vmin to -9.227e-01 [aplpy.core]\n", "INFO: Auto-setting vmax to 7.636e+00 [aplpy.core]\n" ] } ], "source": [ "import aplpy \n", "fig = aplpy.FITSFigure(twhydra)\n", "fig.show_grayscale()\n", "fig.show_grid()\n", "fig.show_contour()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/javascript": [ "/* Put everything inside the global mpl namespace */\n", "window.mpl = {};\n", "\n", "\n", "mpl.get_websocket_type = function() {\n", " if (typeof(WebSocket) !== 'undefined') {\n", " return WebSocket;\n", " } else if (typeof(MozWebSocket) !== 'undefined') {\n", " return MozWebSocket;\n", " } else {\n", " alert('Your browser does not have WebSocket support.' +\n", " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", " 'Firefox 4 and 5 are also supported but you ' +\n", " 'have to enable WebSockets in about:config.');\n", " };\n", "}\n", "\n", "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n", " this.id = figure_id;\n", "\n", " this.ws = websocket;\n", "\n", " this.supports_binary = (this.ws.binaryType != undefined);\n", "\n", " if (!this.supports_binary) {\n", " var warnings = document.getElementById(\"mpl-warnings\");\n", " if (warnings) {\n", " warnings.style.display = 'block';\n", " warnings.textContent = (\n", " \"This browser does not support binary websocket messages. \" +\n", " \"Performance may be slow.\");\n", " }\n", " }\n", "\n", " this.imageObj = new Image();\n", "\n", " this.context = undefined;\n", " this.message = undefined;\n", " this.canvas = undefined;\n", " this.rubberband_canvas = undefined;\n", " this.rubberband_context = undefined;\n", " this.format_dropdown = undefined;\n", "\n", " this.image_mode = 'full';\n", "\n", " this.root = $('
');\n", " this._root_extra_style(this.root)\n", " this.root.attr('style', 'display: inline-block');\n", "\n", " $(parent_element).append(this.root);\n", "\n", " this._init_header(this);\n", " this._init_canvas(this);\n", " this._init_toolbar(this);\n", "\n", " var fig = this;\n", "\n", " this.waiting = false;\n", "\n", " this.ws.onopen = function () {\n", " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n", " fig.send_message(\"send_image_mode\", {});\n", " if (mpl.ratio != 1) {\n", " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n", " }\n", " fig.send_message(\"refresh\", {});\n", " }\n", "\n", " this.imageObj.onload = function() {\n", " if (fig.image_mode == 'full') {\n", " // Full images could contain transparency (where diff images\n", " // almost always do), so we need to clear the canvas so that\n", " // there is no ghosting.\n", " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", " }\n", " fig.context.drawImage(fig.imageObj, 0, 0);\n", " };\n", "\n", " this.imageObj.onunload = function() {\n", " this.ws.close();\n", " }\n", "\n", " this.ws.onmessage = this._make_on_message_function(this);\n", "\n", " this.ondownload = ondownload;\n", "}\n", "\n", "mpl.figure.prototype._init_header = function() {\n", " var titlebar = $(\n", " '
');\n", " var titletext = $(\n", " '
');\n", " titlebar.append(titletext)\n", " this.root.append(titlebar);\n", " this.header = titletext[0];\n", "}\n", "\n", "\n", "\n", "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "\n", "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "mpl.figure.prototype._init_canvas = function() {\n", " var fig = this;\n", "\n", " var canvas_div = $('
');\n", "\n", " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n", "\n", " function canvas_keyboard_event(event) {\n", " return fig.key_event(event, event['data']);\n", " }\n", "\n", " canvas_div.keydown('key_press', canvas_keyboard_event);\n", " canvas_div.keyup('key_release', canvas_keyboard_event);\n", " this.canvas_div = canvas_div\n", " this._canvas_extra_style(canvas_div)\n", " this.root.append(canvas_div);\n", "\n", " var canvas = $('');\n", " canvas.addClass('mpl-canvas');\n", " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n", "\n", " this.canvas = canvas[0];\n", " this.context = canvas[0].getContext(\"2d\");\n", "\n", " var backingStore = this.context.backingStorePixelRatio ||\n", "\tthis.context.webkitBackingStorePixelRatio ||\n", "\tthis.context.mozBackingStorePixelRatio ||\n", "\tthis.context.msBackingStorePixelRatio ||\n", "\tthis.context.oBackingStorePixelRatio ||\n", "\tthis.context.backingStorePixelRatio || 1;\n", "\n", " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n", "\n", " var rubberband = $('');\n", " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n", "\n", " var pass_mouse_events = true;\n", "\n", " canvas_div.resizable({\n", " start: function(event, ui) {\n", " pass_mouse_events = false;\n", " },\n", " resize: function(event, ui) {\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " stop: function(event, ui) {\n", " pass_mouse_events = true;\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " });\n", "\n", " function mouse_event_fn(event) {\n", " if (pass_mouse_events)\n", " return fig.mouse_event(event, event['data']);\n", " }\n", "\n", " rubberband.mousedown('button_press', mouse_event_fn);\n", " rubberband.mouseup('button_release', mouse_event_fn);\n", " // Throttle sequential mouse events to 1 every 20ms.\n", " rubberband.mousemove('motion_notify', mouse_event_fn);\n", "\n", " rubberband.mouseenter('figure_enter', mouse_event_fn);\n", " rubberband.mouseleave('figure_leave', mouse_event_fn);\n", "\n", " canvas_div.on(\"wheel\", function (event) {\n", " event = event.originalEvent;\n", " event['data'] = 'scroll'\n", " if (event.deltaY < 0) {\n", " event.step = 1;\n", " } else {\n", " event.step = -1;\n", " }\n", " mouse_event_fn(event);\n", " });\n", "\n", " canvas_div.append(canvas);\n", " canvas_div.append(rubberband);\n", "\n", " this.rubberband = rubberband;\n", " this.rubberband_canvas = rubberband[0];\n", " this.rubberband_context = rubberband[0].getContext(\"2d\");\n", " this.rubberband_context.strokeStyle = \"#000000\";\n", "\n", " this._resize_canvas = function(width, height) {\n", " // Keep the size of the canvas, canvas container, and rubber band\n", " // canvas in synch.\n", " canvas_div.css('width', width)\n", " canvas_div.css('height', height)\n", "\n", " canvas.attr('width', width * mpl.ratio);\n", " canvas.attr('height', height * mpl.ratio);\n", " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n", "\n", " rubberband.attr('width', width);\n", " rubberband.attr('height', height);\n", " }\n", "\n", " // Set the figure to an initial 600x600px, this will subsequently be updated\n", " // upon first draw.\n", " this._resize_canvas(600, 600);\n", "\n", " // Disable right mouse context menu.\n", " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n", " return false;\n", " });\n", "\n", " function set_focus () {\n", " canvas.focus();\n", " canvas_div.focus();\n", " }\n", "\n", " window.setTimeout(set_focus, 100);\n", "}\n", "\n", "mpl.figure.prototype._init_toolbar = function() {\n", " var fig = this;\n", "\n", " var nav_element = $('
')\n", " nav_element.attr('style', 'width: 100%');\n", " this.root.append(nav_element);\n", "\n", " // Define a callback function for later on.\n", " function toolbar_event(event) {\n", " return fig.toolbar_button_onclick(event['data']);\n", " }\n", " function toolbar_mouse_event(event) {\n", " return fig.toolbar_button_onmouseover(event['data']);\n", " }\n", "\n", " for(var toolbar_ind in mpl.toolbar_items) {\n", " var name = mpl.toolbar_items[toolbar_ind][0];\n", " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", " var image = mpl.toolbar_items[toolbar_ind][2];\n", " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", "\n", " if (!name) {\n", " // put a spacer in here.\n", " continue;\n", " }\n", " var button = $('