1.80. fitBaseline

Full Name: herschel.hifi.dp.tools.FitBaselineTask
Alias: fitBaseline
Type: Java Task - Java Task
Import:

import herschel.hifi.dp.tools.FitBaselineTask

Category

HIFI/Analysis

Description

A routine to fit and subtract or divide baselines in HIFI spectra.

Example

Example 1: Simple Example from herschel.hifi.dp.tools import FitBaselineTask
#Create masks by clicking
result = fitBaseline(data=obs_in,domask=2)

API details

Properties

HifiSpectrumDataset|HifiTimelineProduct|ObservationContext|SimpleSpectrum data [INPUT, MANDATORY, default=no default value]

OPTIONAL, no default value - ObservationContext containing the data for which baseline should be fitted. - HifiTimelineProduct containing the data for which baseline should be fitted. - SpectrumDataset (WBS or HRS) containing the data for which baseline should be fitted. - Spectrum in SimpleSpectrum format. Waveunit needs to be GHz.

List backends [INPUT, OPTIONAL, default=['WBS-H,WBS-V, HRS-H, HRS-V']]

Backends to process. Subset of default list, for example ['WBS-H', 'WBS-V'], or ['HRS-H'], or ['WBS-V-LSB', 'HRS-H-USB'] DEFAULT: ['WBS-H', 'WBS-V', 'HRS-H', 'HRS-V'] which is the same as ['WBS-H-LSB', 'WBS-H-USB', 'WBS-V-LSB', 'WBS-V-USB', 'HRS-H-LSB', 'HRS-H-USB', 'HRS-V-LSB', 'HRS-V-USB']

Integer order [INPUT, OPTIONAL, default=2]

Order of polynomial to fit,

Integer domask [INPUT, OPTIONAL, default=1]

1 0: for no masking 1: for manual masking 2: for automatic masking.

Integer minChannels [INPUT, OPTIONAL, default=10]

When automated masking is enabled (domask=2), ignore masks that consist of less channels than minChannels.

Integer wingChannels [INPUT, OPTIONAL, default=20]

When automated masking is enabled (domask=2), extend the mask on either side by wingChannels channels to take into account weak wings

Integer movemasks [INPUT, OPTIONAL, default=0]

0: masks are only used for spectrum they are defined in 1: move masks between spectra of same sideband (previously 'False') 2: move masks between spectra and sidebands by determining which sideband the masked line is in (previously 'True').

Boolean doreuse [INPUT, OPTIONAL, default=True]

Reuse masks specified previously for the LSB datasets for the equivalent USA datasets if doreuse = True.

Boolean doglue [INPUT, OPTIONAL, default=False]

Fit all subbands in a spectrum simultaneously if doglue = True.

Boolean restart [INPUT, OPTIONAL, default=True]

Continue fitting baselines where user left off previously if restart = True.

String basemode [INPUT, OPTIONAL, default=False]

'sub' basemode = 'sub': subtract fitted baseline from original spectrum (resulting continuum is 0) basemode = 'div': divide original spectrum by fitted baseline (so resulting continuum is 1)

TableDataset maskTable [INPUT, OPTIONAL, default=no default value]

MaskTable product containing previously-determined masks. By default, maskTable found in ObsContext is used.

ObservationContext obsContext [INPUT, OPTIONAL, default=no default value]

ObservationContext from which the maskTable will be read, and in which the maskTable and fitProduct will be saved. This is useful if the user provides a HifitimelineProduct or SpectrumDataSet as 'obs' input, because the maskTable and fitPRoduct can only be stored in ObservationContexts. By default: -if obs is ObservationContext: read/write masTable and FitProduct from/to obs -if obs is HTP or SDS: no maskTables ot FitProducts are read or written.

Double smoothResolution [INPUT, OPTIONAL, default=2]

Only applies if domask=2 has been set. Resamples the data to resolution in MHz, which makes the automated masking faster. The drawback is that larger values lead to masking of noisy peaks rather than real lines.

Boolean interactive [INPUT, OPTIONAL, default=True]

When set to True [DEFAULT], the user will be asked to inspect the plots and fits, and the task can be stopped at any stage. When set to False, masks and poly orders are taken from the input.

Boolean useWbs [INPUT, OPTIONAL, default=False]

When set to True, the polynomial fits to the WBS modules are applied to HRS.

Boolean plot [INPUT, OPTIONAL, default=False]

Option to plot in non-interactive mode

Boolean addMedianContinuum [INPUT, OPTIONAL, default=False]

Option to add back in the continuum after fitting the baseline

Boolean replaceWeights [INPUT, OPTIONAL, default=False]

When set to True, the weight values for each channel are replaced by 1/rms^2, with rms measured within a segment excluding the masked lines and after the baseline has been subtracted. These new actual weights may improve the deconvolution process for spectral scans.

HifiSpectrumDataset|HifiTimelineProduct|ObservationContext|SimpleSpectrum result [OUTPUT, MANDATORY, default=no default value]

OPTIONAL, no default value If the input was 'sds', 'htp', 'obs', or 'simpleSpectrum' then 'result' is baseline subtracted from sds, htp, or obs. Otherwise it is None.

See also