***************************************************************************

* Each scan is divided in a set of subscans. Each subscans in made of a set
  of dumped spectra, abbreviated into dumps.

* The observing mode switches between different observing conditions that
  enable us to extract the signal from the contribution of the atmosphere
  in the total power measurements. The switched property can be the
  position (WSW, PSW) or the frequency (FSW). The switched property
  regularly cycle between its different possible states, called phases.

* There are three main cases of phase cycles:
    1. The property is switched quickly. Basically, each continguous
       dump represents a different phase. We will call this kind a dump
       cycle. There are two sub-cases:
          A. The FSW mode, where there are two phases where the tuning
             frequency is slightly shifted by plus or minus half the
             frequency throw.
          B. The WSW mode, where one of the phase is the ON position and
             the other phase is the OFF (reference) position separated from
             the ON position by half the wobbler throw in azimuthal
             coordinates (i.e., at constant elevation).  The additional
             subtlety here is that in the case of symmetric WSW, the
             reference position changes of side from one scan to the other.
    2. The property is switched slowly. Basically, each subscan represents
       a different phase. we will call this kind a subscan cycle. This is
       typically the case for pointed PSW observations. The simplest cycle
       contains two phases: Reference and ON, e.g., RO. More evolved cycle
       contains an even sequence of phases: e.g., for in the case of ROOR,
       or eight in the case ROORORRO.
    3. OTF PSW is an hybrid case between pointed PSW that only deals with
       subscan cycles and (WSW and FSW) that only deal with dump cycles. In
       this case, the ON is delivered as a dump, but the OFF is typically
       interpolated between two OFF subscans.

* The IMBFITS format uses the term of phase only in the case of the dump
  cycle and it does not have any name for the pointed PSW mode.  We here
  use the generic term "phase cycle" for any kind of switching cycle. In
  all generality, a phase cycle is divided into a subscan cycle, itself
  divided into a dump cycle:
     - In FSW, the subscan cycle contains only one kind of subscan while the
       dump cycle contains two phases.
     - In pointed PSW, the subscan cycle contains an even number of subscan
       while the dump cycle contains only one phase.
     - In pointed WSW, the subscan cycle contains two kind of subscans
       (switching from one or ther other side of the ON position) and the
       dump cycle two phases (ON and OFF).       
     - In OTF PSW, the subscan cycle contains a complex sequence of subscan
       (ON and OFF) depending on the way the sky is covered during the
       scan. Inside the ON and OFF subscans, the dump cycle contains only
       one phase. The difference comes from the way the dumps are
       processed. They are averaged in an OFF subscans and considered
       individually in the ON subscans.

* In practice:
     - MRTCAL just needs one cycle kind structure that contains the data of
       the different phases with the associated description of each
       phase. The procedures that will fill the data into this structure
       will either work at the dump cycle or subscan cycle levels with
       subroutine names prefixed with dumpcycle or subscancycle,
       respectively.
     - More precisely, each phase is described into a cycle%desc(nphase)
       structure that is (re)filled at start of each subscan (this is an
       overkill in pointed PSW mode). And the data is gathered into a
       cycle%data(nphase) chunkset. Depending on the observing mode the
       data is filled when reading the next dump cycle or after averaging
       the different dumps of a given subscan, or a combination of both
       cases.
     - For efficiency reasons, the on_minus_off subroutine is only able to
       work on two phases that are stored into the on%curr and off%curr
       chunkset. To avoid duplication of the data, these are pointers that
       will point on the corresponding cycle%data(ipha) chunkset. Note that
       this means that for pointed PSW, the data of a complex sequence as
       ROOR, all ON subscans and all OFF subscans are averaged before
       filling the cycle%data(1) and cycle%data(2) chunksets.

***************************************************************************
