casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
jupiter6cm_flagdemo.py
Go to the documentation of this file.
00001 ######################################################################
00002 #                                                                    #
00003 # Use Case Script for Jupiter 6cm VLA                                #
00004 #                                                                    #
00005 # Updated STM 2008-05-26 (Beta Patch 2.0)                            #
00006 # Updated STM 2008-06-12 (Beta Patch 2.0) for summer school demo     #
00007 #                                                                    #
00008 # IMPORT AND FLAGGING ONLY SET UP AS DEMO                            #
00009 #                                                                    #
00010 ######################################################################
00011 
00012 import time
00013 import os
00014 
00015 # 
00016 #=====================================================================
00017 #
00018 # This script has some interactive commands: scriptmode = True
00019 # if you are running it and want it to stop during interactive parts.
00020 
00021 scriptmode = True
00022 
00023 #=====================================================================
00024 #
00025 # Set up some useful variables - these will be set during the script
00026 # also, but if you want to restart the script in the middle here
00027 # they are in one place:
00028 
00029 pathname=os.environ.get('CASAPATH').split()[0]
00030 prefix='jupiter6cm.demo'
00031 
00032 # Clean up old files
00033 os.system('rm -rf '+prefix+'*')
00034 
00035 msfile = prefix + '.ms'
00036 
00037 #
00038 #=====================================================================
00039 #
00040 # Get to path to the CASA home and stip off the name
00041 pathname=os.environ.get('CASAPATH').split()[0]
00042 
00043 # This is where the UVFITS data should be
00044 #fitsdata=pathname+'/data/demo/jupiter6cm.fits'
00045 # Or
00046 #fitsdata=pathname+'/data/nrao/VLA/planets_6cm.fits'
00047 #
00048 # Can also be found online at
00049 #http://casa.nrao.edu/Data/VLA/Planets6cm/planets_6cm.fits
00050 
00051 # Use version in current directory
00052 fitsdata='planets_6cm.fits'
00053 
00054 #
00055 #=====================================================================
00056 # Data Import and List
00057 #=====================================================================
00058 #
00059 # Import the data from FITS to MS
00060 #
00061 print '--Import--'
00062 
00063 # Safest to start from task defaults
00064 default('importuvfits')
00065 
00066 print "Use importuvfits to read UVFITS and make an MS"
00067 
00068 # Set up the MS filename and save as new global variable
00069 msfile = prefix + '.ms'
00070 
00071 print "MS will be called "+msfile
00072 
00073 # Use task importuvfits
00074 fitsfile = fitsdata
00075 vis = msfile
00076 importuvfits()
00077 
00078 #=====================================================================
00079 #
00080 # List a summary of the MS
00081 #
00082 print '--Listobs--'
00083 
00084 # Don't default this one and make use of the previous setting of
00085 # vis.  Remember, the variables are GLOBAL!
00086 
00087 print "Use listobs to print verbose summary to logger"
00088 
00089 # You may wish to see more detailed information, in this case
00090 # use the verbose = True option
00091 verbose = True
00092 
00093 listobs()
00094 
00095 # You should get in your logger window and in the casapy.log file
00096 # something like:
00097 #
00098 #    Observer: FLUX99     Project:   
00099 # Observation: VLA
00100 # 
00101 # Data records: 2021424       Total integration time = 85133.2 seconds
00102 #    Observed from   23:15:27   to   22:54:20
00103 # 
00104 #    ObservationID = 0         ArrayID = 0
00105 #   Date        Timerange                Scan  FldId FieldName      SpwIds
00106 #   15-Apr-1999/23:15:26.7 - 23:16:10.0     1      0 0137+331       [0, 1]
00107 #               23:38:40.0 - 23:48:00.0     2      1 0813+482       [0, 1]
00108 #               23:53:40.0 - 23:55:20.0     3      2 0542+498       [0, 1]
00109 #   16-Apr-1999/00:22:10.1 - 00:23:49.9     4      3 0437+296       [0, 1]
00110 #               00:28:23.3 - 00:30:00.1     5      4 VENUS          [0, 1]
00111 #               00:48:40.0 - 00:50:20.0     6      1 0813+482       [0, 1]
00112 #               00:56:13.4 - 00:57:49.9     7      2 0542+498       [0, 1]
00113 #               01:10:20.1 - 01:11:59.9     8      5 0521+166       [0, 1]
00114 #               01:23:29.9 - 01:25:00.1     9      3 0437+296       [0, 1]
00115 #               01:29:33.3 - 01:31:10.0    10      4 VENUS          [0, 1]
00116 #               01:49:50.0 - 01:51:30.0    11      6 1411+522       [0, 1]
00117 #               02:03:00.0 - 02:04:30.0    12      7 1331+305       [0, 1]
00118 #               02:17:30.0 - 02:19:10.0    13      1 0813+482       [0, 1]
00119 #               02:24:20.0 - 02:26:00.0    14      2 0542+498       [0, 1]
00120 #               02:37:49.9 - 02:39:30.0    15      5 0521+166       [0, 1]
00121 #               02:50:50.1 - 02:52:20.1    16      3 0437+296       [0, 1]
00122 #               02:59:20.0 - 03:01:00.0    17      6 1411+522       [0, 1]
00123 #               03:12:30.0 - 03:14:10.0    18      7 1331+305       [0, 1]
00124 #               03:27:53.3 - 03:29:39.9    19      1 0813+482       [0, 1]
00125 #               03:35:00.0 - 03:36:40.0    20      2 0542+498       [0, 1]
00126 #               03:49:50.0 - 03:51:30.1    21      6 1411+522       [0, 1]
00127 #               04:03:10.0 - 04:04:50.0    22      7 1331+305       [0, 1]
00128 #               04:18:49.9 - 04:20:40.0    23      1 0813+482       [0, 1]
00129 #               04:25:56.6 - 04:27:39.9    24      2 0542+498       [0, 1]
00130 #               04:42:49.9 - 04:44:40.0    25      8 MARS           [0, 1]
00131 #               04:56:50.0 - 04:58:30.1    26      6 1411+522       [0, 1]
00132 #               05:24:03.3 - 05:33:39.9    27      7 1331+305       [0, 1]
00133 #               05:48:00.0 - 05:49:49.9    28      1 0813+482       [0, 1]
00134 #               05:58:36.6 - 06:00:30.0    29      8 MARS           [0, 1]
00135 #               06:13:20.1 - 06:14:59.9    30      6 1411+522       [0, 1]
00136 #               06:27:40.0 - 06:29:20.0    31      7 1331+305       [0, 1]
00137 #               06:44:13.4 - 06:46:00.0    32      1 0813+482       [0, 1]
00138 #               06:55:06.6 - 06:57:00.0    33      8 MARS           [0, 1]
00139 #               07:10:40.0 - 07:12:20.0    34      6 1411+522       [0, 1]
00140 #               07:28:20.0 - 07:30:10.1    35      7 1331+305       [0, 1]
00141 #               07:42:49.9 - 07:44:30.0    36      8 MARS           [0, 1]
00142 #               07:58:43.3 - 08:00:39.9    37      6 1411+522       [0, 1]
00143 #               08:13:30.0 - 08:15:19.9    38      7 1331+305       [0, 1]
00144 #               08:27:53.4 - 08:29:30.0    39      8 MARS           [0, 1]
00145 #               08:42:59.9 - 08:44:50.0    40      6 1411+522       [0, 1]
00146 #               08:57:09.9 - 08:58:50.0    41      7 1331+305       [0, 1]
00147 #               09:13:03.3 - 09:14:50.1    42      9 NGC7027        [0, 1]
00148 #               09:26:59.9 - 09:28:40.0    43      6 1411+522       [0, 1]
00149 #               09:40:33.4 - 09:42:09.9    44      7 1331+305       [0, 1]
00150 #               09:56:19.9 - 09:58:10.0    45      9 NGC7027        [0, 1]
00151 #               10:12:59.9 - 10:14:50.0    46      8 MARS           [0, 1]
00152 #               10:27:09.9 - 10:28:50.0    47      6 1411+522       [0, 1]
00153 #               10:40:30.0 - 10:42:00.0    48      7 1331+305       [0, 1]
00154 #               10:56:10.0 - 10:57:50.0    49      9 NGC7027        [0, 1]
00155 #               11:28:30.0 - 11:35:30.0    50     10 NEPTUNE        [0, 1]
00156 #               11:48:20.0 - 11:50:10.0    51      6 1411+522       [0, 1]
00157 #               12:01:36.7 - 12:03:10.0    52      7 1331+305       [0, 1]
00158 #               12:35:33.3 - 12:37:40.0    53     11 URANUS         [0, 1]
00159 #               12:46:30.0 - 12:48:10.0    54     10 NEPTUNE        [0, 1]
00160 #               13:00:29.9 - 13:02:10.0    55      6 1411+522       [0, 1]
00161 #               13:15:23.3 - 13:17:10.1    56      9 NGC7027        [0, 1]
00162 #               13:33:43.3 - 13:35:40.0    57     11 URANUS         [0, 1]
00163 #               13:44:30.0 - 13:46:10.0    58     10 NEPTUNE        [0, 1]
00164 #               14:00:46.7 - 14:01:39.9    59      0 0137+331       [0, 1]
00165 #               14:10:40.0 - 14:12:09.9    60     12 JUPITER        [0, 1]
00166 #               14:24:06.6 - 14:25:40.1    61     11 URANUS         [0, 1]
00167 #               14:34:30.0 - 14:36:10.1    62     10 NEPTUNE        [0, 1]
00168 #               14:59:13.4 - 15:00:00.0    63      0 0137+331       [0, 1]
00169 #               15:09:03.3 - 15:10:40.1    64     12 JUPITER        [0, 1]
00170 #               15:24:30.0 - 15:26:20.1    65      9 NGC7027        [0, 1]
00171 #               15:40:10.0 - 15:45:00.0    66     11 URANUS         [0, 1]
00172 #               15:53:50.0 - 15:55:20.0    67     10 NEPTUNE        [0, 1]
00173 #               16:18:53.4 - 16:19:49.9    68      0 0137+331       [0, 1]
00174 #               16:29:10.1 - 16:30:49.9    69     12 JUPITER        [0, 1]
00175 #               16:42:53.4 - 16:44:30.0    70     11 URANUS         [0, 1]
00176 #               16:54:53.4 - 16:56:40.0    71      9 NGC7027        [0, 1]
00177 #               17:23:06.6 - 17:30:40.0    72      2 0542+498       [0, 1]
00178 #               17:41:50.0 - 17:43:20.0    73      3 0437+296       [0, 1]
00179 #               17:55:36.7 - 17:57:39.9    74      4 VENUS          [0, 1]
00180 #               18:19:23.3 - 18:20:09.9    75      0 0137+331       [0, 1]
00181 #               18:30:23.3 - 18:32:00.0    76     12 JUPITER        [0, 1]
00182 #               18:44:49.9 - 18:46:30.0    77      9 NGC7027        [0, 1]
00183 #               18:59:13.3 - 19:00:59.9    78      2 0542+498       [0, 1]
00184 #               19:19:10.0 - 19:21:20.1    79      5 0521+166       [0, 1]
00185 #               19:32:50.1 - 19:34:29.9    80      3 0437+296       [0, 1]
00186 #               19:39:03.3 - 19:40:40.1    81      4 VENUS          [0, 1]
00187 #               20:08:06.7 - 20:08:59.9    82      0 0137+331       [0, 1]
00188 #               20:18:10.0 - 20:19:50.0    83     12 JUPITER        [0, 1]
00189 #               20:33:53.3 - 20:35:40.1    84      1 0813+482       [0, 1]
00190 #               20:40:59.9 - 20:42:40.0    85      2 0542+498       [0, 1]
00191 #               21:00:16.6 - 21:02:20.1    86      5 0521+166       [0, 1]
00192 #               21:13:53.4 - 21:15:29.9    87      3 0437+296       [0, 1]
00193 #               21:20:43.4 - 21:22:30.0    88      4 VENUS          [0, 1]
00194 #               21:47:26.7 - 21:48:20.1    89      0 0137+331       [0, 1]
00195 #               21:57:30.0 - 21:59:10.0    90     12 JUPITER        [0, 1]
00196 #               22:12:13.3 - 22:14:00.1    91      2 0542+498       [0, 1]
00197 #               22:28:33.3 - 22:30:19.9    92      4 VENUS          [0, 1]
00198 #               22:53:33.3 - 22:54:19.9    93      0 0137+331       [0, 1]
00199 # 
00200 # Fields: 13
00201 #   ID   Name          Right Ascension  Declination   Epoch   
00202 #   0    0137+331      01:37:41.30      +33.09.35.13  J2000   
00203 #   1    0813+482      08:13:36.05      +48.13.02.26  J2000   
00204 #   2    0542+498      05:42:36.14      +49.51.07.23  J2000   
00205 #   3    0437+296      04:37:04.17      +29.40.15.14  J2000   
00206 #   4    VENUS         04:06:54.11      +22.30.35.91  J2000   
00207 #   5    0521+166      05:21:09.89      +16.38.22.05  J2000   
00208 #   6    1411+522      14:11:20.65      +52.12.09.14  J2000   
00209 #   7    1331+305      13:31:08.29      +30.30.32.96  J2000   
00210 #   8    MARS          14:21:41.37      -12.21.49.45  J2000   
00211 #   9    NGC7027       21:07:01.59      +42.14.10.19  J2000   
00212 #   10   NEPTUNE       20:26:01.14      -18.54.54.21  J2000   
00213 #   11   URANUS        21:15:42.83      -16.35.05.59  J2000   
00214 #   12   JUPITER       00:55:34.04      +04.45.44.71  J2000   
00215 # 
00216 # Spectral Windows: (2 unique spectral windows and 1 unique polarization setups)
00217 #   SpwID  #Chans Frame Ch1(MHz)    Resoln(kHz) TotBW(kHz)  Ref(MHz)    Corrs           
00218 #   0           1 TOPO  4885.1      50000       50000       4885.1      RR  RL  LR  LL  
00219 #   1           1 TOPO  4835.1      50000       50000       4835.1      RR  RL  LR  LL  
00220 # 
00221 # Feeds: 28: printing first row only
00222 #   Antenna   Spectral Window     # Receptors    Polarizations
00223 #   1         -1                  2              [         R, L]
00224 # 
00225 # Antennas: 27:
00226 #   ID   Name  Station   Diam.    Long.         Lat.         
00227 #   0    1     VLA:W9    25.0 m   -107.37.25.1  +33.53.51.0  
00228 #   1    2     VLA:N9    25.0 m   -107.37.07.8  +33.54.19.0  
00229 #   2    3     VLA:N3    25.0 m   -107.37.06.3  +33.54.04.8  
00230 #   3    4     VLA:N5    25.0 m   -107.37.06.7  +33.54.08.0  
00231 #   4    5     VLA:N2    25.0 m   -107.37.06.2  +33.54.03.5  
00232 #   5    6     VLA:E1    25.0 m   -107.37.05.7  +33.53.59.2  
00233 #   6    7     VLA:E2    25.0 m   -107.37.04.4  +33.54.01.1  
00234 #   7    8     VLA:N8    25.0 m   -107.37.07.5  +33.54.15.8  
00235 #   8    9     VLA:E8    25.0 m   -107.36.48.9  +33.53.55.1  
00236 #   9    10    VLA:W3    25.0 m   -107.37.08.9  +33.54.00.1  
00237 #   10   11    VLA:N1    25.0 m   -107.37.06.0  +33.54.01.8  
00238 #   11   12    VLA:E6    25.0 m   -107.36.55.6  +33.53.57.7  
00239 #   12   13    VLA:W7    25.0 m   -107.37.18.4  +33.53.54.8  
00240 #   13   14    VLA:E4    25.0 m   -107.37.00.8  +33.53.59.7  
00241 #   14   15    VLA:N7    25.0 m   -107.37.07.2  +33.54.12.9  
00242 #   15   16    VLA:W4    25.0 m   -107.37.10.8  +33.53.59.1  
00243 #   16   17    VLA:W5    25.0 m   -107.37.13.0  +33.53.57.8  
00244 #   17   18    VLA:N6    25.0 m   -107.37.06.9  +33.54.10.3  
00245 #   18   19    VLA:E7    25.0 m   -107.36.52.4  +33.53.56.5  
00246 #   19   20    VLA:E9    25.0 m   -107.36.45.1  +33.53.53.6  
00247 #   21   22    VLA:W8    25.0 m   -107.37.21.6  +33.53.53.0  
00248 #   22   23    VLA:W6    25.0 m   -107.37.15.6  +33.53.56.4  
00249 #   23   24    VLA:W1    25.0 m   -107.37.05.9  +33.54.00.5  
00250 #   24   25    VLA:W2    25.0 m   -107.37.07.4  +33.54.00.9  
00251 #   25   26    VLA:E5    25.0 m   -107.36.58.4  +33.53.58.8  
00252 #   26   27    VLA:N4    25.0 m   -107.37.06.5  +33.54.06.1  
00253 #   27   28    VLA:E3    25.0 m   -107.37.02.8  +33.54.00.5  
00254 # 
00255 # Tables:
00256 #    MAIN                 2021424 rows     
00257 #    ANTENNA                   28 rows     
00258 #    DATA_DESCRIPTION           2 rows     
00259 #    DOPPLER             <absent>  
00260 #    FEED                      28 rows     
00261 #    FIELD                     13 rows     
00262 #    FLAG_CMD             <empty>  
00263 #    FREQ_OFFSET         <absent>  
00264 #    HISTORY                 7058 rows     
00265 #    OBSERVATION                1 row      
00266 #    POINTING                2604 rows     
00267 #    POLARIZATION               1 row      
00268 #    PROCESSOR            <empty>  
00269 #    SOURCE               <empty> (see FIELD)
00270 #    SPECTRAL_WINDOW            2 rows     
00271 #    STATE                <empty>  
00272 #    SYSCAL              <absent>  
00273 #    WEATHER             <absent>  
00274 
00275 # 
00276 #=====================================================================
00277 # Data Examination and Flagging
00278 #=====================================================================
00279 # 
00280 # Use Plotxy to interactively flag the data
00281 #
00282 print '--Plotxy--'
00283 default('plotxy')
00284 
00285 print "Now we use plotxy to examine and interactively flag data"
00286 
00287 vis = msfile
00288 
00289 # The fields we are interested in: 1331+305,JUPITER,0137+331
00290 selectdata = True
00291 
00292 # First we do the primary calibrator
00293 field = '1331+305'
00294 
00295 # Plot only the RR and LL for now
00296 correlation = 'RR LL'
00297 
00298 # Plot amplitude vs. uvdist
00299 xaxis = 'uvdist'
00300 yaxis = 'amp'
00301 multicolor = 'both'
00302 
00303 # Use the field name as the title
00304 selectplot = True
00305 title = field+"  "
00306 
00307 iteration = ''
00308 
00309 plotxy()
00310 
00311 print ""
00312 print "-----------------------------------------------------"
00313 print "Plotxy"
00314 print "Showing 1331+305 RR LL for all antennas"
00315 print "Use MarkRegion then draw boxes around points to flag"
00316 print "You can use ESC to drop last drawn box"
00317 print "When happy with boxes, hit Flag to flag"
00318 print "You can repeat as necessary"
00319 
00320 # Pause script if you are running in scriptmode
00321 if scriptmode:
00322     user_check=raw_input('Return to continue script\n')
00323 
00324 # You can also use flagdata to do this non-interactively
00325 # (see below)
00326 
00327 # Now look at the cross-polar products
00328 correlation = 'RL LR'
00329 
00330 plotxy()
00331 
00332 print ""
00333 print "-----------------------------------------------------"
00334 print "Looking at RL LR"
00335 print "Now flag the bad data here"
00336 
00337 # Pause script if you are running in scriptmode
00338 if scriptmode:
00339     user_check=raw_input('Return to continue script\n')
00340 
00341 #---------------------------------------------------------------------
00342 # Now do calibrater 0137+331
00343 field = '0137+331'
00344 correlation = 'RR LL'
00345 xaxis = 'uvdist'
00346 spw = ''
00347 iteration = ''
00348 antenna = ''
00349 
00350 title = field+"  "
00351 
00352 plotxy()
00353 
00354 # You'll see a bunch of bad data along the bottom near zero amp
00355 # Draw a box around some of it and use Locate
00356 # Looks like much of it is Antenna 9 (ID=8) in spw=1
00357 
00358 print ""
00359 print "-----------------------------------------------------"
00360 print "Plotting 0137+331 RR LL all antennas"
00361 print "You see bad data along bottom"
00362 print "Mark a box around a bit of it and hit Locate"
00363 print "Look in logger to see what it is"
00364 print "You see much is Antenna 9 (ID=8) in spw 1"
00365 
00366 # Pause script if you are running in scriptmode
00367 if scriptmode:
00368     user_check=raw_input('Return to continue script\n')
00369 
00370 xaxis = 'time'
00371 spw = '1'
00372 correlation = ''
00373 
00374 # Note that the strings like antenna='9' first try to match the 
00375 # NAME which we see in listobs was the number '9' for ID=8.
00376 # So be careful here (why naming antennas as numbers is bad).
00377 antenna = '9'
00378 
00379 plotxy()
00380 
00381 # YES! the last 4 scans are bad.  Box 'em and flag.
00382 
00383 print ""
00384 print "-----------------------------------------------------"
00385 print "Plotting vs. time antenna='9' and spw='1' "
00386 print "Box up last 4 scans which are bad and Flag"
00387 
00388 # Pause script if you are running in scriptmode
00389 if scriptmode:
00390     user_check=raw_input('Return to continue script\n')
00391 
00392 # Go back and clean up
00393 xaxis = 'uvdist'
00394 spw = ''
00395 antenna = ''
00396 correlation = 'RR LL'
00397 
00398 plotxy()
00399 
00400 # Box up the bad low points (basically a clip below 0.52) and flag
00401 
00402 # Note that RL,LR are too weak to clip on.
00403 
00404 print ""
00405 print "-----------------------------------------------------"
00406 print "Back to all data"
00407 print "Clean up remaining bad points"
00408 
00409 # Pause script if you are running in scriptmode
00410 if scriptmode:
00411     user_check=raw_input('Return to continue script\n')
00412 
00413 #---------------------------------------------------------------------
00414 # Finally, do JUPITER
00415 field = 'JUPITER'
00416 correlation = 'RR LL'
00417 iteration = ''
00418 xaxis = 'uvdist'
00419 
00420 title = field+"  "
00421 
00422 plotxy()
00423 
00424 # Here you will see that the final scan at 22:00:00 UT is bad
00425 # Draw a box around it and flag it!
00426 
00427 print ""
00428 print "-----------------------------------------------------"
00429 print "Now plot JUPITER versus uvdist"
00430 print "Lots of bad stuff near bottom"
00431 print "Lets go and find it - try Locate"
00432 print "Looks like lots of different antennas but at same time"
00433 
00434 # Pause script if you are running in scriptmode
00435 if scriptmode:
00436     user_check=raw_input('Return to continue script\n')
00437 
00438 correlation = ''
00439 xaxis = 'time'
00440 
00441 plotxy()
00442 
00443 # Here you will see that the final scan at 22:00:00 UT is bad
00444 # Draw a box around it and flag it!
00445 
00446 print ""
00447 print "-----------------------------------------------------"
00448 print "Now plotting vs. time"
00449 print "See bad scan at end - flag it!"
00450 
00451 # Pause script if you are running in scriptmode
00452 if scriptmode:
00453     user_check=raw_input('Return to continue script\n')
00454 
00455 # Now look at whats left
00456 correlation = 'RR LL'
00457 xaxis = 'uvdist'
00458 spw = '1'
00459 antenna = ''
00460 iteration = 'antenna'
00461 
00462 plotxy()
00463 
00464 # As you step through, you will see that Antenna 9 (ID=8) is often 
00465 # bad in this spw. If you box and do Locate (or remember from
00466 # 0137+331) its probably a bad time.
00467 
00468 print ""
00469 print "-----------------------------------------------------"
00470 print "Looking now at SPW 1"
00471 print "Now we set iteration to Antenna"
00472 print "Step through antennas with Next"
00473 print "See bad Antenna 9 (ID 8) as in 0137+331"
00474 
00475 # Pause script if you are running in scriptmode
00476 if scriptmode:
00477     user_check=raw_input('Return to continue script\n')
00478 
00479 # The easiset way to kill it:
00480 
00481 antenna = '9'
00482 iteration = ''
00483 xaxis = 'time'
00484 correlation = ''
00485 
00486 plotxy()
00487 
00488 # Draw a box around all points in the last bad scans and flag 'em!
00489 
00490 print ""
00491 print "-----------------------------------------------------"
00492 print "Now plotting vs. time antenna 9 spw 1"
00493 print "Box up the bad scans and Flag"
00494 
00495 # Pause script if you are running in scriptmode
00496 if scriptmode:
00497     user_check=raw_input('Return to continue script\n')
00498 
00499 # Now clean up the rest
00500 xaxis = 'uvdist'
00501 correlation = 'RR LL'
00502 antenna = ''
00503 spw = ''
00504 
00505 # You will be drawing many tiny boxes, so remember you can
00506 # use the ESC key to get rid of the most recent box if you
00507 # make a mistake.
00508 
00509 plotxy()
00510 
00511 # Note that the end result is we've flagged lots of points
00512 # in RR and LL.  We will rely upon imager to ignore the
00513 # RL LR for points with RR LL flagged!
00514 
00515 print ""
00516 print "-----------------------------------------------------"
00517 print "Final cleanup of JUPITER data"
00518 print "Back to uvdist plot, see remaining bad data"
00519 print "You can draw little boxes around the outliers and Flag"
00520 print "Depends how patient you are in drawing boxes!"
00521 print "Could also use Locate to find where they come from"
00522 
00523 # Pause script if you are running in scriptmode
00524 if scriptmode:
00525     user_check=raw_input('Return to continue script\n')
00526 
00527 print "Done with plotxy!"
00528 
00529 #
00530 #=====================================================================
00531 #
00532 # Use Flagmanager to save a copy of the flags so far
00533 #
00534 print '--Flagmanager--'
00535 default('flagmanager')
00536 
00537 print "Now will use flagmanager to save a copy of the flags we just made"
00538 print "These are named xyflags"
00539 
00540 vis = msfile
00541 mode = 'save'
00542 versionname = 'xyflags'
00543 comment = 'Plotxy flags'
00544 merge = 'replace'
00545 
00546 flagmanager()
00547 
00548 #=====================================================================
00549 #
00550 # Use Flagmanager to list all saved versions
00551 #
00552 print '--Flagmanager--'
00553 default('flagmanager')
00554 
00555 print "Now will use flagmanager to list all the versions we saved"
00556 
00557 vis = msfile
00558 mode = 'list'
00559 
00560 flagmanager()
00561 
00562 #
00563 # Done Flagging
00564 print '--Done with flagging--'
00565 
00566 #
00567 #=====================================================================