1.81. fitHifiFringe

Full Name: herschel.hifi.dp.standingwaves.FitHifiFringeTask
Alias: fitHifiFringe
Type: Java Task - Java Task
Import:

import herschel.hifi.dp.standingwaves.FitHifiFringeTask

Categories

HIFI/Analysis

HIFI/Pipeline/Interactive Pipeline Steps

Description

This task fits and subtracts a set of sine waves to standing waves in

level 2 HIFI SpectrumDataset (WBS or HRS), or in level 2 HifiTimelineProducts or ObservationContexts. In the fitting process a smooth baseline is automatically determined by masking narrow spectral features. It is a user-friendly wrapper for the fitFringe() task to use HIFI data rather than generic SpectralSegments as input and output. It also uses typical HIFI units and defaults.

Example

Example 1: FitHifiFringeTask
from herschel.hifi.dp.standingwaves import FitHifiFringeTask
obs = getObservation(1342181160, useHsa=True)
fhf=FitHifiFringeTask()
out,swTable=fhf(data=obs,product="WBS-H-USB",sdsIndex=7,nfringes=3,startPeriod=20.0,endPeriod=3000.0,\
   typicalPeriod=150.0,plot=0,doglue=Boolean.TRUE,subBase=Boolean.FALSE)
# output table
t=out.refs["calibration"].product.refs["pipeline-out"].product.refs["StandingWaves_WBS-H-USB"].product["swTable"]
print t['amplitude'].data[0]#0.00939867498289
print swTable['amplitude'].data[0] #0.00939867498289
del(obs,t,swTable,out)

API details

Properties

HifiTimelineProduct | ObservationContext | HifiSpectrumDataset | SimpleSpectrum | SimpleCube data [INPUT, OPTIONAL, default=none]

- HIFI ObservationContext or level 2 HifiTimelineProduct (WBS or HRS) OPTIONAL, no default value Note on input data: if multiple inputs are given, only one will be used. Obs1 has precedence over htp1, which has precedence over sds1 - Level 1 or level 2 HIFI SpectrumDataSet (WBS or HRS) - Spectrum in SimpleSpectrum format. Waveunit needs to be GHz. - Spectrum in Cube format. Waveunit needs to be GHz

MapContext cal [INPUT, OPTIONAL, default=none]

A root of a Calibration tree where the Task can retrieve input parameters.

Boolean saveInput [INPUT, OPTIONAL, default=True]

Save input parameters to a fitHifiFringeParameter table in the Calibration tree.

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

If the input is an ObservationContext, indicate which level 2 product needs to be processed. Options are: 'WBS-H-USB', 'WBS-H-LSB''WBS-V-USB', 'WBS-V-LSB''HRS-H-USB', 'HRS-H-LSB''HRS-V-USB', 'HRS-V-LSB'

Integer sdsIndex [INPUT, OPTIONAL, default="-1"]

index of SpectrumDataset in a product to process. An index can be determined by listing the product in the Context viewer. This option is irrelevant if the input is an sds. [DEFAULT: sds_index=-1, which means process all SpectrumDatasets present in a product]

Integer nfringes [INPUT, OPTIONAL, default="1"]

number of sine waves to fit

Double startPeriod [INPUT, OPTIONAL, default="20"]

shortest-period standing wave (in MHz) to search for

Double endPeriod [INPUT, OPTIONAL, default="3000"]

longest-period standing wave (in MHz) to search for

Double typicalPeriod [INPUT, OPTIONAL, default="150"]

typical standing wave period (in MHz) in the data. This is used for the baseline determination. Features with much longer periods are considered baseline structure and will not be removed with sine waves. longest-period standing wave (in MHz) to search for

Integer plot [INPUT, OPTIONAL, default="2"]

-plot=0: no plotting at all, -plot=1: one chi^2 plot and one before/after plot for each of N scans, so the user ends up with 2*N plot windows on the screen -plot=2: one chi^2 plot and one before/after plot for a scan a popup box with 2 buttons, "NEXT" and "NON-STOP" -NEXT: delete plot windows for previous scan and create plot windows for next scan -NON-STOP: process all remaining scans without further plotting.

Boolean doglue [INPUT, OPTIONAL, default="Boolean.TRUE"]

Determine SW on individual sub-band spectrum. This is desired for HRS, but often not for WBS, as long period SW can only be determined on the combined spectrum.

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

Mask frequency ranges in addition to the automatically determined mask. Example: usermask=[(537.0,538.0), (539,539.5)] masks the ranges 537-538 GHz and 539-539.5 GHz

Boolean avermask [INPUT, OPTIONAL, default="Boolean.FALSE"]

Determine the mask on the average of all scans and then apply this mask to each scan. This reduces the amount of work for large maps a lot. It also should give more accurate masks as the average spectrum has better signal-to-noise. Spectra with different LO settings will not be averaged, so this option does not work for spectral scans.

Boolean addMedianContinuum [INPUT, OPTIONAL, default=False]

Option to add back in the continuum after fitting the baseline

Boolean subBase [INPUT, OPTIONAL, default="Boolean.FALSE"]

Subtract the 'smooth baseline' from the output data in addition to the sine waves. ***This is dangerous as the smooth baseline may contain spectral information.

Boolean automask [INPUT, OPTIONAL, default=Boolean.True]

- Automatically mask data points DEFAULT: TRUE. The automatically defined mask is added to any user-defined mask. - If set to FALSE, only the user-defined mask is used.

Object flags [INPUT, OPTIONAL, default="128"]

Data points with these flag values will be excluded from the calculations [DEFAULT:128 (SPUR_CANDIDATE)]. Data with flag values 1,2,8,64,and 1073741824 will always be ignored.

HifiSpectrumDataset result [OUTPUT, OPTIONAL, default=no default value]

Sine-wave subtracted output product, of the same type as the input (ObsContext, HifiTimelineProduct or HifiSpectrumDataset). For SpectrumDatasets: fhf = FitHifiFringeTask() result,swTable=fhf(data=sds_in) or HifiTimelineProducts: fhf = FitHifiFringeTask() result,swTable=fhf(data=htp_in) [gives output=None] or ObservationContext result,swTable=fhf(data=obs_in) [gives output=None] or SimpleCube result,swTable=fhf(data=cube_in) [gives output=None]

See also

History

  • 2009-09-10 v0.0 10/Sep/2009 A. Boogert/J. Xie: created for inclusion in HIPE 1.2
  • 2009-10-02 # v0.1 02/Oct/2009 A. Boogert/J. Xie: by default do not determine SW on
  • # average of scans. Loop over all scans in SDS. Added averscan
  • # option, and if set to True it will determine an average.
  • 2009-10-22 # v0.2 22/Oct/2009 M. Melchior/A. Boogert: more robust level 1/2 check and
  • # spectral segment construction
  • 2009-11-04 # v0.3 04/Nov/2009 A. Boogert: improved output list of fitted sine waves
  • 2009-11-05 # v0.4 05/Nov/2009 A. Boogert: correct error in loop over scans
  • 2009-11-11 # v0.5 11/Nov/2009 A. Boogert: -move Color import statement together with other
  • # import statements
  • # -plot=False really does not plot anything
  • # -plot before/after data at original resolution
  • # -add chisq to output listing
  • # -sds1 is HifiSpectrumDataset, so that both WBS
  • # and HRS data can be processed. Added appropriate
  • # HrsSpectrumDataset import statement
  • # -removed large set of commented out test commands
  • 2009-11-11 # v0.5 11/Nov/2009 A. Boogert: added doglue option
  • 2009-11-19 # v0.6 19/Nov/2009 A. Boogert: changed plot type from Boolean to Integer
  • 2010-01-27 # v0.7 27/Jan/2010 A. Boogert: check for exception errors in flags and weights
  • # selection from segments. This way no backend checking
  • # is needed and also Tsys data can be processed
  • # (see SPR HIFI-3200)
  • 2010-02-1 # v0.8 11/Feb/2010 A. Boogert: -allow ObservationContexts and HTPs in addition to
  • # datasets as input and output [SCR HIFI-3181]
  • # -more user-friendly input parameters start_period,
  • # end_period, typical_period replacing ncycle, cycle,
  • # midcycle [SCR HIFI-3261]
  • # -added usermask option [SCR HIFI-3262]
  • 2010-04-23 # v0.9 23/Apr/2010 A. Boogert: check for RuntimeExceptions
  • 2010-05-03 # v0.91 03/May/2010 A. Boogert:make independent of different HIPE 2/3 context structure
  • 2010-05-02 # v0.92 11/May/2010 A. Boogert:put fit parameters in obscontext table [SCR HIFI-3199]
  • 2010-07-13 # v0.93 13/Jul/2010 A. Boogert:implemented sub_base option [SCR HIFI-3679]
  • 2010-09-10 # v0.94 10/Sep/2010 A. Boogert:-implemented better error reporting [SPR HIFI-3693]
  • # -added GUI parameter description by filling in
  • # p.setDescription [SCR HIFI-3697]
  • # -added jalias information provided by Annie
  • # [SCR HIFI-3696]
  • 2010-10-11 # v0.95 11/Oct/2010 A. Hoac: make sure usermask input in GUI works [SPR HIFI-3761]
  • 2010-11-19 # v0.96 19/NOV/2010 A. Hoac: usermask gui disappeared[SPR HIFI-3761]
  • 2010-12-02 # v0.97 02/DEC/2010 A. Hoac: Added deprecated tag and message[SPR HIFI-3682]
  • 2010-12-02 # v0.98 22/DEC/2010 A. Boogert: Added sds_index input [SPR HIFI-3785]
  • 2011-01-04 # v0.99 04/JAN/2011 A. Boogert: Added "automask" to enable/disable masking [SPR HCCS-9893]
  • 2011-03-01 # v0.100 01/MAR/2011 A. Hoac: Added plot option "2" [SCR HIFI-3844]
  • 2011-03-03 # v0.101 03/MAR/2011 A. Boogert: Some FitHifiFringe masks displaced from bright lines [SPR HIFI-3719]
  • 2011-03-03 # v0.102 03/MAR/2011 A. Hoac: Remove averscan option from FitHifiFringe [SPR HIFI-3949]
  • 2011-21-03 # v0.103 14/MAR/2011 J.Xie: and A. Hoac: FitHifiFringe should be applicable to HTPs[SCR HIFI-3695]
  • HIFI tasks shown as applicable to PACS or SPIRE observation (context) [SPR HIFI-3864]
  • 2011-25-03 # v0.104 25/MAR/2011 A. Hoac:HIFI-3982:Allow for zooming plot windows with new plot=2 option FitHifiFringe
  • 2011-07-04 # v0.105 07/APR/2011 A. Hoac: FitHifiFringe crashes for obscontexts without calibration product
  • 2011-28-04 # v0.106 28/APR/2011 A. Hoac: HIFI-4016: Task Compliancy: make tasks more user-friendly (HCSS-12676)
  • 2011-29-04 # v0.107 29/APR/2011 A. Hoac: HIFI-4073: Java test harness coverage for this module needs to be 80%)
  • 2011-06-05 # v0.108 06/MAY/2011 A. Hoac: HIFI-4109:Added @jcategory HIFI/Analysis
  • 2011-16-05 # v0.109 16/MAY/2011 A. Hoac:HIFI-3974 Confusing reaction of FitHifiFringe when entering usermask as array
  • 2011-22-06 # v0.110 22/JUN/2011 A. Hoac: HIFI-4262: FitHifiFringe sub_base=True option leads to
  • platforming for bands 6 and 7
  • 2011-07-07 # v0.111 07/JUL/2011 A. Hoac: HIFI-4275: FitHifiFringe fails for HRS-V-LSB product
  • 2011-13-07 # v0.112 03/AUG/2011 A. Hoac: HIFI-4186:Variable result_sds should not be created if FitHifiFringe
  • is run from the GUI with obs_or_htp input
  • 2011-09-08 # v0.113 09/AUG/2011 A. Hoac: HIFI-4109:Added @jcategory HIFI/Pipeline/Interactive Pipeline Steps
  • 2011-11-08 # v0.114 11/AUG/2011 A. Hoac: HIFI-4317: Changed to ResampleFrequencyTask and AverageSpectrumTask
  • 2011-27-09 # v0.115 27/SEP/2011 A. Boogert: HIFI-4187: Introduce average mask option in FitHifiFringe
  • 2011-06-12 # v0.116 06/DEC/2011 A. Hoac: HIFI-4338: Improve handling of pipeline flags in FitHifiFringe
  • $Id: FitHifiFringeTask.java,v 1.96.2.3 2016/10/21 14:15:29 andrea Exp $
  • $Log: FitHifiFringeTask.java,v $
  • Revision 1.96.2.3 2016/10/21 14:15:29 andrea
  • HIFI-6387/6389 FitHifiFringe: corrected the method getStitched to return the correct Stitched spectrum
  • Revision 1.96.2.2 2016/10/21 13:05:11 andrea
  • HIFI-6387/6389 FitHifiFringe: for plot when use average mask,
  • access to subband with .getSegmentIndices()
  • Revision 1.96.2.1 2016/10/17 14:50:33 andrea
  • HIFI-6387/6389 FitHifiFringe:
  • FitFringeData created with subband index determined from the .getSegmentIndices()
  • Revision 1.96 2016/07/28 13:30:19 andrea
  • HIFI-6349 problem in the GUI "next" button solved.
  • Revision 1.95 2016/07/27 17:06:15 andrea
  • HIFI-6349 Removed or reduced Cyclomatic Complexity of methods.
  • Revision 1.94 2016/02/01 14:33:33 andrea
  • Removed Sonar issues. 1 residual Sonar present due to limitation of URM help.
  • Revision 1.93 2015/07/25 01:57:46 kevin
  • HIFI-5832 New option for FHF: baseline correction with median continuum re-injected
  • Revision 1.92 2015/07/10 04:13:31 kevin
  • HIFI-6102 FHF crashes ungracefully on a dataset
  • Revision 1.91 2015/06/10 17:45:57 kevin
  • HIFI-6117 Failure of FitHifiFringe in a SpectralSimpleCube
  • Revision 1.90 2015/05/18 23:31:38 kevin
  • HIFI-5832 New option for FHF: baseline correction with median continuum re-injected
  • Revision 1.89 2015/02/11 23:09:01 ahoac
  • HIFI-6012: FitHifiFringe does not load default values according to the band for a SimpleSpectrum
  • Revision 1.88 2015/02/11 18:47:53 andrea
  • HIFI-5857 FHFSignatureComponent implements the interface EnableParametersInterfac
  • FitHifiFringeTask hidden input: OUTPUTNAMES updated with the actual default results "htp,myTable"
  • Revision 1.87 2015/02/11 18:20:52 ahoac
  • HIFI-5998 FitHifiFringe gives an error when processing doDecon SimpleSpectrum ssb
  • Added code to handdle HIFI-5214.
  • Revision 1.86 2015/02/04 23:07:31 ahoac
  • HIFI-5998 FitHifiFringe gives an error when processing doDecon SimpleSpectrum ssb
  • Revision 1.85 2015/01/21 17:13:49 ahoac
  • HIFI-5921 fitHifiFringe GUI parameters text need to be updated
  • Collapsed text.
  • Revision 1.84 2015/01/13 21:19:58 ahoac
  • HIFI-5921 fitHifiFringe GUI parameters text need to be updated
  • Revision 1.83 2015/01/13 17:41:07 ahoac
  • For HIFI-5929, changed the parameter's description text.
  • Revision 1.82 2014/11/25 18:50:22 ahoac
  • HIFI-5921 fitHifiFringe GUI parameters text need to be updated
  • Revision 1.81 2014/11/07 22:58:49 ahoac
  • HIFI-5823: Add option in fitHifiFringe to extract user input parameters into the calTree for later use on demand
  • Changed text in the message.
  • Revision 1.80 2014/11/06 20:08:46 ahoac
  • HIFI-5823: Add option in fitHifiFringe to extract user input parameters into the calTree for later use on demand
  • Handled the userMask.
  • Revision 1.79 2014/11/05 18:33:12 ahoac
  • HIFI-5823: Add option in fitHifiFringe to extract user input parameters into the calTree for later use on demand
  • Fixed the case when saveInput = False with cal
  • Removed message when no cal
  • Revision 1.78 2014/10/22 22:56:54 ahoac
  • HIFI-5823: Add option in fitHifiFringe to extract user input parameters into the calTree for later use on demand
  • Changed saveInput's default value False.
  • Updated createDate to be endDate for swTable and fitHifiFringeParameters.
  • Populate 'fitHififringeParameters" with metaData.
  • Added warning if cal does not contain fitHifiFringe's inputs.
  • Create copy of swTable for LSB.
  • Revision 1.77 2014/09/15 21:25:32 ahoac
  • HIFI-5657 AAT12: fitHififringe should accept Spectrum1d as well as SimpleSpectrum
  • Added error message if 'data' is type Spectrum1d
  • HIFI-5823: Add option in fitHifiFringe to extract user input parameters into the calTree for later use on demand
  • Added code test harness for FHfSignatureComponenet
  • Revision 1.76 2014/09/12 22:35:56 ahoac
  • Uncommented codes to HIFI-5823: Add option in fitHifiFringe to extract
  • user input parameters into the calTree for later
  • use on demand.
  • HIFI-5826: Included two NaN in the length count. Added subband number in
  • the message.
  • Fixed the index.
  • Revision 1.75 2014/09/12 19:54:34 ahoac
  • HIFI-5826 FHF should exit more gracefully upon singular matrix issues
  • Only replaced if it all zero in segment with NaN.
  • Revision 1.74 2014/09/12 16:55:25 ahoac
  • HIFI-5826 FHF should exit more gracefully upon singular matrix issues
  • Added warning and skip spectrum for the case problem with not enough valid data.
  • Commented out HIFI-5823.
  • Revision 1.73 2014/09/11 18:56:33 ahoac
  • HIFI-5826 FHF should exit more gracefully upon singular matrix issues
  • Added case where last segement needs to be skip(doglue=true). Also replaced the zeros with NaN.
  • Revision 1.72 2014/09/10 17:36:53 ahoac
  • HIFI-5826 FHF should exit more gracefully upon singular matrix issues
  • Revision 1.71 2014/09/08 19:10:12 ahoac
  • D_HIFI_DP_STANDINGWAVES_0_101 (2014-Sep-08) [AHo]
  • -----------------------------------------
  • HIFI-5823: Add option in fitHifiFringe to extract
  • user input parameters into the calTree for later
  • use on demand
  • Fixed typo typicalPeriod
  • Revision 1.70 2014/09/05 15:55:10 ahoac
  • HIFI-5823: Add option in fitHifiFringe to extract
  • user input parameters into the calTree for later
  • use on demand
  • Handled different format of userMask.
  • Revision 1.69 2014/09/03 23:17:40 ahoac
  • HIFI-5823: Add option in fitHifiFringe to extract
  • user input parameters into the calTree for later
  • use on demand
  • Revision 1.68 2014/08/14 18:44:07 ahoac
  • HIFI-5017 HIFI EDP #9: Fix critical Sonar violations of FitHifiFrindgeTask
  • Add comment and rename method from "getTaskParamValues" to "doFringAlgorithm".
  • Revision 1.67 2014/07/08 17:48:22 ahoac
  • HIFI-5789 Implementation of HIFI-5582 not yet robust enough
  • HCSS-19376: commented out the deprecated plotxy.setBatch
  • Revision 1.66 2014/04/21 16:14:11 ahoac
  • HIFI-5731: Create mutiple output for fitHifiFringe
  • Fixed jexample.
  • Revision 1.65 2014/04/17 20:37:42 ahoac
  • HIFI-5731: Create mutiple output for fitHifiFringe
  • Revision 1.64 2014/04/07 18:08:38 ahoac
  • HIFI-5719:FitHifiFringe: please enable machine-readable output of fitted frequencies and amplitudes
  • Put back the swTable in the obs.
  • Revision 1.63 2014/04/04 17:25:39 ahoac
  • HIFI-5722: In the swTable, changed amplitude's unit from kHz to K.
  • Revision 1.62 2014/04/03 23:17:44 ahoac
  • HIFI-5719:FitHifiFringe: please enable machine-readable output of fitted frequencies and amplitudes
  • HIFI-5722:fitHifiFringe: swTable has wrong unit for amplitude (kHz instead of K)
  • Revision 1.61 2014/03/19 18:35:31 ahoac
  • HIFI-5672:parameter plot=0 of fitHifiFringe does not suppress plotting
  • Added check for plot = 0 for the mask plot
  • Revision 1.60 2014/03/03 23:41:32 ahoac
  • HIFI-5672:parameter plot=0 of fitHifiFringe does not suppress plotting
  • Revision 1.59 2014/02/07 23:01:48 ahoac
  • HIFI-5017:HIFI EDP #9: Fix critical Sonar violations of FitHifiFrindgeTask
  • Revision 1.58 2014/01/24 20:08:31 ahoac
  • HIFI-5582:FHF crashes on data sets where all channels are flagged
  • Revision 1.57 2014/01/23 21:59:25 ahoac
  • HIFI-5582:FHF crashes on data sets where all channels are flagged
  • Revision 1.56 2013/12/14 00:12:10 ahoac
  • HIFI-5582:FHF crashes on data sets where all channels are flagged
  • Revision 1.55 2013/10/07 16:48:26 ahoac
  • HIFI-4976:Task parameters are not in lower camel case
  • Revision 1.54 2013/09/25 18:05:10 ahoac
  • HIFI-5066 FitHifiFringe and FitBaseline should exit more elegantly in case the data are "empty"
  • Moved flag code to handle the case empty such for cube
  • Revision 1.53 2013/09/24 17:39:47 ahoac
  • HIFI-5214 Remove 'move to next' for last (or single) spectrum
  • Revision 1.52 2013/09/18 22:37:52 ahoac
  • HIFI-5478 : Replace SGFreqRangeModifier by FrequencyRangeModifier
  • Tagged again for INFR-1384
  • HIFI-4976:Task parameters are not in lower camel case
  • - File Modified:
  • FitHifiFringeTask.java
  • Revision 1.51 2013/09/17 22:52:52 ahoac
  • HIFI-4976:Task parameters are not in lower camel case
  • - File Modified:
  • FitHifiFringeTask.java
  • FHFSignatureComponent.java
  • Added new file: FHFSignatureComponentTest.java
  • HIFI-4961: Added testcase for cube
  • Added new file: /test/herschel/hifi/dp/standingwaves/data/1342205481_cube_wbs_h_lsb4.fits
  • - File Modified:
  • /test/herschel/hifi/dp/standingwaves/jake.config
  • Revision 1.50 2013/09/12 21:59:24 ahoac
  • HIFI-5482; saveObservation saves original and not modified products
  • Revision 1.49 2013/09/12 15:55:24 ahoac
  • HCSS-17275: Return a list when tasks have multiple outputs (fixing "new style")
  • Added back validator.
  • Revision 1.48 2013/09/11 22:30:52 ahoac
  • HCSS-17275: Return a list when tasks have multiple outputs (fixing "new style")
  • Collapsed the multiple return to one. Added removal messages in __init__.py
  • Revision 1.47 2013/07/23 16:13:36 ahoac
  • HIFI-5181: FitHifiFringe should exit more elegantly in case the data are "empty"