示例#1
0
def read (saveFlags=False, maxchan=default_maxchan):
    """Read in data via the UVDAT subsystem.

:arg saveFlags: whether to rewrite the flags of the dataset(s) as it/they are
                being read
:type saveFlags: :class:`bool`
:arg maxchan: the maximum number of spectral channels that can be read in at once
:type maxchan: :class:`int`
:rtype: generator of ``(handle, preamble, data, flags)``
:returns: generator yielding UV data records

Read in data with the UVDAT subsystem. The system must have previously
been initialized, typically in a call to
:meth:`mirtask.keys.KeySpec.process` after configuration with
:meth:`mirtask.keys.KeySpec.uvdat`.

The return value is a generator that yields tuples of ``(handle,
preamble, data, flags)``, where *handle* is a :class:`UVDatDataSet`
corresponding to the dataset being read, and *preamble*, *data*, and
*flags* are the usual UV data arrays. For speed, the identities of the
arrays do not change from iteration to iteration, but their contents do.
"""
    return _read_gen (saveFlags, UVDatDataSet, maxchan)
示例#2
0
def setupAndRead (toread, uvdOptions, saveFlags, nopass=False, nocal=False,
                  nopol=False, select=None, line=None, stokes=None, ref=None,
                  maxchan=default_maxchan):
    """Set up the UVDAT subsystem manually and read in the data.

:arg toread: the name(s) of the dataset or datasets to read
:type toread: stringable or iterable of stringable
:arg uvdOptions: extra options controlling the behavior of the UVDAT subsytem
:type uvdOptions: :class:`str`
:arg saveFlags: whether to rewrite the flags of the dataset(s) as it/they are
                being read
:type saveFlags: :class:`bool`
:arg nopass: whether to avoid applying bandpass calibration even if possible
:type nopass: :class:`bool`
:arg nocal: whether to avoid applying gain calibration even if possible
:type nocal: :class:`bool`
:arg nopol: whether to avoid applying polarization calibration even if possible
:type nopol: :class:`bool`
:arg select: standard UV data selection string
:type select: :class:`str` or :const:`None`
:arg line: standard channel processing string
:type line: :class:`str` or :const:`None`
:arg stokes: standard Stokes parameter processing string
:type stokes: :class:`str` or :const:`None`
:arg ref: standard reference line specification string
:type ref: :class:`str` or :const:`None`
:arg maxchan: the maximum number of spectral channels that can be read in at once
:type maxchan: :class:`int`
:rtype: generator of ``(handle, preamble, data, flags)``
:returns: generator yielding UV data records

Set up the UVDAT subsytem with explicitly-specified parameters and
read in the data.

The argument *toread* specifies which dataset or datasets to read. If
it is a non-string iterable, the stringification of each of its values
is treated as a dataset to read. Otherwise, its stringification is
treated as the dataset to read. Escaping is not supported by MIRIAD,
so if ``toread = 'a,b'``, MIRIAD will interpret this as a direction to
read two datasets named "a" and "b".

The return value is a generator that yields tuples of ``(handle,
preamble, data, flags)``, where *handle* is a :class:`UVDatDataSet`
corresponding to the dataset being read, and *preamble*, *data*, and
*flags* are the usual UV data arrays. For speed, the identities of the
arrays do not change from iteration to iteration, but their contents do.

Optional features of the UVDAT subsystem may be enabled by including
their control characters in the contents of *uvdOptions*:

==========      ==================
Character       Feature behavior
==========      ==================
*p*             Planet rotation and scaling corrections should be applied.
*w*             UVW coordinates should be returned in wavelength units, not
                nanoseconds. (Beware when writing these data to new UV
                datasets, as the output routines expect the values to
                be in nanoseconds.)
*1*             (The character is the number one.) Average the data
                down to one channel.
*x*             The input data must be cross-correlations.
*a*             The input data must be autocorrelations.
*b*             The input must be exactly one UV dataset (not multiple).
*3*             The "preamble" returned while reading data will always have 5
                elements and include the *w* coordinate.
==========      ==================
"""
    args = ['vis=' + commasplice (toread)]
    flags = uvdOptions + 'dslr'
    options = set ()

    if select is not None:
        args.append ('select=' + select)
    if line is not None:
        args.append ('line=' + line)
    if stokes is not None:
        args.append ('stokes=' + stokes)
    if ref is not None:
        args.append ('ref=' + ref)

    if nopass:
        options.add ('nopass')
    if nocal:
        options.add ('nocal')
    if nopol:
        options.add ('nopol')
    if len (options) > 0:
        args.append ('options=' + ','.join (options))

    from keys import KeySpec
    KeySpec ().uvdat (flags).process (args)
    return _read_gen (saveFlags, UVDatDataSet, maxchan)