casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
Functions
recipes.make_labelled_ms Namespace Reference

Functions

def make_labelled_ms
def label_itered_ms
def make_writable_recursively

Function Documentation

def recipes.make_labelled_ms.label_itered_ms (   msname,
  labelbases,
  debug = False,
  datacol = 'DATA',
  incremental = False 
)
Set datacol according to labelbases.  Like make_labelled_ms() except it
modifies in place using ms iteration to handle MSes that are large and/or
have multiple data shapes.

Arguments:

msname:   The MS to be modified.

labelbases: A dictionary of quant: number or quant: func pairs, where quant
is an index to label, and number is how quickly the label changes with the
index.  func should be a function that takes a data chunk as a dictionary
(as returned by ms.getdata), and returns either a scalar or a numpy array
with the same shape as the chunk's datacol.  quant should be one of
'SCAN_NUMBER', 'DATA_DESC_ID', 'ANTENNA1', 'ANTENNA2', 'ARRAY_ID', 'FEED1',
'FEED2', 'FIELD_ID', 'OBSERVATION_ID', 'PROCESSOR_ID', 'STATE_ID', 'time',
'time_centroid', 'chan(nel)', or 'pol(whatever)' (case insensitive), but
you will be let off with a warning if it isn't.  TIME and TIME_CENTROID
tend to hover around 4.7e9, so they are offset and scaled by subtracting
the first value and dividing by the first integration interval.  Example
labelbases: labelbases = {'channel': 1.0, 'antenna1': complex(0, 1)} The
data column in the output will be complex(channel index, antenna1).

    labelbases = {'SCAN_NUMBER': 1.0,
                  'FIELD_ID':    0.1,
                  'DATA_DESC_ID': complex(0, 1)}
    The data column in the output will go like complex(scan.field, spw) as
    long as field < 10.

debug: If True and it hits an error, it will try to return what it has so
       far instead of raising an exception.

datacol: Which of DATA, MODEL_DATA, or CORRECTED_DATA to modify in the output.
         Case insensitive.

incremental: If True, the visibilities of the MS are added to.
             Otherwise (default), they are replaced.

Returns True or False as a success guess.

Definition at line 181 of file make_labelled_ms.py.

References recipes.taskutil.get_global_namespace(), and recipes.make_labelled_ms.make_writable_recursively().

Referenced by recipes.make_labelled_ms.make_labelled_ms().

def recipes.make_labelled_ms.make_labelled_ms (   srcms,
  outputms,
  labelbases,
  ow = False,
  debug = False,
  whichdatacol = 'DATA' 
)
Note: This has been more or less obsoleted by label_itered_ms and could
probably be replaced by it after a little testing.

Transform one measurement set into another with the same (ideally small but
nontrivial) shape and reference frames, but data set to a sequence
according to labelbases.  The output MS is useful for testing tasks or
tools that read and write MSes, since it is more obvious where each bit of
data came from, and what has been done to it.  Think of it as an
alternative to making certain bits of data fluoresce under UV light.

Arguments:

srcms:    The template MS.

outputms: The output MS.

labelbases: A dictionary of quant: number pairs, where quant is an index to
label, and number is how quickly the label changes with the index.  quant
should be one of 'SCAN_NUMBER', 'DATA_DESC_ID', 'ANTENNA1', 'ANTENNA2',
'ARRAY_ID', 'FEED1', 'FEED2', 'FIELD_ID', 'OBSERVATION_ID', 'PROCESSOR_ID',
'STATE_ID', 'time', 'time_centroid', 'chan(nel)', or 'pol(whatever)' (case
insensitive), but you will be let off with a warning if it isn't.
TIME and TIME_CENTROID tend to hover around 4.7e9, so they are offset and
scaled by subtracting the first value and dividing by the first integration
interval.  Example labelbases: labelbases = {'channel': 1.0, 'antenna1':
complex(0, 1)} The data column in the output will be complex(channel index,
antenna1).

    labelbases = {'SCAN_NUMBER': 1.0,
                  'FIELD_ID':    0.1,
                  'DATA_DESC_ID': complex(0, 1)}
    The data column in the output will go like complex(scan.field, spw) as
    long as field < 10.

ow: Whether or not outputms can be overwritten if it exists.

debug: If True and it hits an error, it will try to return what it has so
       far instead of raising an exception.

whichdatacol: Which of DATA, MODEL_DATA, or CORRECTED_DATA to modify in
              the output.  Case insensitive.

Returns True or False as a success guess.

Definition at line 8 of file make_labelled_ms.py.

References recipes.taskutil.get_global_namespace(), recipes.make_labelled_ms.label_itered_ms(), and recipes.make_labelled_ms.make_writable_recursively().

Unfortunately neither os nor shutil make operating on permissions as easy
as it should be.

Definition at line 363 of file make_labelled_ms.py.

Referenced by recipes.make_labelled_ms.label_itered_ms(), and recipes.make_labelled_ms.make_labelled_ms().