## 1.39. doFold

 Full Name: herschel.hifi.pipeline.generic.DoFoldTask Alias: doFold Type: Java Task - Import: from herschel.hifi.pipeline.generic import DoFoldTask Category HIFI/Pipeline/Interactive Pipeline Steps

#### Description

Performs folding for frequency switched spectra.

The folded spectra are constructed by averaging the original spectra with a shifted and inverted copy. This algorithm corresponds to the most simple scheme described in the article {\it "Recovering line profiles from frequency-switched spectra}, H.Liszt, Astron. Astrophys. Suppl. Ser. 124, 183-188 (1997)}. For the input spectra included in the input timeline product a linear frequency scale is assumed. The size of the spectra is reduced by the number of channels corresponding to the LO throw.

Note that the folding is not perfect in the sense that typically, ghost lines appear to the left and the right or the actual lines as asorption lines. This can be annotated with the sequence -,-'-,-. Some care is needed when interpreting e.g. USB data containing both USB and LSB spectra: USB emission lines appear as emission lines and LSB lines appear as "absorption lines". This is explained in some more detail in the following:

• An emmission USB line will show up in the USB as -,-'- if the LO throw is positive (i.e. the reference phase with the line pointing downwards is shifted by the LO throw to the left). Applying the fold to this timeline product (corresponding to the USB) leads to a picture of the form -,-'-,- where a duplicated reference phase occurs phase to the right of the emission line. In case the LO throw is negative the reference in the input spectra will appear on the right and the duplicated ghost in the folded spectra appears on the left.

• An LSB emission line will show up in the USB as -'-,- if the LO throw is positive (here the reference phase with the line pointing downwards is shifted by the LO throw to the right). Applying the fold to this (USB) timeline product leads to a picture of the form -'-,-'- where a duplicated 'emission' line appears to the right.

In addition to modifying the segment data the integration time is doubled to reflect the total integration time from the two overlayed phases.

#### Example

Example 1: In HIPE:
 from herschel.hifi.pipeline.generic import DoFold doFold = DoFoldTask() doFold(htp=htp) doFold(htp=htp, throw=0.120, shift=True) doFold(htp=htp, throw=120, unit="MHz", shift=True) doFold(htp=htp, params=params) doFold(htp=htp, throw=120, unit="MHz", shift=True, types="science,hc")

## API Summary

Jython Syntax

See example below.

Properties
 HifiTimelineProduct htp [INOUT, MANDATORY, default=no default value]
 PipelineConfiguration params [INPUT, OPTIONAL, default=no default value]
 Double throw [INPUT, OPTIONAL, default=no default value]
 String unit [INPUT, OPTIONAL, default=no default value.]
 Boolean shift [INPUT, OPTIONAL, default=False]
 String types [INPUT, OPTIONAL, default=no default value]
 Boolean overwrite [INPUT, OPTIONAL, default=False.]

### API details

#### Properties

 HifiTimelineProduct htp [INOUT, MANDATORY, default=no default value]

The timeline product to be processed.

 PipelineConfiguration params [INPUT, OPTIONAL, default=no default value]

Pipeline configuration parameters that can be passed to the task.

 Double throw [INPUT, OPTIONAL, default=no default value]

The frequency throw to can be set manually. If now throw is specified the meta data field 'loThrow' of each dataset is used (if available).

 String unit [INPUT, OPTIONAL, default=no default value.]

Unit of the frequency throw parameter (applies in case the throw is explicitly specified). If no unit is specified it is assumed that the unit of the frequency throw is the same as the unit of the wave scale. Typical values are "GHz" or "MHz".

 Boolean shift [INPUT, OPTIONAL, default=False]

Shifts the folded spectra by half the throw in direction of the throw.

 String types [INPUT, OPTIONAL, default=no default value]

Restrict the folding to the specified sds_types. A comma-separated list of values can be entered here.

 Boolean overwrite [INPUT, OPTIONAL, default=False.]

Specify whether the input data container can be reused so that the values found therein are overwritten. If set to False (default), a new container is created and the spectral segments are reduced in shape by the frequency throw distance - if set to True, the original data arrays are used to store the data hence the spectral segments are not changed in shape.

• 2011-07-17 - Melchior: : History added.
• 2011-08-14 - Melchior: : Renamed to DoFoldTask.
• 2013-03-13 - Melchior: : Add overwrite parameter.