# The data processing pipeline for the Herschel SPIRE Fourier Transform Spectrometer

T. Fulton, D. A. Naylor, E. T. Polehampton, I. Valtchanov, R. Hopwood, N.

Lu, J. -P. Baluteau, G. Mainetti, C. Pearson, A. Papageorgiou, et al.

► To cite this version:

T. Fulton, D. A. Naylor, E. T. Polehampton, I. Valtchanov, R. Hopwood, et al.. The data processing pipeline for the Herschel SPIRE Fourier Transform Spectrometer. Monthly Notices of the Royal Astronomical Society, 2016, 458 (2), pp.1977–1989. 10.1093/mnras/stw343. hal-01440726

HAL Id: hal-01440726

https://hal.science/hal-01440726

Submitted on 9 Sep 2021

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# The data processing pipeline for the Herschel SPIRE Fourier Transform Spectrometer*

T. Fulton,<fnref n="1" />,<fnref n="2" />† D. A. Naylor,<fnref n="1" /> E. T. Polehampton,<fnref n="1" />,<fnref n="3" /> I. Valtchanov,<fnref n="4" />† R. Hopwood,<fnref n="5" />† N. Lu,<fnref n="6" />,<fnref n="7" />,<fnref n="8" /> J.-P. Baluteau,<fnref n="9" /> G. Mainetti,<fnref n="10" /> C. Pearson,<fnref n="3" /> A. Papageorgiou,<fnref n="11" /> S. Guest,<fnref n="3" /> L. Zhang,<fnref n="8" /> P. Imhof,<fnref n="1" />,<fnref n="2" /> B. M. Swinyard,<fnref n="3" />,<fnref n="12" /> M. J. Griffin<fnref n="11" /> and T. L. Lim<fnref n="3" />

Accepted 2016 February 10. Received 2016 February 9; in original form 2015 September 30

## ABSTRACT

We present the data processing pipeline to generate calibrated data products from the Spectral and Photometric Imaging Receiver (SPIRE) imaging Fourier Transform Spectrometer on the Herschel Space Observatory. The pipeline processes telemetry from SPIRE observations and produces calibrated spectra for all resolution modes. The spectrometer pipeline shares some elements with the SPIRE photometer pipeline, including the conversion of telemetry packets into data timelines and calculation of bolometer voltages. We present the following fundamental processing steps unique to the spectrometer: temporal and spatial interpolation of the scan mechanism and detector data to create interferograms; Fourier transformation; apodization; and creation of a data cube. We also describe the corrections for various instrumental effects including first- and second-level glitch identification and removal, correction of the effects due to emission from the Herschel telescope and from within the spectrometer instrument, interferogram baseline correction, temporal and spatial phase correction, non-linear response of the bolometers, and variation of instrument performance across the focal plane arrays. Astronomical calibration is based on combinations of observations of standard astronomical sources and regions of space known to contain minimal emission.

**Key words:** methods: data analysis – space vehicles: instruments – techniques: spectroscopic.

## 1 INTRODUCTION

The Spectral and Photometric Imaging Receiver (SPIRE; Griffin et al. 2010) Fourier Transform Spectrometer (FTS) is a

sub-mm imaging spectrometer that operated on board the Herschel Space Observatory (Pilbratt et al. 2010) between 2009 May and 2013 April. In an FTS, the incident radiation is separated by a beam splitter into two beams that travel different optical paths before recombining. A moving mirror changes the optical path difference (OPD) between the recombining beams. The detector signal measured as a function of OPD is known as the interferogram, which is the inverse Fourier transform of the radiation incident on spectrometer and includes contributions from the telescope, the instrument, and the source spectrum. The spectrum is computed by Fourier transformation of the measured

<footnote n="1">¹Institute for Space Imaging Science, Department of Physics and Astronomy, University of Lethbridge, Lethbridge, Alberta T1K 3M4, Canada</footnote>

<footnote n="2">²Blue Sky Spectroscopy, 9, 740 4 Ave S, Lethbridge, Alberta T1J 0N9, Canada</footnote>

<footnote n="3">³RAL Space, Rutherford Appleton Laboratory, Didcot OX11 0QX, UK</footnote>

<footnote n="4">⁴European Space Astronomy Centre, Herschel Science Centre, ESA, E-28691 Villanueva de la Cañada, Spain</footnote>

<footnote n="5">⁵Physics Department, Imperial College London, South Kensington Campus, London SW7 2AZ, UK</footnote>

<footnote n="6">⁶National Astronomical Observatories of China, Chinese Academy of Sciences, Beijing 100012, China</footnote>

<footnote n="7">⁷China–Chile Joint Center for Astronomy, Chinese Academy of Sciences, Camino El Observatorio, 1515 Las Condes, Santiago, Chile</footnote>

<footnote n="8">⁸NASA Herschel Science Centre, IPAC, Pasadena, CA 91125, USA</footnote>

<footnote n="9">⁹Laboratoire d'Astrophysique de Marseille - LAM, Université d'Aix-Marseille and CNRS, UMR7326, 38 rue F. Jolit-Curie, F-13388 Marseille Cedex 13, France</footnote>

<footnote n="10">¹⁰Laboratoire AIM, CEA/DSM – CNRS – Irfu/Service d'Astrophysique, CEA Saclay, F-91191 Gif-sur-Yvette, France</footnote>

<footnote n="11">¹¹Cardiff University, The Parade, Cardiff CF24 3YB, UK</footnote>

<footnote n="12">¹²Department of Physics and Astronomy, University College London, London WC1E 6BT, UK</footnote>

<footnote>* Herschel is an ESA space observatory with science instruments provided by European-led Principal Investigator consortia and with important participation from NASA.</footnote>

<footnote>† E-mail: trevor.fulton@uleth.ca (TF); ivan.valtchanov@sciops.esa.int (IV); r.hopwood@imperial.ac.uk (RH)</footnote>
<figure><img src="image_2.png" /><figcaption>**Figure 1.** Astronomical footprint of the SPIRE detector arrays for the image sampling modes (SPIRE Handbook 2016). (a) sparse spatial sampling, (b) intermediate, and (c) full sampling (see Table 2). SSW detectors are represented by the small circles, SLW detectors are represented by the larger circles. The single large circle in each plot represents the 2 arcmin diameter field of view that is covered by the unvignetted detectors.</figcaption></figure>

interferogram. The design of the FTS is described in more detail in Ade, Hamilton & Naylor (1999), Dohlen et al. (2000), and Swinyard et al. (2010).

This paper describes the pipeline processing steps necessary to convert the measured interferogram signal into a calibrated astronomical spectrum. The operation and calibration of the instrument is described in the SPIRE Handbook (2016) and by Swinyard et al. (2014). This paper describes in detail the algorithms used for each pipeline step and provides a thorough description of the end-to-end processing of the FTS data. Section 2 briefly summarizes the observing modes of the instrument, as they are relevant to the pipeline. Section 3 introduces the pipeline in terms of three data domains: the time domain (processing timelines from the detectors), the interferogram domain (signal in terms of OPD position), and culminates in the spectral domain. Each step of the pipeline is then described in detail. Section 5 presents the conclusions and lessons learned. The pipeline described here has been implemented in *JAVA* as part of the *Herschel* Interactive Processing Environment (HIPE; Ott 2010).

## 2 OBSERVING MODES OF THE SPIRE FTS

The SPIRE FTS contains two bolometer detector arrays: the Short Wavelength array (SSW), nominally covering the spectral range between 958 and 1546 GHz (313–194 µm), and the Long Wavelength array (SLW) that covers the range from 447 to 990 GHz (671–303 µm). The two detector arrays overlap on the sky as shown in the FTS footprint in Fig. 1(a). The outer ring of detectors is partially vignetted by the instrument aperture and so the nominal ‘unvignetted’ field of view of the instrument has a diameter of 2 arcmin. The interferograms are produced by scanning the spectrometer mechanism (SMEC), the moving mirror that modulates the OPD. SPIRE also contains a Beam Steering Mirror (BSM) which is used to redirect the beam for mapping observations.

Observations with the SPIRE FTS were designed using astronomical observation templates (AOTs), which are described in detail in the SPIRE Handbook (2016). Each observation consists of a number of simple operations, such as configuring the instrument,

<table><caption>**Table 1.** SPIRE spectrometer spectral resolution options.</caption><thead><tr><th rowspan="2">Spectral resolution</th><th rowspan="2">Scan length (OPD) (cm)</th><th colspan="2">Spectral resolution</th></tr><tr><th>(GHz)</th><th>(cm<sup>-1</sup>)</th></tr></thead><tbody><tr><td>Low</td><td>0.60</td><td>24.98</td><td>0.83</td></tr><tr><td>High</td><td>12.56</td><td>1.198</td><td>0.0398</td></tr></tbody></table>

<table><caption>**Table 2.** SPIRE spectrometer spatial sampling options.</caption><thead><tr><th rowspan="2">Spatial sampling</th><th colspan="3">Number of positions</th><th colspan="2">Pixel size</th></tr><tr><th>Tel.</th><th>BSM</th><th>Total</th><th>SSW</th><th>SLW</th></tr><tr><td></td><td></td><td></td><td></td><td colspan="2">(arcsec)</td></tr></thead><tbody><tr><td>Single, sparse</td><td>1</td><td>1</td><td>1</td><td>N/A</td><td>N/A</td></tr><tr><td>Single, intermediate</td><td>1</td><td>4</td><td>4</td><td>19.0</td><td>35.0</td></tr><tr><td>Single, full</td><td>1</td><td>16</td><td>16</td><td>9.5</td><td>17.5</td></tr><tr><td>Raster, sparse</td><td>n</td><td>1</td><td>n</td><td>38.0</td><td>70.0</td></tr><tr><td>Raster, intermediate</td><td>n</td><td>4</td><td>4n</td><td>19.0</td><td>35.0</td></tr><tr><td>Raster, full</td><td>n</td><td>16</td><td>16n</td><td>9.5</td><td>17.5</td></tr></tbody></table>

initialization, and science data taking. These operations are referred to as ‘building blocks’. The science data building block is the one used by the FTS pipeline and is defined as a set of equal-length scans of the SMEC at a single pointing position of the *Herschel* telescope and BSM. The spectral resolution is determined by the maximum OPD, which is determined by the displacement of the SMEC. The spectral resolution options available to observers are shown in Table 1.

The spatial sampling of the observation depends on the number of FTS footprint positions, which are selected by moving the BSM in a predefined jiggle pattern. The simplest ‘sparse’ observation consists of a single BSM position, and leads to detectors separated by two beam widths on the sky (Fig. 1). A list of the spatial sampling options available is given in Table 2 and shown in Fig. 1. In addition to jiggl ing the BSM, the *Herschel* telescope could also be moved to cover a wider area with a raster pattern. The number of *Herschel* telescope pointing positions, *n*, depended on the observing area requested and was limited by the maximum observing time for an observation (18 h; see SPIRE Handbook 2016).

The sensitivity of an observation was governed by the number of scan repetitions requested by the observer. Each repetition is a pair of forward and reverse SMEC scans and all repetitions at a particular jiggle and telescope position make up one science building block.

## 3 SPIRE SPECTROMETER PIPELINE

The SPIRE spectrometer data processing pipeline consists of six major processing groups as shown in Fig. 2.

(i) *Common photometer/spectrometer processing modules.* These processing steps are common to both the SPIRE spectrometer and photometer pipelines (Dowell et al. 2010).

(ii) *Modify timelines.* These processing modules perform operations on detector signals that are time dependent. The descriptions of the modules in this category are presented in Section 3.1.

(iii) *Create interferograms.* This processing step merges the timelines of the spectrometer detectors and spectrometer mechanism to produce interferograms. This step produces a Level-1 Spectrometer Detector Interferogram (SDI) product and is described in Section 3.2.

(iv) *Modify interferograms.* The processing modules in this group perform operations on the SDI. These operations differ from those in the ‘Modify timelines’ group in that they are designed to act on
<figure><img src="image_3.png" /><figcaption>**Figure 2.** SPIRE FTS data processing block diagram.</figcaption></figure>

signals that are a function of OPD rather than signals that are a function of time. These processing modules are described in Section 3.3.

(v) *Transform interferograms*. This processing step transforms the interferograms into a set of spectra. This step is described in Section 3.4.

(vi) *Modify spectra*. The processing modules in this group perform operations on spectra. The steps in this category combine to produce a Level-2 Spectrometer Detector Spectrum (SDS) product and are described in Section 3.5.

## 3.1 Detector timeline modifications

After application of the processing steps common to both the photometer and spectrometer detectors (Dowell et al. 2010), the raw samples for each one of the 66 spectrometer detectors, denoted $i$, have been converted into rms voltage timelines, $V_{rms-i}(t)$. These quantities are contained in the Level 0.5 Spectrometer Detector Timeline (SDT) product.

The processing modules described in the following sections are applied to the timelines for each spectrometer detector. Each of the processing steps contained in this processing block (see Fig. 3) accepts a Level-0.5 SDT product as input and delivers an SDT product as output.

<figure><img src="image_4.png" /><figcaption>**Figure 3.** Timeline modification section of the SPIRE spectrometer building block pipeline.</figcaption></figure>

### 3.1.1 First level deglitching

The first level deglitching task is used to remove the effects of cosmic ray hits on the detectors (see Fig. 4). Strong glitches must be removed at the beginning of the pipeline as their effect can be spread into neighbouring data samples by some of the downstream pipeline tasks (in particular, the time-domain phase correction or the baseline correction). If a glitch remains untreated, its effect on the resulting spectrum depends on its location relative to zero optical path difference (ZPD). A glitch at a particular value of OPD, $x_{glitch}$, will lead to a sinusoidal artefact in the spectral domain with a period of $1/x_{glitch}$.

In order to identify glitches, the pipeline employs an algorithm which is based on a continuous wavelet transform with a Mexican hat wavelet and subsequent processing for a local regularity analysis (Ordénovic et al. 2008). The algorithm uses the Hölder exponent, which describes the local regularity of a function (Struzik 1999), and the analysis of the local maxima of the wavelet transform modulus (Mallat & Hwang 1992). The general assumption is that the effect of the glitch is similar to that of a Dirac delta function, although adjustments are made for the case of clipped glitches. Various parameters can be used to tune the algorithm, and these have been set conservatively for the standard pipeline to avoid any distortion of the ZPD region of the interferogram where the signal is naturally heavily modulated, or locations in the interferogram where channel fringes are present (Naylor, Schultz & Clark 1988). The conservative parameter settings adopted means that some glitches will be missed. However, second level deglitching (Section 3.3.2) identifies and removes glitches not identified in the timeline, ensuring that they do not affect the quality of the Level-2 spectra.

The task proceeds in two stages: the first step detects glitch signatures in the interferogram and the second step locally reconstructs the signal. Data samples that have been identified as glitches must be replaced so that the corrected interferograms contain values at equal increments of OPD.
<figure><img src="image_5.png" /><figcaption>Figure 4. Example of a glitch in a SDT. (a) Full scan, (b) glitch region.</figcaption></figure>

The detection algorithm parameters are as follows.

(i) The range and interval of wavelet scales used in fitting the wavelet transform modulus maxima lines. As the range in scales directly affects the execution time, it is set to keep the number of elements to a minimum. The pipeline uses a scale minimum of 1, maximum of 8, and interval of 5.

(ii) The range in Hölder exponent values, which sets the range of slopes that are interpreted as glitches and so affects the sensitivity of the detection algorithm. The pipeline uses a minimum of −1.4 and maximum of −0.6.

(iii) The correlation threshold used to enforce a minimum goodness of fit to each wavelet transform modulus maxima line. It relates to the square of the correlation coefficient of the linear fit to each line. The pipeline uses a value of 0.85. The sensitivity of the glitch detection algorithm increases for lower values of the threshold.

The glitch detection algorithm makes special accommodation for clipped glitches as they deviate systematically from the Dirac shape. The range for the continuous wavelet analysis is restricted by increasing the minimum scale value by 1.

The reconstruction algorithm used by the standard pipeline adopts an adaptive method that depends on the size of the glitch. If fewer than 6 samples after the glitch are affected, a sixth-order polynomial fit is carried out, otherwise a linear fit is used (LeLeu et al. 2012). If a glitch is clipped, then the linear fit is used, extended over 10 samples after the glitch peak.

Typically, for high-resolution observations, the glitch detection algorithm flags about 1 per cent of all data samples as glitches and

corrects them. Even fewer glitches will be identified for observations in low spectral resolution or bright-source modes (Lu et al. 2014).

### 3.1.2 Detector non-linearity

The SPIRE bolometers respond linearly to absorbed power only over a limited range of power, and therefore a correction for non-linearity is required. The procedure to correct for non-linearity is similar to that adopted for the SPIRE photometer (see Bendo et al. 2013; Swinyard et al. 2014), with the linearization carried out by integrating over the inverse bolometer (non-linear) response function, $f(V)$, between a fixed reference voltage, $V_0$, and the measured voltage, $V_{in}$:

$$S = \int_{V_0}^{V_{in}} f(V) dV, \qquad (1)$$

where $S$ is a measure of the optical load on the detector. This equation is normalized to the response at the reference voltage, and approximated using three constants specific to each bolometer, $K_1$, $K_2$, and $K_3$. The linearized signal is given by (Swinyard et al. 2014)

$$V' = K_1(V_{in} - V_0) + K_2 \ln \left( \frac{V_{in} - K_3}{V_0 - K_3} \right). \qquad (2)$$

Note that the value of the reference voltage, $V_0$, does not affect the final spectrum, which depends only on the modulation of the interferogram about the baseline and not on its absolute value (Swinyard et al. 2014). Therefore, $V_0$ was simply set to the mean voltage in one observation of dark sky.

For the nominal mode of the FTS, the values of $K_1$, $K_2$, and $K_3$ between two limiting voltages, $V_{min}$ and $V_{max}$, were calculated using a bolometer model (Mather 1982; Sudiwala, Griffin & Woodcraft 2002), which is based on the bolometer thermometry measured in the laboratory, and heat conductance parameters measured in flight (Nguyen et al. 2004). The $K$-parameter values, the reference voltage, and the limiting voltages are stored in a calibration product which is ingested by the task. However, due to the much larger dynamic range required for the bright-source mode of the FTS, and complications associated with de-phasing the analogue amplifier, the bright mode $K$-parameters were determined directly from a fit to observed data (see Lu et al. 2014).<fnref n="1" />

### 3.1.3 Clipping correction

A 16-bit analogue-to-digital converter (ADC) is used to digitize the output of the bolometer signal processing chain (see Swinyard et al. 2014). The dynamic range of the ADC for each detector is set inside the electronics by subtracting a constant DC offset level, which is measured and reset at the beginning of each observation (except in bright-source mode mapping observations, where it is reset more frequently). If the measured interferogram is not centred in the dynamic range, or has very strong modulation, some samples may lie outside the edges of the dynamic range. Such samples are referred to as ‘clipped’ and flagged in the mask table attached to the data as ‘TRUNCATED’ (see Fig. 5).

This clipping is most likely to occur near ZPD, where the modulation is highest, or at high OPD, in particular for the partially vignetted detectors at the edge of the array whose interferogram

<footnote n="1">¹ At low detector temperatures, there are also small deviations from the model in the nominal mode (on the order of ~0.1 per cent), which may be corrected empirically in a future version of HIPE.</footnote>
<figure><img src="image_6.png" /></figure>

<figure><img src="image_7.png" /><figcaption>Figure 5. Example of a clipped SDT. (a) Full scan, (b) clipped region.</figcaption></figure>

baselines have significant curvature. Clipping near ZPD changes the spectral shape and so the data from that detector should either be corrected or removed.

The clipping correction task reconstructs the data samples flagged as 'TRUNCATED' using an eighth-order polynomial fit to the surrounding unclipped samples. By default, five data samples on either side of the clipped region are fitted with the polynomial. In tests where the interferogram was artificially clipped such that the fourth lobe from ZPD was affected, the spectrum was corrected to better than 3 per cent. A level of clipping greater than this is not seen in normal observations (Polehampton et al. 2011).

If the source brightness changes significantly in mapping observations between consecutive jiggle positions, however, it is possible that some detectors may have significantly worse clipping and in the worst case, the entire interferogram may be truncated. If more than eight consecutive samples are clipped, or if there does not exist at least five consecutive unclipped samples on either side of the clipped sample, then the eighth-order polynomial cannot be used to reconstruct that portion of the timeline and these samples also marked as 'TRUNCATED_UNCORR' by the task.

The uncorrected samples are removed later in the pipeline at the 'create interferogram' stage (Section 3.2). Flagged samples at the high OPD end of the interferogram are removed, which effectively reduces the spectral resolution of the scans for that detector. If there are no unclipped samples left, the entire interferogram (i.e. one scan) is removed for that detector. If all scans are removed, the detector no longer appears in the output product. Finally, in the

baseline correction task (Section 3.3.1), any remaining scans with fewer than 100 samples in the interferogram are removed.

### 3.1.4 Time domain phase correction

The SPIRE spectrometer detector chain contains a six-pole Bessel low pass filter (LPF) as well as single-pole RC LPF (Cara 2005). In addition to the electronic LPFs, the thermal behaviour of the SPIRE bolometers can be modelled as a simple RC LPF with a detector-specific time constant, $\tau$.

These two effects may be combined into a single detector transfer function:

$$H_{\text{Total}-i}(\omega) = H_{\text{LPF}-i}(\omega) + H_{\text{Thermal}-i}(\omega). \quad (3)$$

The overall transfer function shown above will affect both the magnitude and the phase of the signal recorded by the SPIRE detectors. The resulting phase can be expressed as

$$\phi_{\text{Total}-i}(\omega) = \tan^{-1} \left[ \frac{\text{Im}(H_{\text{Total}-i}(\omega))}{\text{Re}(H_{\text{Total}-i}(\omega))} \right]. \quad (4)$$

This phase, to first order, manifests itself as a time delay of the recorded signal. This effect is particularly problematic for the scanning mode of the SPIRE spectrometer, where the delay induced by the electronic and thermal phase can lead to errors in the interpolation of the detector signals (see Section 3.2).

The phase per detector is characterized and used to derive the time domain phase correction function (PCF) given by

$$\text{PCF}_i(t) = \text{FT}^{-1} \left[ e^{-i\phi_{\text{Total}-i}(\omega)} \right]. \quad (5)$$

The measured detector timelines are corrected by convolution with the derived PCF:

$$V_{4-i}(t) = V_{3-i}(t) \otimes \text{PCF}_i(t). \quad (6)$$

## 3.2 Interferogram creation

The pipeline modules listed to this point describe the operations on the Level 0.5 timelines of the spectrometer detectors (Fig. 6a). Three additional Level 0.5 timelines are required for the next step in the common spectrometer data processing pipeline: the Spectrometer Mechanism Timeline (SMECT) product (Fig. 6b); the Nominal Housekeeping Timeline (NHKT) product (Fig. 6c); and the SPIRE Pointing Timeline (SPP) product (see Fig. 2).

A single building block of a SPIRE spectrometer observation in scanning mode consists of a series of scans of the spectrometer mechanism (SMEC) while the instrument is pointed at a given target. The sampling of the SPIRE spectrometer detectors and the spectrometer mechanism is not synchronized; the two subsystems are sampled at different rates and at different times. In order to derive the source spectrum from the measured data, the detector signal timeline must be linked with the position of the SMEC to produce a signal as a function of OPD, or interferogram. Additionally, the detector signal timelines are interpolated on to timelines corresponding to equispaced OPD positions, to exploit the fast Fourier transform (FFT) algorithm. The SPIRE FTS was oversampled by a factor of 4 for SSW and a factor of 6 for SLW (Naylor et al. 2004). Thus a third-order spline interpolation was shown to be equal to or superior to a non-uniform FFT and is used throughout (Naylor et al. 2004). The mean value of the sky position for a detector during a SMEC scan is assigned to that detector's interferogram.

The process by which interferograms are created involves two steps that are described in the following subsections. These steps
<figure><img src="image_8.png" /></figure>

<figure><img src="image_9.png" /></figure>

<figure><img src="image_10.png" /><figcaption>Figure 6. Building block timelines. (a) Spectrometer Detector Signal, (b) spectrometer mechanism, (c) scan counter.</figcaption></figure>

are repeated for all spectrometer detectors, for each scan of the observation building block. The resulting data product is a Level-1 Spectrometer Detector Interferogram (SDI) product that is made available to observers.

### 3.2.1 Interpolation of the SMEC timeline

This step converts the mechanism path difference (MPD) in the spectrometer mechanism timeline from one that is non-uniform in position to one that is uniform in position.

(i) Establish a common OPD position vector. This step creates a common vector of OPD positions that will be the basis of the interferograms for all of the spectrometer detectors and for all of the scans in the building block. This common position vector contains samples that are uniformly spaced in terms of OPD position with one sample at the position of ZPD.

The step size of the common OPD vector is chosen to match the sampling rate of the spectrometer detector signal samples. For an SDT sampling rate s (Hz) and a SMEC scanning speed $v_{SMEC}$ (cm s⁻¹), the size of the step between consecutive mechanism samples, ΔMPD (cm), is given by

$$ \Delta MPD = v_{SMEC}/s. \qquad (7) $$

This step is then converted such that it is in terms of OPD by the following relation:

$$ \Delta OPD = \text{FLOOR}[4\Delta MPD], \qquad (8) $$

where FLOOR[] denotes that the step size is rounded down to the nearest integer in units of µm and the factor of 4 is the nominal conversion between MPD and OPD for a Mach-Zehnder FTS.

(ii) Map the common OPD position vector to a SMEC position vector for each spectrometer detector. For each spectrometer detector, this step maps the common OPD positions on to physical positions in units of mechanical path difference (MPD). This step involves: a scaling factor, f, that takes into account the step size for a Mach-Zehnder FTS; and a shifting factor, ZPD, which establishes the position of zero optical path difference. The final velocity errors of the scaling factor f are <5 km s⁻¹ with a spread of <7 km s⁻¹ (Swinyard et al. 2010; Hopwood et al. 2014). In order to take into account variations due to slight misalignments of the interferometer components, each of these quantities is unique to each spectrometer detector, i:

$$ MPD_i = \frac{\text{OPD}}{f_i} + ZPD_i. \qquad (9) $$

(iii) Parse the measured SMEC timeline into discrete scans. The full SMEC timeline, z(t_SMEC) is split into a series of discrete timelines, z_n(t_SMEC). Each of the discrete timelines, z_n(t_SMEC), represents one spectrometer scan. The delineation of the SMEC timeline is accomplished by comparing consecutive SMEC position samples and finding those samples where the motion of the SMEC mechanism changes direction.

(iv) Interpolate the measured SMEC timelines on to the mapped SMEC timelines. On a detector-by-detector and scan-by-scan basis, the sample times when the spectrometer mechanism reached the mapped SMEC positions are determined through cubic spline interpolation. Since, for each detector, there is a 1:1 relationship between the mapped SMEC positions and the regularly spaced OPD positions, this step effectively determines the times when the SMEC reached the regularly spaced OPD positions for each detector:

$$ z_n(t_{SMEC}) \rightarrow MPD_{n-i}(t_{MPD_i}). \qquad (10) $$

### 3.2.2 Merge the spectrometer detector and the mapped SMEC timelines

This step combines the signal samples from the timeline of a given spectrometer detector, $V_{5-i}(t_i)$, with the mapped SMEC timelines.

(i) Interpolation of the SDTs. The spectrometer detector signal samples are mapped on to the times corresponding to the regular MPD positions, $t_{MPD-i}$, using cubic spline interpolation. Since there
<figure><img src="image_11.png" /><figcaption>Figure 7. Spectrometer Detector Interferogram.</figcaption></figure>

<figure><img src="image_12.png" /><figcaption>Figure 8. Interferogram modification section of the SPIRE spectrometer building block pipeline.</figcaption></figure>

is a 1:1 relationship between these time samples, $t_{MPD-i}$, and the regular MPD positions, MPD$_i$, this interpolation effectively maps, for each detector, the signal samples to the regularly spaced MPD positions. Moreover, since there is a 1:1 relationship between the regular MPD positions for each detector and the common OPD positions, this step accomplishes the mapping of the signal samples for each detector to the common OPD positions (x), resulting in the desired equispaced OPD sampled interferogram (see Fig. 7):

$$V_{4-i}(t_i) \rightarrow V_{5-i}(t_{MPD_i}) \rightarrow V_{5-i}(t_{OPD}) \equiv V_{5-i}(x). \quad (11)$$

(ii) Assign a pointing value to the resultant interferogram. Upon creation of each interferogram, the pointing timeline for each detector $i$, $P_i(t)$ is evaluated and its time-averaged value is affixed to each spectrometer detector for each interferogram in the building block.

### 3.3 Interferogram modification

The pipeline modules described in this section perform operations on the interferograms. Each of the processing steps contained in this processing block accepts an SDI product as input and deliver an SDI product as output (see Fig. 8).

#### 3.3.1 Baseline correction

The radiant power incident on each SPIRE spectrometer detector can be separated into two components: a component that is constant as a function of OPD, and a component that is modulated as a function of OPD. As the first baseline term does not contain relevant spectral information, it may be removed without affecting the source spectrum. Frequency components outside of the optical passband can also be removed from the second term.

The baseline correction algorithm evaluates and removes the offset portion of the measured interferograms, $V_{5-i}(x)$, on a detector-by-detector, and scan-by-scan, basis. The baseline of each interferogram, $V_{Baseline-i}(x)$, is taken as that portion of the interferogram whose Fourier components correspond to frequencies lower than 119.92 GHz (4 cm$^{-1}$). This boxcar filter cut-off frequency was chosen because it provides robust estimates of the baseline without introducing spectral artefacts,

$$V_{Baseline-i}(x) = \text{FT}^{-1} \left[ \text{FT} \left[ V_{5-i}(x) \right]_{v=119.92}^{v=0} \right]. \quad (12)$$

The baseline is subtracted from the input interferogram to derive the corrected interferogram:

$$V_{6-i}(x) = V_{5-i}(x) - V_{Baseline-i}(x). \quad (13)$$

#### 3.3.2 Second-level deglitching

The second-level deglitching step is responsible for identifying and correcting any glitches that are not corrected by first-level deglitching (Section 3.1.1). This step relies on the principle that repeated FTS measurements of the same astronomical source should not deviate from one another beyond random noise. Glitches may then be identified for each spectrometer detector as those that, for a given OPD position, deviate by a given threshold from corresponding samples, taken at the same OPD, from all other scans in the same building block.

Based on a combination of pre-launch and performance verification phase data (Davis-Imhof et al. 2008), the most effective statistical metric found for identifying second-level glitches is the windowed median absolute deviation (MAD) algorithm. For a given detector, this algorithm first computes the standard deviation at each OPD position from all of the measured interferograms. A given OPD position, $x$, is then considered to contain a glitch if the standard deviation<fnref n="2" /> within a window of neighbouring samples, $w$, is $d \times 1.4826 \times \text{MAD}_w$, where $d$ is a pre-determined threshold

$$\begin{aligned} & \partial V_{6-i}(x_k) - \text{MEDIAN}_w (\partial V_{6-i}(x_k)) \\ & > d \times 1.4826 \times \text{MAD}_w (\partial V_{6-i}(x_k)), \end{aligned} \quad (14)$$

where

$$\begin{aligned} & \text{MAD}_w (\partial V_{6-i}(x_k)) \\ & = \text{MAD} \left( \partial V_{6-i} (x_{k-\frac{w-1}{2}}), K, \partial V_{6-i} (x_{k+\frac{w-1}{2}}) \right). \end{aligned} \quad (15)$$

The samples that are identified as outliers are replaced. Each outlier is replaced by the average of the other corresponding samples at that position, as

$$V_{j-7-i}(x_k) = \frac{1}{N_{\text{Scans}} - 1} \sum_{n=1, n \neq j}^{N_{\text{Scans}}} V_{n-6-i}(x_k). \quad (16)$$

<footnote n="2">² For Gaussian-like distribution the standard deviation is $1.4826 \times \text{MAD}$.</footnote>
This deglitching method relies on a statistical analysis of the measured interferograms and requires at least four interferograms (two forward and two reverse spectrometer scans) per building block. All observations conducted with the SPIRE FTS meet this criterion.

### 3.3.3 Phase correction

The presence of dispersive elements and the possibility of the position of ZPD not being sampled can result in an interferogram for which the signal samples are not symmetric about ZPD. The resulting phase can be expressed as

$$ \phi_{\text{exp}-i}(\nu) = \phi_{\text{NonLin}-i}(\nu) + \phi_{\text{Lin}-i}(\nu) + \phi_{\text{Random}-i}(\nu), \quad (17) $$

where $\phi_{\text{NonLin}-i}(\nu)$ is a non-linear phase that represents the effects of the dispersive elements, $\phi_{\text{Lin}-i}(\nu)$ is a linear phase that results from not sampling the position of zero path difference, and $\phi_{\text{Random}-i}(\nu)$ represents any phase due to noise.

The non-linear and linear phase terms are derived per scan direction, on a detector-by-detector basis, from the phases of all the low-resolution portions of the average interferogram for the observation. The non-linear phase and linear phase terms are removed from the measured interferograms in the spectral domain as follows.

**Transform to the spectral domain.** The Fourier transform is applied to each measured interferogram, $V_{7-n-i}(x)$, and also to the average interferograms, $\overline{V_{7-n-i}(x)}$. In order to ensure that the spectral sampling intervals of the transformed interferogram and the calibrated phase are the same, zero-padding (see Section 3.4.1) is applied prior to transformation:

$$ V_{7-n-i}(\nu) = \text{FT}[V_{7-n-i}(x)] \overline{V_{7-n-i}(\nu)} = \text{FT}[\overline{V_{7-n-i}(x)}]. \quad (18) $$

**Derive the non-linear phase.** The $\phi_{\text{NonLin}-i}(\nu)$ term is derived as

$$ \phi_{\text{NonLin}-i}(\nu) = \tan^{-1} \left[ \frac{\text{Im} \left( \overline{V_{7-n-i}(x)} \right)}{\text{Re} \left( \overline{V_{7-n-i}(x)} \right)} \right]. \quad (19) $$

**Correct the transformed interferogram.** The spectrum of the measured interferogram is corrected by way of multiplication with the negative of the non-linear phase,

$$ V_{8-n-i}(\nu) = V_{7-n-i}(\nu) e^{-i\phi_{\text{NonLin}-i}(\nu)}. \quad (20) $$

**Derive the linear phase.** The $\phi_{\text{Lin}-n-i}(\nu)$ term is derived from a linear fit of the remaining phase of each of the corrected spectra:

$$ \phi_{\text{Lin}-n-i}(\nu) = \phi_{\text{fit}-n-i}(\nu) = a_i + b_i \nu. \quad (21) $$

**Correct the transformed interferogram.** The spectrum of the measured interferogram is further corrected by way of multiplication with the negative of the linear phase:

$$ V_{8-n-i}(\nu) = V_{7-n-i}(\nu) e^{-i\phi_{\text{Lin}-i}(\nu)}. \quad (22) $$

**Apply the inverse transform to the corrected spectrum.** The inverse Fourier transform is applied to the corrected spectrum, $V_{8-n-i}(\nu)$, to create the corrected interferogram, $V_{8-n-i}(x)$:

$$ V_{8-n-i}(x) = \text{FT}^{-1}[V_{8-n-i}(\nu)]. \quad (23) $$

## 3.4 Spectrum creation

At this point in the spectrometer pipeline, the interferograms have been subject to comprehensive corrections. The Fourier transform is now applied to the interferograms for each detector, $V_{n-m-i}(x)$, in order to convert them into spectra, $V_{n-m-i}(\nu)$. Further corrections are then applied in the spectral domain.

### 3.4.1 Fourier transform

The Fourier transform module transforms the set of corrected interferograms into a set of spectra. Double-sided transform. The low-resolution AOTs (SPIRE Handbook 2016) produce double-sided interferograms. In these cases, each interferogram in the SDI is examined and the entire recorded interferogram is used to compute the resultant spectrum:

$$ V_{9-i}(\nu) = \text{FT}[V_{8-i}(x)|_{-L}^{L}] = \int_{-L}^{L} V_{8-i}(x)e^{-i2\pi\nu x} dx. \quad (24) $$

The discrete Fourier transform that is used to compute the spectral components takes the form:

$$ V_{9-i}(v_k) = \sum_{n=0}^{N} V_{8-i}(x_n) e^{-i \frac{2\pi nk}{N}}. \quad (25) $$

**Single-sided transform.** The high-resolution AOT (SPIRE Handbook 2016) produces single-sided interferograms of the samples of which are asymmetric with respect to the position of ZPD. The spectra computed from the high-resolution observations are derived from the interferogram samples for which positions are greater than or equal to the position of ZPD:

$$ V_{9-i}(\nu) = \text{FT}[V_{8-i}(x)|_{-L}^{L}] = \int_{0}^{L} V_{8-i}(x) \cos 2\pi\nu x dx. \quad (26) $$

The Discrete Fourier transform that is used to compute the spectral components for single-sided interferograms takes the following form:

$$ V_{9-i}(v_k) = \sum_{n=0}^{N} V_{8-i}(x_n) \cos \left( \frac{2\pi nk}{N} \right). \quad (27) $$

**Frequency grid.** In the case of both the single-sided and double-sided transforms the wavenumber grid on to which the spectrum is registered is calculated from the interferogram sampling rate (ΔOPD) and the maximum OPD, L. The Nyquist frequency ($v_{\text{Nyquist}}$) is the highest frequency that can be unambiguously encoded in a discretely sampled system and is given by

$$ v_{\text{Nyquist}} = \frac{1}{2\Delta\text{OPD}} \times 10^{-7}c. \quad (28) $$

The spacing between independent spectral samples (Δν) is given by

$$ v_{\text{Nyquist}} = \frac{1}{2L} \times 10^{-7}c. \quad (29) $$

**Interferogram padding.** The spacing between spectral samples can be modified by padding the interferogram with zeros, a process sometimes known as zero infilling. This procedure allows for an easier comparison of the spectra derived from observations at different spectral resolutions. In this case, a zero-padded interferogram, $V_{9-ZP-i}(x)$, is given by

$$ V_{9-ZP-i}(x) = V_{8-i}(x)|_{0}^{L}, \quad 0 \le x < L_{\text{ZP}}. \quad (30) $$

The corresponding spectral sampling interval is given by

$$ v_{\text{ZP}} = \frac{1}{2L_{\text{ZP}}} \times 10^{-7}c, \quad (31) $$

and the resultant spectrum of the zero-padded interferogram is given by

$$ V_{9-ZP-i}(v_k) = \sum_{n=0}^{N_{\text{ZP}}} V_{9-ZP-i}(x_n) \cos \left( \frac{2\pi nk}{N_{\text{ZP}}} \right). \quad (32) $$
<table><caption>**Table 3.** Spectral sampling intervals for two SPIRE spectral resolution observing options.</caption><thead><tr><th>Spectral resolution</th><th>Sampling interval (OPD) (μm)</th><th>Nyquist frequency (GHz)</th><th>Padded scan length (OPD) (cm)</th><th>Spectral sampling interval (GHz)</th></tr></thead><tbody><tr><td>Low</td><td>25</td><td>5995.85</td><td>2.0</td><td>7.495</td></tr><tr><td>High</td><td>25</td><td>5995.85</td><td>50.0</td><td>0.299</td></tr></tbody></table>

<figure><img src="image_13.png" /><figcaption>**Figure 9.** Initial spectrometer detector spectrum.</figcaption></figure>

The SPIRE spectrometer AOTs (SPIRE Handbook 2016) provided two spectral resolution options. The lengths to which the interferograms are padded and the resultant spectral sampling intervals for each of the resolutions are shown in Table 3.

## 3.5 Spectrum modification

The pipeline modules in this section describe how to process the spectrometer detector spectra that were created in the 'Fourier transform' step (see Figs 9 and 10). The end result of these processing steps will be a Level-2 SDS product that contains a single, flux-calibrated, average spectrum for each spectrometer detector, $I_i(\nu)$.

### 3.5.1 Remove out of band flux

This processing step removes, from each of the computed spectra, components corresponding to out of band frequencies. The lower and upper limits of the spectral passbands ($v_{min}$ and $v_{max}$) were determined from performance verification data for each detector and are provided by a calibration product,

$$V_{10-n-i}(\nu) = V_{9-n-i}(\nu)|_{v_{\text{min}-i}}^{v_{\text{max}-i}} \quad (33)$$

The equation for the total intensity of the radiation incident upon the spectrometer detectors shows that, in addition to radiation from the astronomical source, the detectors record a modulated signal from the Herschel telescope, and a modulated signal arising from the emission of spectrometer instrument. The spectrum, $V_{10-n-i}(\nu)$, for each detector $i$ and SMEC scan $n$, can be expressed as

$$V_{10-n-i}(\nu) = V_{10-\text{Source}-n-i}(\nu) + V_{10-\text{Telescope}-n-i}(\nu) \\ + V_{10-\text{Instrument}-n-i}(\nu). \quad (34)$$

<figure><img src="image_14.png" /><figcaption>**Figure 10.** Spectral modification section of the SPIRE spectrometer building block pipeline.</figcaption></figure>

### 3.5.2 Instrument correction

This processing module removes the contribution from the SPIRE instrument from each of the measured spectra. For each SMEC scan of the building block $n$, the contribution due to the SPIRE instrument is characterized as the product of a blackbody function at the mean recorded SCAL temperature for that scan, $T_{SCAL}$, and the Instrument Relative Spectral Response Function (RSRF), $RSRF_{Instrument}(\nu)$, for that detector:

$$V_{\text{Instrument}-n-i}(\nu) = B(T_{\text{SCAL}}, \nu)RSRF_{i-\text{Instrument}}(\nu), \quad (35)$$

$$V_{11-n-i}(\nu) = V_{10-n-i}(\nu) - V_{10-\text{Instrument}-n-i}(\nu). \quad (36)$$

### 3.5.3 Extended source spectral response correction

The response of the SPIRE spectrometer detector subsystem depends on the wavelength and on the spatial extent of the source being studied. In other words, the response to point-like astronomical sources differs from that of extended sources that fill the detector's field of view, as confirmed by in-flight observations. This module performs two functions simultaneously: it removes from the measured spectrum of each detector in the input SDS product the RSRF for that particular detector; and it converts the spectral intensities from units of V GHz$^{-1}$ to brightness quantities with units of W m$^{-2}$ sr$^{-1}$ Hz$^{-1}$. At this stage the extended source correction is applied. The intensity is derived as

$$I_{12-i}(\nu) = \frac{V_{11-i}(\nu)}{RSRF_{i-\text{Telescope}}(\nu)}, \quad (37)$$

which can be expressed as

$$I_{12-i}(\nu) = \frac{V_{11-\text{Source}-i}(\nu)}{RSRF_{i-\text{Telescope}}(\nu)} + \frac{V_{11-\text{Telescope}-i}(\nu)}{RSRF_{i-\text{Telescope}}(\nu)}. \quad (38)$$
The extended source RSRF correction and flux conversion curves, RSRF<sub>i-Telescope</sub>(ν), are derived from multiple calibration observations of a dark sky region and a thermal model of the emission expected from the primary and secondary mirrors of the Herschel telescope (Fulton et al. 2014).

### 3.5.4 Herschel telescope correction

This module applies a correction for the contribution to the measured signal from the Herschel telescope itself. As a reminder, the measured spectra at this point in the processing pipeline $I_{12-i}(ν)$, for each detector i, may be expressed as

$$I_{12-i}(\nu) = I_{12-\text{Source-i}}(\nu) + I_{12-\text{Telescope-i}}(\nu). \quad (39)$$

The method employed to correct for emission from the Herschel telescope is to subtract from the measured spectrum for each detector, $I_{12-i}(ν)$, a model of the spectrum, $I_{\text{TelescopeModel}-i}(ν)$, which is given by

$$I_{\text{TelescopeModel}-i}(\nu) = (1 - \epsilon_{\text{Tel}}(\nu)) \epsilon_{\text{Tel}}(\nu) E_{\text{Corr}} B(\overline{T_{\text{M1}}}, \nu) + \epsilon_{\text{Tel}}(\nu) B(\overline{T_{\text{M2}}}, \nu), \quad (40)$$

where $\overline{T_{\text{M1}}}$ and $\overline{T_{\text{M2}}}$ represent the mean of the mean temperatures of the Herschel telescope's nine M1 and three M2 thermometers over the course of the observation building block, $B(T, ν)$ is the Planck function, $\epsilon_{\text{Tel}}(ν)$ refers to the emissivity of the dusty Herschel telescope mirrors M1 and M2 (Fischer et al. 2004), and $E_{\text{Corr}}$ is an operational-day-dependent correction factor to account for the changing emissivity of the mirror M1 (Hopwood et al. 2014). The resultant spectra are given by

$$\begin{aligned} I_{13-i}(\nu) &= I_{12-i}(\nu) - I_{12-\text{TelescopeModel}-i}(\nu) \\ &= I_{12-\text{Source}-i}(\nu) + I_{12-\text{Telescope}-i}(\nu) \\ &\quad - I_{12-\text{TelescopeModel}-i}(\nu). \end{aligned} \quad (41)$$

### 3.5.5 Extended source calibration

$I_{13-i}(ν)$, as given in equation (41), does not include the far-field feedhorn efficiency correction $\eta_{\text{ff}}$. This correction is of the order of 0.65-0.70 for SSW and from 0.45 to 0.75 for SLW (Wu et al. 2013). Applying $\eta_{\text{ff}}$ to $I_{13-i}(ν)$ gives the correct extended source calibrated intensity:

$$I_{13-\text{EXT}-i}(\nu) = I_{13-i}(\nu)/\eta_{\text{ff}}. \quad (42)$$

Note that this correction was not applied before HIPE version 14 of the pipeline. Consequently, prior to HIPE 14, all the intensities, including those in spectral maps, are significantly underestimated by $\eta_{\text{ff}}$. Once the correction is applied, comparing synthetic photometry from $I_{13-EXT-i}(ν)$ for fully extended and spatially flat sources to the broad-band intensities from SPIRE photometer extended source calibrated maps, matches at a level of 3-5 per cent (for more details see Valtchanov et al., in preparation). $\eta_{\text{ff}}$ was measured in a lab using a feedhorn and a laser, although only for SLW (Chattopadhya et al. 2003). The uncertainty of the measurement is 3 per cent and considering the better behaved beam in SSW, we conservatively assume the same uncertainty for the short-wavelength array. Hence the overall extended calibration uncertainty, including $\Delta\eta_{\text{ff}}$, the telescope model uncertainty of 0.06 per cent (see Swinyard et al. 2014), and the 1 per cent statistical repeatability, is <4 per cent for fully extended sources.

<figure><img src="image_15.png" /></figure>

<figure><img src="image_16.png" /><figcaption>Figure 11. Level 2 Spectra. (a) Extended-source calibrated, (b) point-source calibrated.</figcaption></figure>

## 4 LEVEL-2 SPECTRAL PRODUCTS

The final phase of the SPIRE spectrometer pipelines involves operations that modify the SDS products produced by the building block pipeline to create a set of Level-2 spectral products. The format and the contents of the Level-2 portion of the observation context depend on the observation.

(i) Single pointing sparse sampling observations. The Level-2 context contains both extended source calibrated and point source calibrated spectra (see Fig. 11). The point source calibrated spectra contain only the unvignetted detectors.

(ii) Mapping observations. The Level-2 context contains both Spectrum2d products and hyperspectral cubes. In both cases, the extended source calibration is applied to the individual spectra.

### 4.1 Single pointing sparse sampling observations

#### 4.1.1 Point source spectral response correction and flux conversion

In this step, a separate correction for point source observations is applied, as the correction applied in Section 3.5.3 is appropriate only for extended sources. In effect, this step applies the inverse of the extended source RSRF and then divides the input spectra by
a frequency-dependent RSRF applicable to point-like astronomical sources:

$$I_{14-i}(v) = I_{13-i}(v) \frac{f_{\text{Point-i}}(v)}{\text{RSRF}_{\text{Telescope-i}}(v)} \text{RSRF}_{\text{Point-i}}(v). \quad (43)$$

The conversion curves, $f_{\text{Point-i}}(v)/\text{RSRF}_{\text{Point-i}}(v)$, are derived from the results of an observation of Uranus and a model of its brightness (ESA-4 models; Orton et al. 2014).

### 4.1.2 Low-resolution correction

Observations made in low-resolution mode require an additional empirical correction to account for differences with the high-resolution mode, on which all other calibration steps in the pipeline are based (Swinyard et al. 2014). The low-resolution correction consists of applying a detector-dependent empirically derived (Marchili et al., in preparation) calibration curve to minimize the frequency-dependent artefacts in low-resolution spectra. This correction applies only to point source calibrated data and only for the detectors in the SLW band.

### 4.1.3 Apodization

The natural instrument line shape (ILS) for a Fourier transform spectrometer is a cardinal sine, or sinc function. If the source signal contains features at or near the resolution of the spectrometer, the ILS can introduce secondary maxima in the spectra. The apodization functions available within this module may be used to reduce these secondary maxima at the cost of degrading the spectral resolution. While the default apodization function chosen for the standard processing pipeline is the Hanning (Blackman & Tukey 1959) function, a number of apodizing functions that allow for an optimal trade-off between reduction in the secondary maxima and reduced resolution (Naylor & Tahic 2007) are available for use in interactive processing. Apodization is performed on a detector-by-detector and on a scan-by-scan basis by convolution of the input spectra, $I_{n-14-i}(v)$, with the Fourier transform of a tapering or apodizing function:

$$I_{14-A-i}(v) = I_{14-A-i}(v) \otimes \text{FT}[\text{Hanning}(x)]. \quad (44)$$

The results of this processing step are two Level-2 SDS products (see Fig. 10) that are available to observers – the standard product where no apodization has been applied and one where the default apodization function has been applied.

### 4.1.4 Radial velocity correction

This step uses the radial velocity of the Herschel telescope to correct the frequency axis to the kinematical local standard of rest (LSR). This is accomplished in two steps.

(i) Compute the LSR frequencies. This step uses the Herschel satellite velocity, accurate to 1.2 cm s⁻¹ for the determined velocity and to 3.6 cm s⁻¹ for the predicted velocity (Herschel Flight Control Team 2014), to compute a set of LSR frequencies for each spectrum:

$$v_{14-n-i-LSR} = v_{14-n-i} / (1 - v_{\text{Herschel}}/c). \quad (45)$$

(ii) Interpolate the spectral flux on to the original frequency grid. This step ensures that the spectra are always sampled on to the same frequency grid, allowing easier observation-to-observation

comparison:

$$I_{14-n-i}(v_{14-n-i-LSR}) \rightarrow I_{14-n-i-LSR}(v_{14-n-i}) \equiv I_{14-n-i}(v_{14-n-i}). \quad (46)$$

### 4.1.5 Spectral averaging

This module computes, on a frequency-by-frequency ($v_k$) basis for each spectrometer detector, $i$, the weighted average of the spectral intensities across all scans, $n$:

$$\overline{I_{15-i}(v)} = \frac{\sum_{n=1}^{N_{\text{Scans}}} w_n(v_k) I_{n-14-i}(v_k)}{w_n(v_k)}. \quad (47)$$

The weighting factors, $w_n(v_k)$, in this equation are taken as the number of scans used to compute each element $I_{n-12-i}(v_k)$ and are normally set to 1. In addition, this module computes, on a frequency-by-frequency basis for each spectrometer detector, the uncertainty in the spectral average. The uncertainty is calculated as the weighted standard error of the mean of the spectral components as

$$\partial I_{15-i}(v) = \sqrt{\frac{1}{\left(\sum_{n=1}^{N_{\text{Scans}}} w_n(v_k)\right)^2 - 1} \left[a - \overline{I_{14-i-n}(v_k)}^2 + b\right]}, \quad (48)$$

where

$$a = \frac{\sum_{n=1}^{N_{\text{Scans}}} w_n(v_k) I_{14-i-n}^2(v_k)}{\sum_{n=1}^{N_{\text{Scans}}} w_n(v_k)}, \quad (49)$$

$$b = \frac{\sum_{n=1}^{N_{\text{Scans}}} \partial I_{14-i-n}^2(v_k) w_n(v_k) (w_n(v_k) - 1)}{\sum_{n=1}^{N_{\text{Scans}}} w_n(v_k)}. \quad (50)$$

When the weighting factors are equal to 1, equations (47) and (48) reduce to the unweighted mean and standard error on the mean (standard deviation divided by root $N$).

The sky position for spectrum in the output product is computed as the average of the right ascension (RA) and declination (Dec.) of each spectrum for the given detector.

## 4.2 Mapping observations

### 4.2.1 Spatial regridding

The SPIRE FTS detector arrays are arranged in a hexagonal, close packed, configuration, as shown in Fig. 1. Observations made with sparse sampling are treated by the pipeline as individual spectra. However, intermediate and fully sampled observations, and observations made in raster mode, are treated as maps and in the final step they are projected on to a rectangular sky grid to produce a hyperspectral cube.

The first step in creating a regularly gridded hyperspectral cube is to collect the individual spectra from each detector, jiggle position and raster point into a single list. The format of this product is a two-dimensional list of spectra, with additional columns containing the sky position, and other relevant information such as detector name and spectral resolution achieved.

The second step is to define the coordinate system for the regularly sampled spectral cube such that it covers all of the observed sky positions. The coordinate system is specified using the FITS World Coordinate System (WCS; Greisen & Calabretta 2002) with the frequency grid specified as a third axis (Greisen et al. 2006).
<figure><img src="image_17.png" /><figcaption>**Figure 12.** Level 2 spectral cubes. (a) SLW cube, (b) SSW cube.</figcaption></figure>

A tangential projection is used with equatorial RA and Dec. referenced to the J2000 equinox (see Calabretta & Greisen 2002). The regularly spaced frequency axis has already been referenced to the LSRk frame by the radial velocity correction task (Section 4.1.4).

The WCS reference coordinates are set to the average RA/Dec. by summing the vectors of the sky position of each spectrum. The size of the spatial grid is then determined to be the minimum necessary to encompass all of the observed points using the pixel sizes given in Table 2. The reference coordinates always correspond to the centre of a pixel.

### 4.2.2 Hyperspectral cubes

The final step in producing the hyperspectral cubes is to project the 2D list of spectra into the target spatial grid. The Standard Product Generation for mapping observations provides two sets of spectral cube products in the Level-2 context. One set is produced using the naïve projection method (the same algorithm used to map SPIRE photometer observations; Bendo et al. 2013) and the other with a convolution projection, which takes into account the FTS beam variation with frequency, assuming a Gaussian beam. For each set there are separate cubes for the SLW and SSW spectrometer detector arrays (see Fig. 12), and for each cube there is a second version for which the standard apodization function has been applied.

The naïve projection algorithm computes the brightness and uncertainty in a given map pixel as the mean and standard error of the mean of all spectral samples within that pixel, respectively. The spectra are averaged with the same spectral averaging described by equations (47) and (48). The map pixel value is set to *NAN* (not a number) if no spectra were observed within that pixel. The naïve projection task iterates through all spectral bins and applies the mapping algorithm for each slice independently, using the same WCS for each. A coverage map is also computed by the task, giving the number of samples used to compute the flux and uncertainty values.

Because of the two dead bolometers in the first and second ring of SSW (SPIRE Handbook 2016), the coverage for spectral maps produced with the naïve projection may have empty pixels close to the map centre (e.g. see the SSW cube in Fig. 12). There are no such empty pixels for the convolution gridded cubes, as each pixel is the weighted sum of all spectra being projected, as shown in Fig. 13. The convolution method computes a weighted error map and a coverage map of the weighted contribution for all spectra.

## 5 SUMMARY

We have presented an overview of the data processing pipeline for the SPIRE Imaging Fourier transform spectrometer on the Herschel Space Observatory. The data processing modules that are used

<figure><img src="image_18.png" /><figcaption>**Figure 13.** The spectral cube slice for IRAS 16293 (ObsID: 1342204898) at 1244 GHz (SSW array). The blue circles of 9.5-arcsec radius are the SSW detectors positions at one of the 16 jiggle positions (full spatial resolution mode). The sky position of each individual spectrum (red crosses) are also shown: these individual spectra are binned on a sky grid to produce the cube using the convolution or naïve projection method.</figcaption></figure>

and the manner by which they are combined within the pipeline have been described. The Level-0.5 and Level-1 building block data products as well as the Level-2 spectral products for the SPIRE astronomical observation templates have been presented.

## ACKNOWLEDGEMENTS

SPIRE has been developed by a consortium of institutes led by Cardiff University (UK) and including Univ. Lethbridge (Canada); NAOC (China); CEA, LAM (France); IFSI, Univ. Padua (Italy); IAC (Spain); Stockholm Observatory (Sweden); Imperial College London, RAL, UCL-MSSL, UKATC, Univ. Sussex (UK); and Caltech, JPL, NHSC, Univ. Colorado (USA). This development has been supported by national funding agencies: CSA (Canada); NAOC (China); CEA, CNES, CNRS (France); ASI (Italy); MCINN (Spain); SNSB (Sweden); STFC (UK); and NASA (USA). The authors wish to acknowledge Andres Rebolledo, Peter Kennedy, Zhaohan Weng, Yan He, Karim Ali, Yu Wai Wong, Alim Harji, Yufei Ren, David Sharpe, and Jeremy Zaretski for their contributions to the development of the SPIRE spectrometer data processing modules. The authors would also like to thank Christophe Ordenvic and Dominique Benielli for their contributions to the first level deglitching and Telescope/SCAL corrections. The authors thank Locke Spencer and Gibion Makiwa for their contributions to the development of the data processing pipeline. The funding for the Canadian contribution to SPIRE was provided by the Canadian Space Agency and NSERC.

## REFERENCES

* Ade P., Hamilton P., Naylor D., 1999, Fourier Transform Spectroscopy: New Methods and Applications. OSA Technical Digest, Optical Society of America, paper FWE3

* Bendo G. J. et al., 2013, MNRAS, 433, 3062

* Blackman R. B., Tukey J. W., 1959, The Measurement of Power Spectra. Dover Press, New York, p. 95
Calabretta M. R., Greisen E. W., 2002, A&A, 395, 1077

Cara C., 2005, SPIRE-SAP-PRJ-001243, Technical Report

Chattopadhaya G., Glenn J., Bock J. J., Rownd B. K., Caldwell M., Griffin
M. J., 2003, IEEE. Trans. Microwave Theory Techniques, 51, 2139

Davis-Imhof P. et al., 2008, SPIRE-BSS-DOC-003195, Technical Report

Dohlen K., Origne A., Pouliquen D., Swinyard B. M., 2000, Proc. SPIE, 4013, 119

Dowell D. et al., 2010, Proc. SPIE, 7731, 773136

Fischer J., Klaassen T., Hovenier N., Jakob G., Poglitsch A., Sternberg O., 2004, Appl. Opt., 43, 3765

Fulton T. R. et al., 2014, Exp. Astron., 37, 381

Greisen E. W., Calabretta M. R., 2002, A&A, 395, 1061

Greisen E. W., Calabretta M. R., Valdes F. G., Allen S. L., 2006, A&A, 446, 747

Griffin M. J. et al., 2010, A&A, 518, L3

Herschel Flight Control Team 2014, PT-HMOC-OPS-RP-7600-OPS-OAH,
Technical Note

Hopwood R. et al., 2014, Exp. Astron., 37, 195

LeLeu G. et al., 2012, in Ballester P., Egret D., Lorente N. P. F., eds, ASP Conf. Ser. Vol. 461, Astronomical Data Analysis Software and Systems XXI. Astron. Soc. Pac., San Francisco, p. 749

Lu N. et al., 2014, Exp. Astron., 37, 239

Mallat S., Hwang W. L., 1992, IEEE Trans. Inf. Theory, 38, 617

Mather J. C., 1982, Appl. Opt., 21, 1125

Naylor D. A., Tahic M. K., 2014, J. Opt. Soc. Am., 24, 3644

Naylor D. A., Schultz A. A., Clark T. A., 1988, Appl. Opt., 27, 2603

Naylor D. A. et al., 2004, Proc. SPIE, 5546, 61

Nguyen H. T. et al., 2004, Proc. SPIE, 5498, 196

Ordénovic C., Surace C., Torrésani B., Llébaria A., 2008, Stat. Methodol., 5, 373

Orton G. S. et al., 2014, Icarus, 243, 494

Ott S., 2010, in Mizumoto Y., Morita K.-I., Ohishi M., eds, ASP Conf. Ser. Vol. 434, Astronomical Data Analysis Software and Systems XIX. Astron. Soc. Pac., San Francisco, p. 139

Pilbratt G. L. et al., 2010, A&A, 518, L1

Polehampton E. et al., 2011, SPIRE-RAL-NOT-003270, Technical Note

SPIRE Handbook 2016, HERSCHEL-HSC-DOC-0798, accessed from
http://herschel.esac.esa.int/Documentation.shtml

Struzik Z. R., 1999, in Dekking M., Lévy-Véhek J., Lutton E., Tricot C., eds, Fractals: Theory and Applications in Engineering. Springer-Verlag, Berlin, p. 93

Sudiwala R. V., Griffin M. J., Woodcraft A. L., 2002, Int. J. Infrared Mil-
limeter Waves, 23, 575

Swinyard B. M. et al., 2010, A&A, 518, L4

Swinyard B. M. et al., 2014, MNRAS, 440, 3658

Wu R., Polehampton E., Etxaluze M. et al., 2013, A&A, 556, A116

This paper has been typeset from a TeX/Latex file prepared by the author.