ADMITSegmentFinder — Finds segments of emission within a spectrum.¶
This module defines the class for spectral line segment detection.

class
admit.util.segmentfinder.ADMITSegmentFinder.
ADMITSegmentFinder
(**keyval)[source]¶ Define segments of ‘line’ emission where segments from data appear to be above a threshold. This routine comes out of ASTUTE, some parameters below are hardcoded.
Parameters: freq : float array
Frequencies, GHz.
spec : float array
The y component of the spectrum (arbitrary units, could be linear, could be log).
f : float
Robustness parameter [1.5].
pmin : float
Signal above cuttoff, rmean+pmin*rstd.
minchan : int
Minimum number of channels needed for a line.
maxgap : int
Allowed channels with signal below cutoff [0].
nomean : bool
Remove the mean from any noise and cutoff calculations. This is useful if PVCorr based spectra are being processed to get a correct noise level. Default: False.
Returns: 4tuple
channel_segments[], cutoff, noise, mean
Methods
find
()Method that does the segment finding line_segments
(spec, cutoff)Method to find segments that where lines are located set_options
(\*\*keyval)Set the options for the line finding algorithm. 
find
()[source]¶ Method that does the segment finding
Parameters: None
Returns: Tuple containing a list of the segments, the cutoff used, the
noise level, and a mean baseline.

line_segments
(spec, cutoff)[source]¶ Method to find segments that where lines are located [ [start1,end1], [start2,end2], ....]
This function assumes you’ve subtracted a possible continuum (see the nomean parameter), and applied the absolute value, because this routine only segments above the cutoff.
Need some explanation on the use of abs here.
Parameters: spec : numpy array (with a mask)
The spectrum to analyze
cutoff : float
The cutoff to use (line segments must be higher than this value)
Returns: List of segment start and end channels, e.g. [[10,20],[30,40]]

set_options
(**keyval)[source]¶ Set the options for the line finding algorithm.
Parameters: freq : float array
Frequencies, GHz.
spec : float array
The y component of the spectrum (arbitrary units, could be linear, could be log)
f : float
Robustness parameter [1.5]
pmin : float
Signal above cuttoff, rmean+pmin*rstd
minchan : int
Minimum number of channels needed for a line
maxgap : int
Allowed channels with signal below cutoff [0]
