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

Functions

def sdcal

Function Documentation

def sdcal.sdcal (   infile = '',
  antenna = 0,
  fluxunit = '',
  telescopeparm = '',
  specunit = '',
  frame = '',
  doppler = '',
  calmode = 'none',
  fraction = '10%',
  noff = -1,
  width = 0.5,
  elongated = False,
  markonly = False,
  plotpointings = False,
  scanlist = [],
  field = '',
  iflist = [],
  pollist = [],
  channelrange = [],
  scanaverage = False,
  timeaverage = False,
  tweight = 'none',
  averageall = False,
  polaverage = False,
  pweight = 'none',
  tau = 0.0,
  verify = False,
  outfile = '',
  outform = 'ASAP',
  overwrite = False,
  plotlevel = 0 
)
ASAP SD task: do data selection, calibration, and averaging
  Keyword arguments:
infile -- name of input SD dataset
antenna -- antenna name or id (only effective for MS input). 
fluxunit -- units for line flux
        options: 'K','Jy',''
        default: '' (keep current fluxunit)
        WARNING: For GBT data, see description below.

    >>> fluxunit expandable parameter
         telescopeparm -- the telescope characteristics
                 options: (str) name or (list) list of gain info
                 default: '' (none set)
                 example: if telescopeparm='', it tries to get the telescope
                          name from the data.
                          Full antenna parameters (diameter,ap.eff.) known
                          to ASAP are
                          'ATPKSMB', 'ATPKSHOH', 'ATMOPRA', 'DSS-43',
                          'CEDUNA','HOBART'. For GBT, it fixes default fluxunit
                          to 'K' first then convert to a new fluxunit.
                          telescopeparm=[104.9,0.43] diameter(m), ap.eff.
                          telescopeparm=[0.743] gain in Jy/K
                          telescopeparm='FIX' to change default fluxunit
                          see description below

specunit -- units for spectral axis
        options: (str) 'channel','km/s','GHz','MHz','kHz','Hz'
        default: '' (=current)
        example: this will be the units for masklist
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
calmode -- calibration mode
        options: 'ps','nod','otf','otfraster',
                 'fs','fsotf','quotient','none'
        default: 'none'
        example: choose mode 'none' if you have
                 already calibrated and want to
                 try averaging
        WARNING: 'fsotf' is not implemented yet
    >>> calmode expandable parameter
         fraction -- Edge marking parameter for 'otf' and 'otfraster'.
                     specify a number of OFF scans as a fraction of 
                     total number of data points. 
                 default: '10%'
                 options: '20%' in string style or float value less 
                          than 1.0 (e.g. 0.15).
                          'auto' is available only for 'otfraster'. 
         noff -- Edge marking parameter for 'otfraster'.
                 It is used to specify a number of OFF scans near 
                 edge directly. Value of noff comes before setting 
                 by fraction.
                 default: -1 (use fraction)
                 options: any positive integer
         width -- Edge marking parameter for 'otf'.
                  Pixel width with respect to a median spatial 
                  separation between neighboring two data in time.
                  Default will be fine in most cases.
                 default: 0.5
                 options: float value
         elongated -- Edge marking parameter for 'otf'.
                      Set True only if observed area is elongeted 
                      in one direction.
                 default: False
         markonly -- Set True if you want to save data just after 
                     edge marking (i.e. uncalibrated data) to see 
                     how OFF scans are defined.
                 default: False
scanlist -- list of scan numbers to process
        default: [] (use all scans)
        example: [21,22,23,24]
        this selection is in addition to field, iflist, and pollist
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
channelrange -- channel range selection
        default: [] (use all channel)
        example: [0,5000]
        Note that specified values are recognized as 'channel'
        regardless of the value of specunit 
scanaverage -- average integrations within scans
        options: (bool) True,False
        default: False
timeaverage -- average times for multiple scan cycles
        options: (bool) True,False
        default: False
        example: if True, this happens after calibration

    >>>timeaverage expandable parameter
         tweight -- weighting for time average
                 options: 'none' 
                          'var'   (1/var(spec) weighted)
                          'tsys'  (1/Tsys**2 weighted)
                          'tint'  (integration time weighted)
                          'tintsys'  (Tint/Tsys**2)
                          'median'  ( median averaging)
                 default: 'none'

         averageall -- average multi-resolution spectra
                       spectra are averaged by referring 
                       their frequency coverage
                 default: False

polaverage -- average polarizations
        options: (bool) True,False
        default: False

    >>>polaverage expandable parameter
         pweight -- weighting for polarization average
                 options: 'none'
                          'var'  (1/var(spec) weighted)
                          'tsys' (1/Tsys**2 weighted)
                 default: 'none'

tau -- atmospheric optical depth
        default: 0.0 (no correction)
verify -- verify the results of calibration. Only effective if 
          calmode is not 'none'.
        options: (bool) True,False
        default: False
        WARNING: Currently this just asks whether you accept
                 the displayed calibration and if not, continues
                 without doing any calibration. 
outfile -- Name of output file
        default: '' (<infile>_cal)
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.
                 If ASCII, then will append some stuff to
                 the outfile name
overwrite -- overwrite the output file if already exists
        options: (bool) True,False
        default: False
        WARNING: if outform='ASCII', this parameter is ignored
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>_calspec.eps)
        WARNING: be careful plotting in fsotf mode!


DESCRIPTION:

Task sdcal performs data selection, calibration for single-dish
spectra.  By setting calmode='none', one can run sdcal on already 
calibrated data, for further selection , averaging and atmospheric 
optical depth correction. To save the output spectra in a certain
range of channels, you set the range in channelrange.

If you give multiple IFs in iflist, then your scantable will have
multiple IFs by default. Averaging of multi-resolution (multi-IFs)
spectra can be achieved by setting a sub-parameter in timeaverage, 
averageall, to True. It handles multi-IFs by selecting overlaps in 
frequency coverages and assigning new IFs in the output spectra.

ASAP recognizes the data of the "AT" telescopes, but currently
does not know about the GBT or any other telescope. This task
does know about GBT. Telescope name is obtained from the data.
If you wish to change the fluxunit (see below), by leaving
the sub-parameter telescopeparm unset (telescopeparm=''),
it will use internal telescope parameters for
flux conversion for the data from AT telescopes and it will use an
approximate aperture efficiency conversion for the GBT data.
If you give telescopeparm a list, then if the list has a single 
float it is assumed to be the gain in Jy/K, if two or more elements 
they are assumed to be telescope diameter (m) and aperture efficiency
respectively.

Note that sdcal assumes that the fluxunit is set correctly in
the data already.  If not, then set telescopeparm='FIX' and it
will set the default units to fluxunit without conversion.
NOTE: If the data in infile is an ms from GBT and the default flux
unit is missing, this task automatically fixes the default fluxunit
to 'K' before the conversion.

Two new calmode, 'otf' and 'otfraster', are available. If you 
specify those modes, the task first try to define several scans 
near edge as OFF scans, then the data are calibrated using those 
OFF scans. Those modes are designed for OTF observations without 
explicit OFF scans. If the observing pattern is 'raster', you 
should use the 'otfraster' mode to calibrate data. Otherwise, the 
'otf' mode should be used. For detail about edge marking, see 
online help of sd.edgemarker module.

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 sdcal.py.

References task_sdcal.sdcal(), and vla_uvfits_line_sf.verify.