SegmentFinder — Top-level spectral emission segment finder.¶
This module defines base segment finder for ADMIT. It calls the requested segment finder.
-
class
admit.util.segmentfinder.SegmentFinder.
SegmentFinder
(spectrum, freq, method, minchan, maxgap, numsigma, iterate=False, noise=None, nomean=False)[source]¶ This class is used to find segments of emission in spectra. It calls the requested segment finder and can iterate over the inputs to find both wider weaker segments as well as stronger narrower ones. The iteration is done by conserving the product of numsigma * minchan. The first run keeps both values as they were input, subsequent runs decrease the minchan by 1 and increase numsigma so that the product is conserved. This is repeated as long as minchan > 1. The results of the iterations are merged together and a single list of channel ranges is returned.
Parameters: spectrum : array like
The input spectrum from which the segments are detected.
freq : array like
The frequency axis of the spectrum, must have the same length as spectrum.
method : str
The segment finding method to use (e.g. “ADMIT”, “ASAP”).
minchan : int
The minimum number of channels that a segment must span.
maxgap : int
The maximum number of channels below the cutoff, to allow in the middle of a segment. Gaps larger than this will start a new segment.
numsigma : float
The minimum number of sigma a channel must be in order to consider it part of a segment.
iterate : bool
If True then iterate over the minchan and numsigma to detect stronger, but narrower lines. Default: False.
Attributes
spectrum (array like) The input spectrum from which the segments are detected. freq (array like) The frequency axis of the spectrum, must have the same length as spectrum. method (str) The segment finding method to use (e.g. “ADMIT”, “ASAP”). minchan (int) The minimum number of channels that a segment must span. maxgap (int) The maximum number of channels below the cutoff, to allow in the middle of a segment. Gaps larger than this will start a new segment. numsigma (float) The minimum number of sigma a channel must be in order to consider it part of a segment. iterate (bool) If True then iterate over the minchan and numsigma to detect stronger, but narrower lines. area (float) The area (numsigma * minchan) which is conserved while iterating. Methods
find
()Method to find segments in the input spectrum, using the given method. -
find
()[source]¶ Method to find segments in the input spectrum, using the given method. If iterate is set to True then the segment finder is called multiple times, each run decreasing the minchan by one and increasing numsigma (while conserving the product of the two), until minchan = 1, then the cycle is stopped (single channel spikes, no matter how strong, will not be detected).
Parameters: None
Returns: Four items: list of the segment start and end points, the cutoff, the noise
of the spectrum, and the mean of the spectrum.
-