Masks

Many tasks (fitting, baseline subtraction, statistics etc) should only be run on range of channels. Depending on the current ``unit'' setting this range is set directly as channels, velocity or frequency ranges. Internally these are converted into a simple boolean mask for each channel of the abscissa. This means that if the unit setting is later changed, previously created mask are still valid. (This is not true for functions which change the shape or shift the frequency axis). You create masks with the function create_mask and this specified the channels to be included in the selection. When setting the mask in velocity, the conversion from velocity to channels is based on the current selection, specified row and selected frequency reference frame.

Note that for multi IF data with different number of channels per IF a single mask cannot be applied to different IFs. To use a mask on such data the selector should be applied to select all IFs with the same number of channels.

Example :

  # Select channel range for baselining
  ASAP>scans.set_unit('channel')
  ASAP>msk = scans.create_mask([100,400],[600,800])

  # Select velocity range for fitting
  ASAP>scans.set_unit('km/s')
  ASAP>msk = scans.create_mask([-30,-10])

Sometimes it is more convenient to specify the channels to be excluded, rather included. You can do this with the ``invert'' argument.

Example :

  ASAP>scans.set_unit('channel')
  ASAP>msk = scans.create_mask([0,100],[900-1023], invert=True)

By default create_mask uses the frequency setup of the first row to convert velocities into a channel mask. If the rows in the data cover different velocity ranges, the scantable row to use should be specified:

  ASAP>scans.set_unit('km/s')
  ASAP>msk = q.create_mask([-30,-10], row=5)

Because the mask is stored in a simple python variable, the users is able to combine masks using simple arithmetic. To create a mask excluding the edge channels, a strong maser feature and a birdie in the middle of the band:

  ASAP>scans.set_unit('channel')
  ASAP>msk1 = q.create_mask([0,100],[511,511],[900,1023],invert=True)
  ASAP>scans.set_unit('km/s')
  ASAP>msk2 = q.create_mask([-20,-10],invert=True)

  ASAP>mask = msk1 and msk2

Malte Marquarding 2007-08-16