{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "data_examination.ipynb", "provenance": [], "toc_visible": true } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "6kacy1Yy0EC7" }, "source": [ "# Data Examination/Editing\n", "\n", "Plotting and flagging visibility data in CASA\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "id": "WqMQhCWL0EC8" }, "source": [ "## Visibility Information\n", "\n", "There are tasks provided for basic listing and manipulation of MeasurementSet data and metadata. These include the following tasks, which are described in more detail in the subsequent pages.\n", "\n", "- **listsdm** --- summarize the contents of an SDM\n", "- **listobs** --- summarize the contents of a MS\n", "- **listpartition** --- list the partition structure of a Multi-MS\n", "- **vishead** --- list and change the metadata contents of a MS\n", "- **visstat** --- statistics on data in a MS\n", "- **plotants** --- plotting antenna locations\n", "- **plotms** --- plotting uv-coverages\n", "- **plotweather** --- VLA weather statistics, calculation of opacities\n", "- **browsetable** --- examining an MS\n", "\n", "\n", "\n", "***\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "id": "MwQw2XG90EC8" }, "source": [ "## MeasurementSet Summary\n", "\n", "The MeasurementSet is the way CASA stores visibility data (the [MS definition](casa-fundamentals.ipynb#measurementset-v2) can be found in the [Reference Material](memo-series.ipynb#reference-material) section). This page describes theree tasks to gain access to information stored in the MS: **listobs** displays observational details such as spatial (field), spectral (spectral window), temporal (scans), and polarization setup of an MS; **listpartition** provides information on how a MS was subdivided by the **partition** task (used for parallelized processing); **listvis** prints out the visibility values themselves.\n", "\n", "\n", "\n", "**Summarizing your MS (listobs)**\n", "\n", "An observational summary of the MS contents can be displayed with the **listobs** task. The inputs are:\n", "\n", "```\n", "vis = 'day2_TDEM0003_10s_norx' #Name of input visibility file (MS)\n", "selectdata = True #Data selection parameters\n", " field = '' #Field names or field index\n", " #numbers: '' ==>all, field='0~2,3C286'\n", " spw = '' #spectral-window/frequency/channel\n", " antenna = '' #antenna/baselines: ''==>all, antenna ='3,VA04'\n", " timerange = '' #time range: ''==>all,timerange='09:14:0~09:54:0'\n", " correlation = '' #Select data based on correlation\n", " scan = '' #scan numbers: ''==>all\n", " intent = '' #Select data based on observation intent: ''==>all\n", " feed = '' #multi-feed numbers: Not yet implemented\n", " array = '' #(sub)array numbers: ''==>all\n", " uvrange = '' #uv range: ''==>all; uvrange\n", " #='0~100klambda', default units=meters\n", " observation = '' #Select data based on observation ID: ''==>all\n", "\n", "verbose = True \n", "listfile = '' #Name of disk file to write output: ''==>to terminal\n", "listunfl = False #List unflagged row counts?\n", " #If true, it can have significant negative performance\n", " #impact\n", "```\n", "\n", "The summary (of the selected data) will be written to the logger, to the casapy-YYYYMMDD-HHMMSS.log file, and optionally to a file specified in the *listfile* parameter. For example,\n", "\n", "```\n", "listobs('n5921.ms')\n", "```\n", "\n", "results in a logger message like the following (also the format if a \\'listfile\\' text file is requested):\n", "\n", "```python\n", "listobs(vis=\"day2_TDEM0003_10s_norx\",selectdata=True,spw=\"\",field=\"\",\n", " antenna=\"\",uvrange=\"\",timerange=\"\",correlation=\"\",scan=\"\",\n", " intent=\"\",feed=\"\",array=\"\",observation=\"\",verbose=True,\n", " listfile=\"\",listunfl=False)\n", "================================================================================\n", " MeasurementSet Name: /Users/jott/casa/casatest/casa4.0/irc/day2_TDEM0003_10s_norx MS Version 2\n", "================================================================================\n", " Observer: Mark J. Mark Claussen Project: T.B.D. \n", "Observation: EVLA\n", "Data records: 290218 Total integration time = 10016 seconds\n", " Observed from 26-Apr-2010/03:21:56.0 to 26-Apr-2010/06:08:52.0 (UTC)\n", " \n", " ObservationID = 0 ArrayID = 0\n", " Date Timerange (UTC) Scan FldId FieldName nRows SpwIds Average Interval(s) ScanIntent\n", " 26-Apr-2010/03:21:51.0 - 03:23:21.0 5 2 J0954+1743 2720 [0, 1] [10, 10]\n", " 03:23:39.0 - 03:28:25.0 6 3 IRC+10216 9918 [0, 1] [10, 10]\n", " 03:28:38.0 - 03:29:54.0 7 2 J0954+1743 2700 [0, 1] [10, 10]\n", " 03:30:08.0 - 03:34:53.5 8 3 IRC+10216 9918 [0, 1] [10, 10]\n", "...\n", " (nRows = Total number of rows per scan)\n", "Fields: 4\n", " ID Code Name RA Decl Epoch SrcId nRows\n", " 2 D J0954+1743 09:54:56.823626 +17.43.31.22243 J2000 2 65326\n", " 3 NONE IRC+10216 09:47:57.382000 +13.16.40.65999 J2000 3 208242\n", " 5 F J1229+0203 12:29:06.699729 +02.03.08.59820 J2000 5 10836\n", " 7 E J1331+3030 13:31:08.287984 +30.30.32.95886 J2000 7 5814\n", "Spectral Windows: (2 unique spectral windows and 1 unique polarization setups)\n", " SpwID Name #Chans Frame Ch1(MHz) ChanWid(kHz) TotBW(kHz) Corrs \n", " 0 Subband:0 64 TOPO 36387.229 125.000 8000.0 RR RL LR LL\n", " 1 Subband:0 64 TOPO 36304.542 125.000 8000.0 RR RL LR LL\n", "Sources: 10\n", " ID Name SpwId RestFreq(MHz) SysVel(km/s)\n", " 0 J1008+0730 0 0.03639232 -0.026 \n", " 0 J1008+0730 1 0.03639232 -0.026 \n", " 2 J0954+1743 0 0.03639232 -0.026 \n", " 2 J0954+1743 1 0.03639232 -0.026 \n", " 3 IRC+10216 0 0.03639232 -0.026 \n", " 3 IRC+10216 1 0.03639232 -0.026 \n", " 5 J1229+0203 0 0.03639232 -0.026 \n", " 5 J1229+0203 1 0.03639232 -0.026 \n", " 7 J1331+3030 0 0.03639232 -0.026 \n", " 7 J1331+3030 1 0.03639232 -0.026 \n", "Antennas: 19:\n", " ID Name Station Diam. Long. Lat. Offset from array center (m) ITRF Geocentric coordinates (m) \n", " East North Elevation x y z\n", " 0 ea01 W09 25.0 m -107.37.25.2 +33.53.51.0 -521.9407 -332.7782 -1.1977 -1601710.017000 -5042006.928200 3554602.355600\n", " 1 ea02 E02 25.0 m -107.37.04.4 +33.54.01.1 9.8247 -20.4292 -2.7808 -1601150.059500 -5042000.619800 3554860.729400\n", " 2 ea03 E09 25.0 m -107.36.45.1 +33.53.53.6 506.0591 -251.8666 -3.5832 -1600715.948000 -5042273.187000 3554668.184500\n", " 3 ea04 W01 25.0 m -107.37.05.9 +33.54.00.5 -27.3562 -41.3030 -2.7418 -1601189.030140 -5042000.493300 3554843.425700\n", " 4 ea05 W08 25.0 m -107.37.21.6 +33.53.53.0 -432.1158 -272.1493 -1.5032 -1601614.091000 -5042001.655700 3554652.509300\n", " 5 ea07 N06 25.0 m -107.37.06.9 +33.54.10.3 -54.0667 263.8720 -4.2292 -1601162.593200 -5041829.000000 3555095.890500\n", " 6 ea08 N01 25.0 m -107.37.06.0 +33.54.01.8 -30.8810 -1.4664 -2.8597 -1601185.634945 -5041978.156586 3554876.424700\n", " 7 ea09 E06 25.0 m -107.36.55.6 +33.53.57.7 236.9058 -126.3369 -2.4443 -1600951.588000 -5042125.911000 3554773.012300\n", " 8 ea12 E08 25.0 m -107.36.48.9 +33.53.55.1 407.8394 -206.0057 -3.2252 -1600801.916000 -5042219.371000 3554706.449900\n", " 9 ea15 W06 25.0 m -107.37.15.6 +33.53.56.4 -275.8288 -166.7451 -2.0590 -1601447.198000 -5041992.502500 3554739.687600\n", " 10 ea19 W04 25.0 m -107.37.10.8 +33.53.59.1 -152.8599 -83.8054 -2.4614 -1601315.893000 -5041985.320170 3554808.304600\n", " 11 ea20 N05 25.0 m -107.37.06.7 +33.54.08.0 -47.8454 192.6015 -3.8723 -1601168.786100 -5041869.054000 3555036.936000\n", " 12 ea21 E01 25.0 m -107.37.05.7 +33.53.59.2 -23.8638 -81.1510 -2.5851 -1601192.467800 -5042022.856800 3554810.438800\n", " 13 ea22 N04 25.0 m -107.37.06.5 +33.54.06.1 -42.5986 132.8623 -3.5431 -1601173.953700 -5041902.660400 3554987.536500\n", " 14 ea23 E07 25.0 m -107.36.52.4 +33.53.56.5 318.0523 -164.1848 -2.6960 -1600880.570000 -5042170.388000 3554741.457400\n", " 15 ea24 W05 25.0 m -107.37.13.0 +33.53.57.8 -210.0944 -122.3885 -2.2581 -1601377.008000 -5041988.665500 3554776.393400\n", " 16 ea25 N02 25.0 m -107.37.06.2 +33.54.03.5 -35.6245 53.1806 -3.1345 -1601180.861480 -5041947.453400 3554921.628700\n", " 17 ea27 E03 25.0 m -107.37.02.8 +33.54.00.5 50.6647 -39.4832 -2.7249 -1601114.365500 -5042023.153700 3554844.945600\n", " 18 ea28 N08 25.0 m -107.37.07.5 +33.54.15.8 -68.9057 433.1889 -5.0602 -1601147.940400 -5041733.837000 3555235.956000\n", "```\n", "\n", "**listobs** shows information on the project itself like project code, observer and telescope, followed by the sequence of scans with start/stop times, integration times, and scan intents, a list of all fields with name and coordinates, available spectral windows and their shapes, a list of sources (field/spw combination), and finally the location of all antennas that are used in the observation. A row is an MS entry for a given time stamp and baseline (rows can be accessed e.g. via **browsetable**).\n", "\n", "*verbose=False* would not show the complete list, in particular no information on the scans.\n", "\n", "\n", "\n", "\n", "\n", "**MMS summary (listpartition)**\n", "\n", "**listobs** can also be used for Multi MeasurementSets (MMSs). In addition, the task **listpartition** will provide additional information how the data is structured in preparation for parallelized processing (e.g. using the **partition** task). The inputs are:\n", "\n", "\n", "\n", "```\n", "#listpartition :: List the summary of a Multi-MS data set in the logger or in a file\n", "vis = '' #Name of Multi-MS or normal MS.\n", "createdict = False #Create and return a dictionary with\n", " #Sub-MS information\n", "listfile = '' #Name of ASCII file to save output:\n", " #''==>to terminal\n", "```\n", "\n", "For example,\n", "\n", "```\n", "listpartition('n5921.mms')\n", "```\n", "\n", "results in the logger messages:\n", "\n", "```python\n", "This is a multi-MS with separation axis = scan,spw\n", "Sub-MS Scan Spw Nchan Nrows Size \n", "ngc5921.mms.0000.ms 2 [0] [63] 1890 27M \n", " 4 [0] [63] 756 \n", " 5 [0] [63] 1134 \n", " 6 [0] [63] 6804 \n", "ngc5921.mms.0001.ms 1 [0] [63] 4509 28M \n", " 3 [0] [63] 6048 \n", " 7 [0] [63] 1512 \n", "```\n", "\n", "The output can also be redirected to a [python dictionary](http://casa.nrao.edu/casadocs/stable/usingcasa/python-and-casa#figid-casapythondictionaries) through the *createdict* parameter.\n", "\n", "\n", "\n", "**Listing MS data (listvis)**\n", "\n", "The **listvis** prints a list of the visibility data in an MS to the terminal or a textfile. The inputs are:\n", "\n", "```\n", "#listvis :: List MeasurementSet visibilities.\n", "vis = '' #Name of input visibility file\n", "options = 'ap' #List options: ap only\n", "datacolumn = 'data' #Column to list: data, float_data, corrected, model,\n", " #residual\n", "field = '' #Field names or index to be listed: ''==>all\n", "spw = '*' #Spectral window:channels: '*'==>all, spw='1:5~57'\n", "selectdata = False #Other data selection parameters\n", "observation = '' #Select by observation ID(s)\n", "average = '' #Averaging mode: ==>none (Not yet implemented)\n", "showflags = False #Show flagged data (Not yet implemented)\n", "pagerows = 50 #Rows per page\n", "listfile = '' #Output file\n", "```\n", "\n", "For example,\n", "\n", "```python\n", "Units of columns are: Date/Time(YYMMDD/HH:MM:SS UT), UVDist(wavelength), Phase(deg), UVW(m)\n", "WEIGHT: 7\n", "FIELD: 2\n", "SPW: 0\n", "Date/Time: RR: RL: LR: LL: \n", "2010/04/26/ Intrf UVDist Chn Amp Phs Wt F Amp Phs Wt F Amp Phs Wt F Amp Phs Wt F U V W\n", "------------|---------|------|----|--------------------|-------------------|-------------------|-------------------|---------|---------|---------|\n", " 03:21:56.0 ea01-ea02 72363 0: 0.005 -124.5 7 0.005 25.7 7 0.001 104.6 7 0.000 23.4 7 -501.93 -321.75 157.78\n", " 03:21:56.0 ea01-ea02 72363 1: 0.001 -4.7 7 0.001 -135.1 7 0.004 -14.6 7 0.001 19.9 7 -501.93 -321.75 157.78\n", " 03:21:56.0 ea01-ea02 72363 2: 0.002 17.8 7 0.002 34.3 7 0.005 -114.3 7 0.005 -149.7 7 -501.93 -321.75 157.78\n", " 03:21:56.0 ea01-ea02 72363 3: 0.004 -19.4 7 0.003 -79.2 7 0.002 -89.0 7 0.004 31.3 7 -501.93 -321.75 157.78\n", " 03:21:56.0 ea01-ea02 72363 4: 0.001 -16.8 7 0.004 -141.5 7 0.005 114.9 7 0.006 105.2 7 -501.93 -321.75 157.78\n", " 03:21:56.0 ea01-ea02 72363 5: 0.001 -29.8 7 0.009 -96.4 7 0.002 -125.0 7 0.002 -64.5 7 -501.93 -321.75 157.78\n", "...\n", "Type Q to quit, A to toggle long/short list, or RETURN to continue [continue]:\n", "```\n", "\n", "columns are:\n", "\n", "