next up previous contents
Next: Aligned spectra Up: Algorithm Previous: Setting the weights   Contents


Definition of the output spectrum

Let's denote $R$ and $T$ two spectra that one wants to add, and $S$ the output sum. With the ACCUMULATE command, $R$ and $T$ are precisely the corresponding buffers exposed to the user in CLASS. With the AVERAGE command, $R$ is the average spectrum returned by the $(N-1)^{th}$ loop, and $T$ the $N^{th}$ spectrum in index, with its weight array correctly set. We also call $r_R$ (resp. $r_T$) the resolution of $R$ (resp. $T$). This resolution is either in ``number of channels''3, frequency, or velocity per channel depending on the alignment mode (SET ALIGN CHANNEL|FREQUENCY|VELOCITY resp.).

From these, the output resolution is taken as the highest of the two (absolute) resolutions in input:

\begin{displaymath}
r_S = \ensuremath{\mathrm{max}}(\vert r_R\vert,\vert r_T\vert)
\end{displaymath} (1)

This ensures that we never oversample a spectrum which has a low resolution.

The range of abscissa in output spectrum depends on the combination mode:

Given the output resolution and range, the number of channels $N$ can be deduced:

\begin{displaymath}
N_S = \ensuremath{\mathrm{int}}( \frac{x_{\ensuremath{\mathrm{max}},S}-x_{\ensuremath{\mathrm{min}},S}}{r_S} + 1.5),
\end{displaymath} (6)

where the 1.5 value adds 1 or 2 extra-channels to avoid the erosion of the spectra at the boundaries.

For the oncoming call of the addition routine, we also define the abscissa at the channel $0$ used as reference:

\begin{displaymath}
x_{\ensuremath{\mathrm{val}},S} = x_{\ensuremath{\mathrm{min}},S} - 1. \times r_S,
\end{displaymath} (7)

$x_{\ensuremath{\mathrm{min}},S}$ being the abscissa value of the first channel of the output spectrum. Again, $x$ unit is either in ``channels'', velocity or frequency depending on the SET ALIGN mode.

This definition of the output spectrum is done only once with the ACCUMULATE command. On the other hand with the AVERAGE command, the above parameters are revised (if required) each time a new spectrum of the index is added. For example, the output range $[x_{\ensuremath{\mathrm{min}},S},x_{\ensuremath{\mathrm{max}},S}]$ and number of channels $N_S$ may enlarge (SET ALIGN * COMPOSITE) or reduce (SET ALIGN * INTERSECT). Also, the resolution is progressively reduced to the coarsest of all the resolutions in the index (eq. [*]).


next up previous contents
Next: Aligned spectra Up: Algorithm Previous: Setting the weights   Contents
Gildas manager 2014-07-01