### In practice

Polarimetry data can be handled in three different ways.

1. In the first mode, a single visibility can have only one polarization state, but different visibilities may have different states. The polarization state for each visibility is defined by h%gil%column_pointer(code_uvt_stok). Possible values are given by the code_stokes_... parameters specified in the previous section, while antenna polarizations are specified by the code_polar_... parameters. This mode is indicated by h%gil%nstokes = 1 and h%gil%order = 0. It will also have h%gil%nfreq = 0 (see below). Note that there is no provision for mixed (circular / linear) polarization states.
2. In the second mode, a single visibility can handle several stokes parameters, but Stokes and Channels are regularly ordered. In this mode, channels are regularly spaced in Frequency, like in single Stokes mode, so no h%gil%freqs array is specified. Stokes parameters are also ordered. For every channel, the ordering of Stokes parameters must be the same. Stokes parameters may vary first, and Frequencies next (the so-called h%gil%order = code_stok_chan ordering) or Frequencies may vary first, and Stokes next (the so-called h%gil%order = code_chan_stok ordering). Ordering is stored in variable h%gil%order. Arrays h%gil%stokes(h%gil%nstokes) indicate the Stokes parameter for each frequency “channel”. This mode is indicated by h%gil%nstokes 1 and h%gil%order 0, but still has h%gil%nfreq = 0.
3. In the third, most complex mode, the Stokes parameter can vary arbitrarily within one visibility. Then each complex visibility element must have a Stokes parameter and a frequency indication, which are given in the arrays h%gil%stokes and h%gil%freqs respectively, of size h%gil%nfreq = h%gil%nchan * h%gil%nstokes. As each complex visibility element is given a specific frequency, this mode can also allow to store irregularly spaced frequency channels. Such a mode can be convenient for continuum bandwidth synthesis, for example. Proper weighting is ensured even though the channel width is not specified, as the weights are carried along with the Real and Imaginary parts. This mode is indicated by h%gil%nfreq 0. h%gil%order is irrelevant in this mode, but should be set to 0.