ASAPSegmentFinder — Finds segments of emission within a spectrum.¶
This module defines the class for spectral line segment detection.
-
class
admit.util.segmentfinder.ASAPSegmentFinder.
ASAPSegmentFinder
(**keyval)[source]¶ The AdmitLineFinder class inherits from the asap linefinder class. It takes a spectrum (list, CubeSpectrum_BDP, or CubeStats_BDP) and turns it into a scantable. The scantable is then search for spectral lines, with the given parameters.
Parameters: name : string
Name of the temporary scantable file. Default: “”.
spec : various
Input spectrum, can be a list, CubeSpectrum_BDP, or CubeStats_BDP. Default: None.
Attributes
nchan (int) Number of spectral channels. name (string) Name of the temporary scantable. spectrum (list) Spectrum to be analyzed. lines_merged (list) Merged list of overlapping lines. tb (casa table) Casa table that is converted to a scantable. Methods
find
(\*\*keyval)Method to do the actual searching find_lines
([nRow, mask, edge])Search for spectral lines in the scan assigned in set_scan. get_mask
([invert])Get the mask to mask out all lines that have been found (default) get_merged_ranges
()Get a list of merged line ranges. get_ranges
([defunits])Get ranges (start and end channels or velocities) for all spectral lines found. init
()Create dummy scantable to work with linefinder. makepairs
(inp)Method to turn a list into a list of pairs merge_lines
(lines[, frac])Merge lines if those are close enough. set_data
(spectrum)Set the ‘data’ (spectrum) to work with Parameters: a method to allow linefinder work without setting scantable for the purpose of using linefinder inside some method in scantable class. set_options
(\*\*keyval)Set the options for the linefinding algorithm. set_scan
(scan)Set the ‘data’ (scantable) to work with. set_spectrum
()Set the spectrum you want to search for lines. -
find
(**keyval)[source]¶ Method to do the actual searching
Parameters: merge : Boolean
Whether or not to merge overlapping lines Deafult: False
Returns: tuple containing the frequency ranges, channel ranges, and rms, and mean (forced 0.0)
-
get_merged_ranges
()[source]¶ Get a list of merged line ranges.
Parameters: None Returns: List of merged lines
-
init
()[source]¶ Create dummy scantable to work with linefinder.
Parameters: None Returns: None Notes
Should not be directly called.
-
makepairs
(inp)[source]¶ Method to turn a list into a list of pairs
Parameters: inp : list
The list to convert
Returns: List of pairs.
-
merge_lines
(lines, frac=0.25)[source]¶ Merge lines if those are close enough.
Parameters: lines: list
line list detected by linefinder algorithm
frac: float
Criterion for merge as a fraction of line width for narrower line. Default: 0.25
Returns: The new number of lines
-
set_options
(**keyval)[source]¶ Set the options for the linefinding algorithm.
Parameters: threshold : float
A single channel S/N ratio above which the channel is considered to be a detection. Default is sqrt(3), which together with min_nchan=3 gives a 3-sigma criterion. Default: sqrt(3)
min_chan : int
A minimal number of consequtive channels, which should satisfy the threshold criterion to be a detection. Default: 3
avg_limit : int
A number of consequtive channels not greater than this parameter can be averaged to search for broad lines. Default: 8
box_size : float
A running mean box size specified as a fraction of the total spectrum length. Default: 0.2
noise_box : string/float
Area of the spectrum used to estimate noise stats. Both string values and numbers are allowed. Allowed string values: ‘all’ use all the spectrum, ‘box’ noise box is the same as running mean/median box Numeric values are defined as a fraction from the spectrum size. Values should be positive. (noise_box == box_size has the same effect as noise_box = ‘box’). Default: ‘all’
noise_stat : string
Statistics used to estimate noise, allowed values: ‘mean80’ use the 80% of the lowest deviations in the noise box, ‘median’ median of deviations in the noise box Default: ‘mean80’
Returns: None
-