1.67. doSubtractMedian

Full Name: herschel.hifi.dp.deconvolution.DoSubtractMedianTask
Alias: doSubtractMedian
Type: Java Task - Java Task
Import: from herschel.hifi.dp.deconvolution import DoSubtractMedianTask
Category

HIFI/Pipeline/Interactive Pipeline

Description

Subtract the median from all spectra in the HTP.

Examples

Example 1: simple use doSubtractMedian
obs=getObservation("1342181160",useHsa=1)
htp=obs.getProduct("level2").getProduct("WBS-H-USB")
htp=doSubtractMedian(htp=htp)
Example 2: # Use of the bins inputs:
obs=getObservation("1342181160",useHsa=1)
htp=obs.getProduct("level2").getProduct("WBS-H-USB")
#Divide the subband in 3 bins, compute the median using 2nd and 3rd bin,
# e.g.  for 1st band is equal to sorted channels range [755,2264]
htp2=doSubtractMedian(htp=htp.copy(),bins=3, start=1, end=3 )
#Divide the subband in 3 bins, compute the median using 2nd
htp2=doSubtractMedian(htp=htp.copy(),bins=3, start=1, end=2 ) 
#the subband median will be always 0, i.e. the Task doesn't change anything.
htp2=doSubtractMedian(htp=htp.copy(),bins=3, start=1, end=1 ) 
#Divide the subband in 3 bins, compute the median using 1st bin
htp2=doSubtractMedian(htp=htp.copy(),bins=3, start=0, end=1 )
#Divide the subband in 3 bins, compute the median using 1st and 2nd  bin
htp2=doSubtractMedian(htp=htp.copy(),bins=3, start=0, end=-1 ) 
#Divide the subband in 7 bins, compute the median using from 2nd to 6th bin,
# e.g. for 1st band is equal to sorted channels range [648,1944]
htp2=doSubtractMedian(htp=htp.copy(), bins=7, start=-5, end=-1)
#Divide the subband in 7 bins, compute the median using from 2nd to 7th  bin
htp2=doSubtractMedian(htp=htp.copy(), bins=7, start=-5, end=0)
#Divide the subband in 7 bins, compute the median using from 2nd to 7th  bin
htp2=doSubtractMedian(htp=htp.copy(), bins=7, start=-5, end=15)
#Compute standard median
htp2=doSubtractMedian(htp=htp.copy(), bins=0)
Example 3: use of the Mask
# Masks: The example below Compute  median with  using dafault  bins ( from 3 to 8 on a total 100 bins),
# and ignore all the channels that have a flag that indicate a "line" or "bright line" or "data to ignore".
# Note that all other flags e.g SPUR_CANDIDATE or BAD_PIXEL ,etc..   will be not used, e.g if data
# contains a bad pixel it will be used to compute the Median as all other channels.
obs=getObservation("1342181160",useHsa=1)
htp=obs.getProduct("level2").getProduct("WBS-H-USB")
myMask=HifiMask.BRIGHT_LINE | HifiMask.LINE | HifiMask.IGNORE_DATA
htp2=doSubtractMedian(htp=htp.copy(), mask=myMask)

API details

Properties

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

Provide the HifiTimelineProduct, the median will be subtracted.

Int mask [INPUT, OPTIONAL, default=all flags]

Series of flag that should be honored when median is computed default value is: .

BAD_PIXEL | SATURATED | NOT_OBSERVED | NOT_CALIBRATED | GLITCHED | DARK_PIXEL | SPUR_CANDIDATE | LINE | BRIGHT_LINE | IGNORE_DATA

Int bins [INPUT, OPTIONAL, default=100.]

the number of bins where the flux sorted will be divided, then the median will be computed between the bin "start" and the bin "end", i.e between sorted channel in the range [start*width, end*width) where width= ((length of valid channel) / (bins)) rounded to the nearest highest integer .

If width =0 normal median an all channels is used. If start=end median is = 0.

Int start [INPUT, OPTIONAL, default=3 .]

The first bin to be used to compute the median. Start counting from 0. If "start" value > 0 it is shifted to |bins| +start until become positive or zero

Int end [INPUT, OPTIONAL, default=8.]

The last bin with width of "width" channels to be used to compute the median. Start counting from 0.

If "end" value >= 0 it is shifted to |bins| +end until "end" become positive.

If "end" > "bins" the selection arrive up to the latest channel.

See also