1.103. mkFreqGrid

Full Name: herschel.hifi.pipeline.generic.MkFreqGridTask
Alias: mkFreqGrid
Type: Java Task - Java Task
Import: from herschel.hifi.pipeline.generic import MkFreqGridTask

HIFI/Pipeline/Level 2 Pipeline


Computes a frequency scale which will be used for resampling.

A frequency scale is determined for each frequency group separately. Within the frequency groups, a common scale is computed for each subband / segment. The following procedure is adopted:

  • Assume the frequency vector is called 'f', and the stepsize is 's'. Then the min frequency is determined by looping over all the scans within the frequency group but keeping the subband fixed. Similarly, a maximum frequency is computed.

  • These minimum and maximum frequencies (minF and maxF, respectively) are rounded to the nearest integer multiple of the stepsize.

  • For frequencies in the LSB, the frequencies are first mirrored to the upper sideband so that the rounding procedure result in equally shaped new frequency grids. For the mirroring, we also check whether a velocity correction has been applied and the LO frequency is adjusted accordingly (see the meta data fields 'isVelocityCorrected' or 'velocity_user').

  • From these rounded minimum and maximum frequencies we compute the number of grid points (n) in the output grid.

  • The grid of size n is then created starting for the IF or USB (or LSB) with the rounded minimum (or maximum) frequency increasing (or decreasing) in steps of size stepsize.

In case no stepsize is specified, the stepsize is set to 0.5 for WBS. For HRS, the stepsize is computed by using the following scheme: From the minF and the maxF determined for the frequency group and the number of channels (n), the stepsize s is set to s = (maxF-minF) / (n-1) s = 1 / max(1,round(1/s))


Example 1: In HIPE:
# spectra: the timeline product provided as input
res = mkFreqGrid(htp=spectra)
res = mkFreqGrid(htp=spec, stepsize=0.5) # this will assume that the wave scale of the spectra is expressed in MHz.
res = mkFreqGrid(htp=spec, stepsize=0.5, unit="MHz")
res = mkFreqGrid(htp=spec, stepsize=[0.2,0.1,0.3])
# using the defaults specified in the xml-files:
params = PipelineConfiguration.getConfig(spec)
res = mkFreqGrid(htp=spec, params=params)

API details


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

The input timeline product.

CalFreqGrid cal [OUTPUT, MANDATORY, default=no default value]

Output product that contains for each frequency group a TableDataset with frequency grids per subbands. Some convenience methods are added to facilitate the access to the grids. The columns inherit the units and the naming of the frequency grids found in the input data.

Object stepsize [INPUT, OPTIONAL, default=no default value]

The step size defining the spacing in the target frequency grid. You can specify a single double or an array of doubles, one value for each subband.

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

Unit the stepsize is expressed in. If no unit is specified it is assumed that the unit of the stepsize is the same as the unit of the wave scale. Typical values are "GHz" or "MHz".

Boolean envelope [INPUT, OPTIONAL, default=no default value.]

Flag that indicates how the output grid should be delimited: If set to true, the output grid is delimited by the union of the input grids (per subband and frequency group), if set to false, it is delimited by the cross section of the input grids. Note that setting envelope to true means that, after resampling, you may find NaN's at the edges of some of the spectra. On the other hand, setting senvelope to false may imply that some of the data at the edges of the spectra are list.

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

Pipeline configuration parameters that can be passed to the task.

Boolean ignore [INPUT, OPTIONAL, default=no default value]

If set to True task is not executed.

See also


  • 2011-07-11 - melchior: : history added.
  • 2011-08-14 - melchior: : Renamed to MkFreqGridTask.
  • 2011-12-14 - melchior: : Add envelope parameter.