1.114. mkWbsFreq

Full Name: herschel.hifi.pipeline.wbs.MkWbsFreqTask
Alias: mkWbsFreq
Type: Java Task - Java Task
Import: from herschel.hifi.pipeline.wbs import MkWbsFreqTask
Category

HIFI/Pipeline/WBS Pipeline

Description

Step8: Derive frequency scale from comb spectra.

Remarks:If there will be different Column for odd/even pixel, they have to be merged before Comb Analysis. CalibrationObject request field for COMB :

COMB_LINE_WIDTH =3 ; Width of a line in pixel

COMB_LINES_FREQUENCY_STEP = 100 distance between lines in MHz;

COMB_NUMBER_OF_LINES = 11 Number of lines in each CCD ;

COMB_LINES_STEP = 175 Distance between lines in pixels;

COMB_LINES_STEP_TOLLERANCE =15 Distance tollerance between lines in pixels;

COMB_MAX_N_SPIKE_CHECK = 15 Maximum of number of Spikes allowed before to rise a warning flag;

COMB_GAUSSIAN_RANGE = 20 Range in pixel used used to fit the line (-range,+range);

COMB_POLYNOMIAL_DEGREE = 4 Degree of the polynomial used to calculate the Frequency;

COMB_NOISE_RANGE = COMB_LINES_STEP/8;

COMB_START_CCD = 20; begin of CCD when start to search lines

COMB_END_CCD = 2027; end of CCD when start to search lines

COMB_THRESHOLD = 4000; Minimum value allowed to be a line

COMB_CHECK_DR = 3000 Minimum values for Dynamic Range of CCDs

COMB_CHECK_RESOLUTION = 1.1Maximum value for the Resolution of a CCDs in MHz

COMB_CHECK_EFFICIENCY = 35;Minimum value for the efficiency of a CCDs [%]

COMB_CHECK_RIPPLE =10 Maximum value for the ripple of a CCDs [dB]

Provides the general checks and pixels checks on the Combs .

The combCheck contains the result of the method fitCcd

The fitCcd fit a ccd to compute the parameter of the Gaussians.

param: channel an Int1d with the position in the ccd of the lines

param: offsetPixels an int the absolute position of the first pixel of the ccd

param: ccd a Double1d value

param: offsetFreq a double the frequency of the first line

return: a CompositeDataset the result of the fit, it contains:

- MetaData: "dynamic range",QWbsCcd.EFFICIENCY,"ripple","RMS of (real comb freq - fit)" (DoubleParameter)s

- TableDataset StringKeyWords.GAUSSIAN with the Columns:"Standard Deviation",StringKeyWords.AMPLITUDE ,StringKeyWords.RESOLUTION,StringKeyWords.POSITION,StringKeyWords.POWER,StringKeyWords.FREQUENCY.

- TableDataset "polynomials" with the Columns:"C: pixel=polynomial(nu,C)" ,"C: frequency=polynomial(pixel,C)".

- ArrayDataset "comb fitted" The fitCcd method use the following algorithm:

For each line a number of pixel equals to 2*DefaultValues.COMB_GAUSSIAN_RANGE +1 are selected, we refer to this selection as LineCut.

Then to each LineCut is subtracted its minimum value.

Then each LineCut is fitted with the LevenbergMarquardtFitter with a GaussModel.

From each StringKeyWords.GAUSSIAN fit are calculated: StringKeyWords.STDDEV, StringKeyWords.AMPLITUDE,StringKeyWords.RESOLUTION,StringKeyWords.POSITION ,StringKeyWords.POWER,StringKeyWords.FREQUENCY.

Two "polynomials" are calculated from the StringKeyWords.POSITION and the StringKeyWords.FREQUENCY of the lines to get the pixels in function of the frequencies and to get the frequencies in function of the pixels. The values of the coefficients are put in the "C: pixel=polynomial(nu,C)" and "C: frequency=polynomial(pixel,C)" Columns of the TableDataset"polynomials"

From the difference between the real frequency of the lines and the frequency calculated with the polynomial is calculated the DoubleParameter "RMS of (real comb freq - fit)"

From the ccd the LineCut are removed and than it is calculated the dynamic range and set in the MetaData"dynamic range" as DoubleParameter

From the StringKeyWords.POWER is calculated the power reduced removing the first and last line, then the average is put in the MetaData QWbsCcd.EFFICIENCY as DoubleParameter.

From the the power reduced maximum and minimum is calculated the Ripple [db]: 10 *ln(maxPower/minPower) and put it in MetaData"ripple" as DoubleParameter.

The gaussian calculated from the fitter are put in the "comb fitted"ArrayDataset.

Examples

Example 1: In HIPE:
from herschel.hifi.pipeline.wbs import *
hdf=AccessDataFrameTask()(obsid=obsid,apid=1030)
spectra=WbsSpectrumDataset(hdf) spectra =
DoWbsScanCountTask()(htp=spectra) #step 1
calPixel=MkWbsBadPixelsTask()(htp=spectra,badPixel=MyBadPixelMask) #step 2
spectra = DoWbsBadPixelsTask()(htp=spectra,cal=calPixel,apply=1 ) #step 3
dd=DoWbsDarkTask() #step 4
spectra = dd(htp=spectra,darkKind=LongParameter(DoWbsDarkTask.DARK1_2))
spectra = DoWbsNonlinTask()(htp=spectra,cal=MyTablePolyn) #step 5
mkz=MkWbsZeroTask() #step 6
zeroCal=mkz(htp=spectra,interp=LongParameter(zeroCal.NONE))
zerocheck=mkz.zeroCheck
spectra =DoWbsZeroTask()(htp=spectra,cal=zeroCal) #step 7
mkf=MkWbsFreqTask() #step 8
freqCal=mkf(htp=spectra,interp="PREVIOUS",COMB_FIRST_LINE_POSITION=160,  COMB_LINES_STEP=175,
 COMB_THRESHOLD=500)
combCheck=mkf.combCheck #equivalent to: combCheck=freqCal.check
Example 2: In HIPE:
from herschel.hifi.pipeline.wbs import *
hdf=AccessDataFrameTask()(obsid=obsid,apid=1030)
spectra=WbsSpectrumDataset(hdf)
DoWbsScanCountTask()(spectra) #step 1
calPixel=MkWbsBadPixelsTask()(spectra) #step 2
MkWbsBadPixelsTask()(spectra,calPixel) #step 3
DoWbsDarkTask()(spectra) #step 4
DoWbsNonlinTask()(spectra) #step 5
zeroCal=MkWbsZeroTask()(spectra) #step 6
DoWbsZeroTask()(spectra,zeroCal) #step 7
freqCal=MkWbsFreqTask(spectra) #step 8
Example 3: Use the tuning to set a different minimum of lines detected:
tuning= CalWbsFreqTuning()
freqCal=MkWbsFreqTask(spectra)

API details

Properties

HifiTimelineProduct htp [INPUT, MANDATORY, default=No default value.]

Provides the technical SpectrumDataSet with the Comb that will be used to calculated the Frequency calibration.

String interp [INPUT, OPTIONAL, default="NEAREST"]

Provides the Parameters used to decide which interpolation scheme will be applied to compute the comb fitting.

WbsTrendProduct trend [OUTPUT, OPTIONAL, default=No default value.]

Trend Product for COMBs and Zeros .

Integer combFirstLinePosition [INPUT, OPTIONAL, default=null.]

is deprecated and will be removed in HIPE 11, please use firstLinePosition as parameter name

Integer firstLinePosition [INPUT, OPTIONAL, default=null.]

If the values is different from null overwrite the tuning in Parameter used as CalWbsFreqTuning. It is used to guess for the first line in COMB. Useful when the number of lines automatically detected are lesser then the expected, to guess hypothetical lines.

Integer combLinesStep [INPUT, OPTIONAL, default=null.]

If the values is different from null overwrite the tuning in Parameter used as CalWbsFreqTuning. It is used to guess for distance in pixels between lines in COMB. Useful when the number of lines automatically detected are lesser then the expected, to guess hypothetical lines.

Double combThreshold [INPUT, OPTIONAL, default=null.]

If the values is different from null overwrite the tuning in Parameter used as CalWbsFreqTuning. It is used as threshold for line detection in COMB: as minimum value allowed to be a COMB line.

CalWbsFreq cal [OUTPUT, OPTIONAL, default=No default value.]

Provides the FrequencyCalibration .

CalWbsFreqCheck combCheck [OUTPUT, OPTIONAL, default=no default value.]

Equivalent to: MkWbsFreqTask.cal.check See also the CalWbsFreqCheck for a detailed description.

CalWbsFreqTuning tuning [INPUT, OPTIONAL, default=new CalWbsFreqTuning()]

A Calibration product containing all the parameters needed to fit the combs and the sigma for the cross-correlation wbs-hrs

Boolean normalize [INPUT, OPTIONAL, default=true]

If the coefficients should be computed for normalized pixels position. normalize=True : the coefficients are computed for a polynomial where X is in range ~[-1, 1] for each CCD, normalize=False : the coefficients are computed for a polynomial where X the channel position in range [0,8191]

HifiTimelineProduct hrs [INPUT, OPTIONAL, default=null]

An HifiTimelineProduct of the HRS instrument used to computed the cross-correlation of WBS-HRS. This is used in case COMBs fit fails or if the relative apid is detected. Used in combination with StringKeyWords.HRS2 input.

HifiTimelineProduct hrs2 [INPUT, OPTIONAL, default=null]

An HifiTimelineProduct of the HRS instrument used to computed the cross-correlation of WBS-HRS. This is used in case COMBs fit fails or if the relative apid is detected. Used in combination with StringKeyWords.HRS input.

Boolean use_bad [INPUT, OPTIONAL, default=true]

This parameter decide if the bad Combs should be used in the frequency calibration.

use_bad=false: bad combs (comb where all lines was not found) will not used to compute frequency calibration. If there will be not valid combs a default calibration is set in the output and an error will be raised. use_bad=true: also bad combs (comb where all lines was not found) will used to compute frequency calibration.

See also

History

  • 2005-05-15 - AL: Javadoc and help completed parameter renamed for more compatibility with hrs
  • 2005-07-14 - AL: First implementation completed.
  • 2006-12-07 - AL: converted to HifiTimelineProduct and Calibration Product.
  • 2006-12-21 - AL: Uniformed api to generic branch. Updated documentation