Full Name: | herschel.hifi.dp.tools.FlagToolTask |
Alias: | flagTool |
Type: | Jython Task -
![]() |
Import: | from herschel.hifi.dp.tools import FlagToolTask |
Category |
FlagTool is a tool for flagging rows and specific channels of HifiSpectrumDatasets.
It currently works for single point observations and spectral surveys. It provides an interactive mode to help the user visualize his/her data in a plot, look through them and flag the regions of interest.
It saves the information about the flags in a mask table in order to reuse them later.
The available flags are:
HifiMask.SPUR_CANDIDATE
HifiMask.LINE
HifiMask.BRIGHT_LINE
HifiMask.IGNORE_DATA
RowMask.SUSPECT_LO
RowMask.IGNORE_DATA
How to use it?
FlagTool provides a graphical interface for flagging the data in the HifiTimelineProduct. This interface is made up of 4 components that allow different actions:
Radio buttons:
Select the wanted channel flag to be used in the plot window
Plot window:
Create masks by dragging with Shift-click.
Disable existing masks by clicking on them.
Use mouse wheel to zoom in and out.
Table:
Plot all the subbands of a given dataset by clicking on the corresponding row of the table
Plot a single subband by right-clicking on the corresponding cell of the table
Toggle the user rowflags by clicking on the corresponding checkbox of the table
Buttons:
Apply FitHifiFringe or FitBaseline
Undo the modifications done on the current dataset
Exit FlagTool
How does it work?
A. With channel flags
Each time a mask is created on the channels:
a flag is set on the selected channels of the SpectrumDataset
the HifiTimelineProduct is updated
a colored marker is created on the selected channels to reflect the flag set (see the section 'Flags and colours')
the mask table ('Linemasks') in the HifiTimelineProduct is updated with the information about the mask
B. With rowflags
Each time a user rowflag is modified:
the rowflag column of the current SpectrumDataset is updated (setting or unsetting the rowflag)
the HifiTimelineProduct is updated
Flags and colours
The available channel flags in flagTool are defined by the HifiMask class. The colors of the masks in flagTool follow the colors of the masks in Spectrum Explorer.
Flag |
Value |
Color |
SPUR_CANDIDATE |
2**7 |
Orange |
LINE |
2**28 |
Pink |
BRIGHT_LINE |
2**29 |
Blue |
IGNORE_DATA |
2**30 |
Green |
For more information, see the wiki about channel flags: http://www.sron.rug.nl/docserver/wiki/doku.php?id=docbook:hifi-um:cflags /
Notes
In the current version of FlagTool, a FITS file (backup_[obsid]_[backend].fits) containing the mask table is created in the directory where HIPE was launched.
It is used as a backup because long flagging sessions may crash for some reasons. Losing all the flags you defined for 3 hours is not pleasant so this backup can help recover the masks previously created.
If the mask table contained in the file is reinjected in your original HifiTimelineProduct, FlagTool will read this table and reapply the corresponding flags to the data.
Example 1: Process WBS-H in level 1 | ||
---|---|---|
|
Example 2: Process WBS-H-USB in level 2 | ||
---|---|---|
|
Example 3: Process WBS-H-USB and use a polynomial of order=3 to fit the baseline | ||
---|---|---|
|
Example 4: Process WBS-H-USB and use 2 sine waves for fitHifiFringe | ||
---|---|---|
|
Example 5: Process WBS-H-USB and and don't display the plot for FitHifiFringe | ||
---|---|---|
|
Example 6: Process the rowflags in WBS-H-USB | ||
---|---|---|
|
Example 7: Process both channel flags and rowflags in WBS-H-USB | ||
---|---|---|
|
Example 8: Process WBS-H-USB in off-spectra | ||
---|---|---|
|
Example 9: Process directly the htp | ||
---|---|---|
|
Jython Syntax |
---|
|
|
ObservationContext obs
[INPUT, OPTIONAL, default=None]
|
|
---|---|
FlagToolTask takes an ObserationContext as prime input parameter (recommended). |
HifiTimelineProduct htp
[INPUT, OPTIONAL, default=None]
|
|
---|---|
FlagToolTask can take an HifiTimelineProduct as input parameter. |
String backend
[INPUT, OPTIONAL, default='WBS-H-USB']
|
|
---|---|
Specify the backend to extract the HifiTimelineProduct to work with. |
String level
[INPUT, OPTIONAL, default=2]
|
|
---|---|
Specify the level of the data. |
Integer order
[INPUT, OPTIONAL, default=2]
|
|
---|---|
Specify the polynomial order for the fitting of the baseline in FitBaseline. |
Integer nfringes
[INPUT, OPTIONAL, default=1]
|
|
---|---|
Specify the number of sine waves for the fitting of the fringes in FitHifiFringe. |
Integer fhfPlot
[INPUT, OPTIONAL, default=2]
|
|
---|---|
Specify the plot options for FitHifiFringe:
|