casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
Functions
sdflag Namespace Reference

Functions

def sdflag

Function Documentation

def sdflag.sdflag (   infile = '',
  antenna = 0,
  specunit = '',
  restfreq = '',
  frame = '',
  doppler = '',
  scanlist = [],
  field = '',
  iflist = [],
  pollist = [],
  maskflag = [],
  flagrow = [],
  clip = False,
  clipminmax = [],
  clipoutside = True,
  flagmode = 'flag',
  interactive = False,
  showflagged = False,
  outfile = '',
  outform = 'ASAP',
  overwrite = True,
  plotlevel = 0 
)
ASAP SD spectral flagging task 
Keyword arguments:
infile -- name of input SD dataset
antenna -- antenna name or id (only effective for MS input). 
specunit -- units for spectral axis
        options: (str) 'channel','km/s','GHz','MHz','kHz','Hz',''
        default: '' (=current)
        example: this will be the units for maskflag
    >>> specunit expandable parameters
         restfreq -- rest frequency
                 available type includes float, int, string, list of float, 
                 list of int, list of string, and list of dictionary. the 
                 default unit of restfreq in case of float, int, or string 
                 without unit is Hz. string input can be a value only 
                 (treated as Hz) or a value followed by unit for which 'GHz',
                 'MHz','kHz',and 'Hz' are available. 
                 a list can be used to set different rest frequencies for 
                 each IF. the length of list input must be nIF. dictionary 
                 input should be a pair of molecule name and frequency with 
                 keys of 'name' and 'value', respectively. values in the 
                 dictionary input follows the same manner as for single 
                 float or string input. 
                 example: 345.796
                          '1420MHz'
                          [345.8, 347.0, 356.7]
                          ['345.8MHz', '347.0MHz', '356.7MHz']
                          [{'name':'CO','value':345}]
frame -- frequency frame for spectral axis
        options: (str) 'LSRK','REST','TOPO','LSRD','BARY',
                 'GEO','GALACTO','LGROUP','CMB'
        default: currently set frame in scantable
        WARNING: frame='REST' not yet implemented
doppler -- doppler mode
        options: (str) 'RADIO','OPTICAL','Z','BETA','GAMMA'
        default: currently set doppler in scantable
scanlist -- list of scan numbers to process
        default: [] (use all scans)
        example: [21,22,23,24]
        this selection is in addition to field and iflist
field -- selection string for selecting scans by name
        default: '' (no name selection)
        example: 'FLS3a*'
        this selection is in addition to scanlist, iflist, and pollist
iflist -- list of IF id numbers to select
        default: [] (use all IFs)
        example: [15]
        this selection is in addition to scanlist, field, and pollist
pollist -- list of polarization id numbers to select
        default: [] (use all polarizations)
        example: [1]
        this selection is in addition to scanlist, field, and iflist
maskflag -- list of mask regions to apply flag/unflag 
            Note, this parameter is ignored if one or more rows are 
            given in flagrow, or clip=True.
        default: [] (entire spectrum)
        example: [[1000,3000],[5000,7000]]
flagrow -- list of row numbers to apply flag/unflag
           Note, this parameter is effective only when one or more row 
           numbers are given explicitly and also clip=False
        default: [] (no row selection)
        example: [0, 2, 3]
clip -- flag data that are outside a specified range
        options: (bool)True,False
        default: False
     >>> clip expandable parameters
        clipminmax -- range of data that will NOT be flagged
                default: [] means do not use clip option
                example: [0.0,1.5]
        clipoutside -- clip OUTSIDE the range ?
                options: (bool)True,False
                default: True
                example: clipoutside=False means flag data WITHIN the range.
flagmode -- flag mode
        default: 'flag'
        options: 'flag','unflag'
interactive -- determines interactive flagging
        options: (bool) True,False
        default: False
     >>> interactive expandable parameters
        showflagged -- show flagged data on plots
                default: False
outfile -- Name of output file
        default: ''
        Note: by default (outfile=''), actual output file name is set as follows: 
              (1) if overwrite=True (default), infile (input) will be overwritten.
              WARNING: If the formats of input and ouput files are different, 
                       this causes complete loss of input file.
              (2) if overwrite=False, outfile will be <infile>_f. 
outform -- format of output file
        options: 'ASCII','SDFITS','MS','ASAP'
        default: 'ASAP'
        example: the ASAP format is easiest for further sd
                 processing; use MS for CASA imaging.
        WARNING: Be sure outform is same as the input file format when you 
                 overwrite the input file by overwrite=True and outfile='' (default).
overwrite -- overwrite the output file if already exists
        options: (bool) True,False
        default: True
        WARNING: input file is overwritten if overwrite=True and outfile='' (default). 
                 This causes the complete loss of input file if the formats of
                 input and ouput files are different.
plotlevel -- control for plotting of results
        options: (int) 0=none, 1=some, 2=more, <0=hardcopy
        default: 0 (no plotting)
        example: plotlevel<0 as abs(plotlevel), e.g.
                 -1 => hardcopy of final plot (will be named
                 <outfile>_flag.eps)
        WARNING: be careful plotting in fsotf mode!

-------------------------------------------------------------------

DESCRIPTION:

Task sdflag performs both interactive and non-interactive channel/row 
based flagging on spectra.
Currently, the available ways of non-interactive flagging include: 
(1) channel based flagging by specifying a range of spectral values 
with clip=True, (2) row based flagging by specifying a list of row 
numbers to the flagrow parameter, and (3) channel based flagging by 
specifying regions in channel to the maskflag parameter. 
These three ways of flagging can not be executed simultaneously. 
If more than one parameter above are specified, the task looks for 
them in the above order and operates the first specified way of 
flagging operation.

Interactive flagging is available when interactive=True. 
The available ways of interactive flagging include: 
(1) row based flagging by selecting 'panel' and (2) channel
based flagging by selecting 'region's of channels on Flag plotter. 
Note that the Flag plotter is loaded after carrying out the 
non-interactive flag operation if any specified. See the cookbook for
details of how to select channel regions and spectra on the plotter.

If plotlevel>=1, the task asks you if you really apply the 
flags before it is actually written to the data with a plot 
indicating flagged regions.
Please note that this task is still experimental.

WARNING for overwrite option:
Be sure 'outform' is the same as data format of input file when you
overwrite it. Since CASA 3.1, the default value of the option 'overwrite'
has been changed to True, thereby the current dataset (infile) is 
overwritten unless a different file name is set to outfile. 
There is a known issue in overwriting infile. If 'outform' differs to the
data format of infile, the data is overwritten with the new data format 
(specified by 'outform') and the data in the original format will be lost.

WARNING for the GBT raw SDFITS format data as input:
SDtasks are able to handle GBT raw SDFITS format data since the 
data filler is available. However, the functionality is not well 
tested yet, so that there may be unknown bugs.  

Definition at line 13 of file sdflag.py.

References task_sdflag.sdflag(), and vla_uvfits_line_sf.verify.