High-Level Access to MIRIAD Data: miriad

On the commandline, you refer to datasets by their filenames. The miriad module provides two fundamental classes, VisData and ImData, which analogously let you refer to datasets in a Python program. Instances of these class are lightweight and provide features to make it easy to perform common operations on your data.

To instantiate one of these classes, just call the constructor with a filename as an argument:

from miriad import VisData, ImData
vis = VisData ('./fx64c-3c147-1400')
im = ImData ('./residual.rm')

It’s important to understand that these objects are references to datasets, and as such the underlying file doesn’t have to exist when you create the object. Also, creating one of these objects is a very cheap operation.

Both miriad.VisData and miriad.ImData are subclasses of a more generic class, miriad.Data. Instances of this class have methods and properties that provide common functionality regarding MIRIAD datasets. One set of functionality is checking basic properties of the dataset on disk:

  • Data.exists to see if it exists on disk.
  • Data.mtime to check when it was last modified. This requires that the dataset exists; the variant attribute umtime returns unconditionally. (Hence the “u” prefix to its name.)
  • Data.realPath() to get its canonical filename.

You can also perform some basic operations. (From here on out, we will drop the ‘’Data’’ prefix in the names we show. Also, note that you can click on the link associated with all of these function or property names to access the more detailed reference documentation for that item.)

  • moveTo() renames a dataset.
  • copyTo() copies it.
  • delete() deletes it.
  • apply() configures a MIRIAD task object (mirexec.TaskBase) to run on this dataset via the mirexec subsystem. See Executing MIRIAD Tasks: mirexec for more information. See also the verbose variant xapply().

You can create more Data instances with filenames similar to existing ones:

  • vvis() creates a new VisData instance referencing a similar filename.
  • vim() creates a new ImData instance referencing a similar filename.

And you can open the dataset with open() to get access to its contents. See Low-Level Access to MIRIAD Data for more information.

You may also wish to enable tracing of MIRIAD task execution in miriad-python by calling basicTrace(). There are a few more rarely-used members of Data not mentioned here that are documented in the API reference below.

Visibility Datasets

The VisData subclass of Data has additional routines specifically useful for UV data:

  • catTo() runs uvcat on a dataset to produce a copy of it.
  • averTo() runs uvaver on a dataset to produce an averaged copy of it.
  • lwcpTo() creates a “lightweight copy” of a dataset, duplicating its metadata but not the visibilities, which makes certain common operations much faster.
  • readLowlevel() opens the dataset directly for lowlevel access to the visibility data.

Besides these routines, the VisData subclass implements several generic methods specified in Data, so you should always create a VisData instance when you know that you’re referring to a visibility dataset.

Image Datasets

The ImData subclass of Data is used for referencing image data. It currently does not have any routines specifically applicable to image data, but it implements several of the Data methods correctly, so you should always create a ImData instance when you know that you’re referring to an image dataset.

miriad API Reference

This section presents a detailed API reference for the miriad module.

Dataset Classes

Tracing Task Execution

The miriad module also provides infrastructure for tracing task execution and operations on datasets.

miriad.launchTrace

Traces the execution of commands.

Should be a callable or None. Will be called by trace(), which is invoked every time a MIRIAD task is executed via mirexec or a dataset is renamed, copied, or deleted. launchTrace should take one argument, which will be a list of strings representing the commandline that is being invoked. If none, trace() has no effect.

The function basicTrace() sets launchTrace to a simple default.