Flagdata

From CASA Guides
Revision as of 21:56, 1 December 2009 by Jgallimo (talk | contribs) (Created page with '<pre> Help on flagdata task: All purpose flagging task based on selections The task will flag a subset of data explicitly with the modes: manualflag = flagg…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Help on flagdata task:

 All purpose flagging task based on selections
        The task will flag a subset of data explicitly with the modes:
            manualflag = flagging based on specific selection parameter
                         plus clipping and flagging autcorrelations
            summary    = report the amount of flagged data
            quack      = remove/keep specific time range at scan beginning/end
            shadow     = remove antenna-shadowed data
            rfi        = Radio Frequency Interference auto-flagging
            autoflag   = experimental auto-flagging outliers

        Unflagging is also available with options manualflag and quack.

        The flags stored in the MS are automatically backed up before each run,
        unless flagbackup = False.

        Keyword arguments:
        vis -- Name of input visibility file
                default: none example: vis='ngc5921.ms'

        flagbackup -- Automatically backup flags?
                default: True
                options: True,False

        mode -- Mode of operation.
                options: 'manualflag','autoflag','summary','quack','shadow'
                default: 'manualflag'

        manualflag --  option does data-selected flagging.
               If autocorr = F; clipminmax = [], then
                  flagging or unflagging [unflag=F, unflag=T] is specified by
                  the data selection parameters.
                     
           Other flagging options, with the appropriate data selection

           parameters, that are available are:

              autocorr -- Flag autocorrelations 
                  default: False
                  options: True,False

              clipexpr -- Clip using the following:
                default: 'ABS RR'; example: clipexpr='RE XX'
                options: 'ABS','ARG','RE','IM','NORM' + ' ' +
                          'I','XX','YY','RR','LL'
              channelavg -- Average data over (selected) channels? Channel
                            selections are taken into account. Flagged channels
                            are excluded from the average.
                default: False
                options: True,False
              clipminmax -- Range of data (Jy) that will NOT be flagged
                default: [] means do not use clip option
                example: [0.0,1.5]
              clipcolumn -- Column to use for clipping.
                default: 'DATA'
                options: 'DATA','CORRECTED','MODEL'
              clipoutside -- Clip OUTSIDE the range ?
                default: True
                example: False -> flag data WITHIN the range.
              unflag -- Unflag the specified data
                default: False (i.e. flag); example: unflag=True
              
        quack: option to remove specified part of scan beginning
           quackinterval -- Time in seconds from scan beginning/end to flag
                Make time slightly smaller than the desired time
           quackmode -- Quack mode
                default: 'beg'
                    'beg'  ==> beginning of scan
                    'endb' ==> end of scan. 
                    'tail' ==> all but beginning of scan
                   'end'  ==> all but end of scan.
           quackincrement -- Quack incrementally in time?
                default: False
                    False  ==> the quack interval is counted from the
                               beginning of the scan
                    True   ==> the quack interval is counted from the
                               first unflagged data in the scan
           unflag -- Unflag the data
                default => False (quack as indicated)
                           True (unquack)
           autocorr -- Flag autocorrelations (independent option)
                default => False

        shadow: option to flag data of shadowed antennas
           diameter -- effective diameter to use when determining if an antenna
                    is shadowed at a given time stamp. The given value is used
                    for all antennas. If this is set to a negative number
                    (default), the actual antenna diameters are used.

        summary: lists number of rows and data points flagged
           No subparameters

        autoflag: experimental automatic flagging of outliers.
           It is still under development
           algorithm -- autoflag algorithm name
                default: 'timemed'
                options: 'timemed','freqmed'
           column -- the column on which to operate (DATA, CORRECTED, MODEL)
           expr -- expression to use for flagging option
                default: 'ABS RR'; example: expr='RE XX'
                Options: 'ABS','ARG','RE','IM','NORM' + ' ' +
                     'I','XX','YY','RR','LL'
           thr -- flagging threshold as a multiple of standard-deviation ( n sigma )
           window -- half width for sliding window median filters.  The size should be
                  about the number of integration in a scan, or the number of
                  spectral channels.

        rfi: RFI automatic flagging of outliers.
           For more information, see ?

           clipcolumn -- the column on which to operate (DATA, CORRECTED, MODEL)
           clipexpr -- expression to use for flagging option
                default: 'ABS RR'; example: expr='RE XX'
                Options: 'ABS','ARG','RE','IM','NORM' + ' ' +
                     'I','XX','YY','RR','LL'

        selectdata -- Other data selection parameters
                default: True
        antenna -- Select data based on baseline
                default: '' (all); example: antenna='5&6' baseline 5-6
                antenna='5&6;7&8' #baseline 5-6 and 7-8
                antenna='5' # all baselines with antenna 5
                antenna='5,6' # all baselines with antennas 5 and 6
        spw -- Select data based on spectral window and channels
                default: '' (all); example: spw='1'
                spw='<2' #spectral windows less than 2
                spw='>1' #spectral windows greater than 1
                spw='0:0~10' # first 10 channels from spw 0
                spw='0:0~5;56~60' # multiple separated channel chunks.
        correlation -- Correlation types
                default: '' (all);
                example: correlation='RR LL'
        field -- Select data based on field id(s) or name(s)
                default: '' (all); example: field='1'
                field='0~2' # field ids inclusive from 0 to 2
                field='3C*' # all field names starting with 3C
        uvrange -- Select data within uvrange (default units meters)
                default: '' (all); example:
                uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lamgda
                uvrange='>4klamda';uvranges greater than 4 kilo-lambda
                uvrange='0~1000km'; uvrange in kilometers
        timerange  -- Select data based on time range:
                default = '' (all); example,
                timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
                Note: YYYY/MM/DD can be dropped as needed:
                timerange='09:14:0~09:54:0' # this time range
                timerange='09:44:00' # data within one integration of time
                timerange='>10:24:00' # data after this time
                timerange='09:44:00+00:13:00' #data 13 minutes after time
        scan -- Select data based on scan number
                default: '' (all); example: scan='>3'
        feed -- Selection based on the feed - NOT IMPLEMENTED YET
        array -- Selection based on the antenna array

        -- Vector mode --

        For reasons of performance (to reduce the number loops through the MS),
        several flagdata task invocations can be combined into a single
        flagdata() run by giving vectors of parameters. 

        This is possible for the modes 'manualflag' and 'quack', only.

        For example, the following three flagdata runs:

            vis = 'my.ms'
            mode = 'manualflag'
            selectdata = True
            flagdata(vis='my.ms', mode='manualflag', field='3', autocorr=True)
            flagdata(vis='my.ms', mode='manualflag', field='3', timerange = '6:0:0~6:23:00')
            flagdata(vis='my.ms', mode='manualflag', field='3', scan='0', spw='0:60;62;64')

        can be combined into a single run by:

            vis = 'my.ms'
            mode = 'manualflag'

        -- Vector mode --

        For reasons of performance (to reduce the number loops through the MS),
        several flagdata task invocations can be combined into a single
        flagdata() run by giving vectors of parameters. 

        This is possible for the modes 'manualflag' and 'quack', only.

        For example, the following three flagdata runs:

            vis = 'my.ms'
            mode = 'manualflag'
            selectdata = True
            flagdata(vis='my.ms', mode='manualflag', field='3', autocorr=True)
            flagdata(vis='my.ms', mode='manualflag', field='3', timerange = '6:0:0~6:23:00')
            flagdata(vis='my.ms', mode='manualflag', field='3', scan='0', spw='0:60;62;64')

        can be combined into a single run by:

            vis = 'my.ms'
            mode = 'manualflag'
            selectdata = True

            field     = '3'
            spw       = [ ''   , ''            , '0:60;62:64' ]
            autocorr  = [ True , False         , False        ]
            timerange = [ ''   , '6:0:0~6:23:0', ''           ]
            scan      = [ ''   , ''            , '0'          ]

            flagdata()

        Note that field='3' is equivalent to field=['3','3','3']