LineID_AT — Identifies molecular lines in spectra.¶
This module defines the LineID_AT class.
-
class
admit.at.LineID_AT.
LineID_AT
(**keyval)[source]¶ Task for detecting and identifying spectral lines from input spectra. All input spectra are assumed to be from the same data set.
See also LineID_AT for design documentation.
The produced LineList_BDP contains a list of all spectral lines, possible identifications, and channel ranges, found in the input spectra. Additionally a spectral plot with overlayed lines is produced for each input spectrum.
The line identification algorithm first looks for segments of spectral line emission. Spectral peaks are then searched for within these regions. Once spectral peaks are located, patterns are searched for (specifically patterns of rotation, expansion, and collapse). Each peak is then matched to ADMIT’s Tier 1 list, which contains the more common molecules and transitions. If no match is found then the CASA task slsearch or the splatalogue database is used to generate a potential line list based on the peak’s frequency and line width. This list is narrowed down to a single identification by comparing the transition energies, constituent atoms, and line strength.
If slsearch finds no results then the line is labeled as unidentified.
- Keywords
- vlsr: float
- VLSR of the source (km/s). Default: -999999.99.
- numsigma: float
- Minimum intensity, in terms of the rms noise of the individual sepctra, to consider a given channel to not be noise. In the case of CubeStats, where the units of the spectra are sigma, this refers to the rms noise of the sigma spectra (noise of the noise). Default: 5.0.
- minchan: int
- Minimum number of consecutive channels above numsigma to consider them part of a line. Default: 4.
- maxgap: int
- The maximum gap to allow between clusters of channels to consider them to be separate lines. Default: 3.
- identifylines: boolean
- If True then attempt to identify any detected spectral lines. If False, then just locate regions of line emission and stop. Lines are now all marked as “U” (unidentified) False is useful if the rest frequency/vlsr are not known. If no vlsr set, this will be forced to be False, if it had been set True. Default: True.
- allowexotics: bool
- If True then do not limit the molecules that can be detected. If False, do not allow transitions from molecules with “exotic” atoms to be included in lists. In this case an exotic atom is one that is uncommon, but possible to be detected in the right environment. The current list of “exotic” atoms is: “Al”, “Cl”, “Mg”, “Mn”, “F”, “Li”, “Na”, “K”, and “Ti”. Default: False.
- recomblevel: string
What level of recombination line searching is requested. Three levels are available
- off no recombination lines are allowed in the results.
- shallow only H and He, alpha and beta lines are allowed in the results.
- deep any recombination line is allowed in the results.
Default: “shallow”.
- segment: string
- The name of the segment finder algorithm to use; choices are: ASAP and ADMIT. (see ASAPSegmentFinder — Finds segments of emission within a spectrum. and ADMITSegmentFinder — Finds segments of emission within a spectrum. for details of each) Default: “ADMIT”.
- online: bool
- If True then use the online splatalogue interface for searching for transitions. If False the use the internal CASA slsearch. You must have an internet connection to use the splatalogue interface. Default: False.
- smooth: list
- Use this parameter to smooth the input spectrum. Format is a list containing the name of the smoothing algorithm followed by the parameters for the algorithm, given in the order they are defined in the documentation. The algorithms are: boxcar, gaussian, hanning, savgol, triangle, and welch. All but savgol take a single integer parameter for the width. See Filter1D — 1-dimensional spectral filtering. for details on the individual algorithms and their keywords. To do no smoothing, set the value to []. Example: [“boxcar”, 7] will do a boxcar smooth with a width of 7. Default: [].
- recalcnoise: bool
- A boolean to indicate whether the noise should be recalculated after smoothing. True indicates that the noise should be recalculated, False indicates that the noise of the unsmoothed spectrum should be used. Default: False.
- method: dictionary
- A dictionary containing the peak finding algorithm(s) to use as the keys (string) and dictionary containing the keyword/value arguments for the algorithm as the value. Available methods are: PeakUtils, FindPeaksCWT, and PeakFinder (see PeakUtils — A peak finding algorithm., FindPeaksCWT — Peak finding with continuous wavelet transforms., and PeakFinder — Peak finding with derivatives. for the specifics of each). If more than one algorithm is given then each will be used in turn. Default: {“PeakFinder” : {“thres” : 0.0, “min_sep” : self.minchan, “min_width” : self.minchan}.
- pattern: str
String indicating if pattern detection is done. Patterns are defined as sets of peaks which have the same separation which is caused by cloud rotation, expansion, etc. A detailed explanation is given in the design documentation. Pattern detection works well so long as there are not too many lines in the spectra. The code can determine whether this criteria has been met. Available modes are:
- ‘ON’ Force pattern find to be on no matter what
- ‘AUTO’ Run pattern detection as long as there are not too many lines
- ‘OFF’ No pattern detection
Default: “AUTO”.
- mode: string
If more than one peak finding algorithms is given in method, how should the results be interpreted. Available modes are:
- ONE Consider a peak to be valid if it was found by any of the
given methods
- TWO Consider a peak to be valid if it was found by at least two
of the methods. (if only 1 method is specified then this choice is ignored)
- ALL Consider a peak to be valid if it was detected by all given
methods.(if only 1 method is specified then this choice is ignored)
Default: “ONE”.
- tier1width: float
- The width over which to search for Tier 1 lines in km/s. Any lines detected within this distance of a Tier 1 line will be identified as that line. Defaults to 300.0 for sources with a VLSR of 150 km/s and above, and 40.0 for sources with a VLSR below 150 km/s.
- csub: list
- The polynomial order to use for fitting the continuum of CubeStats and CubeSpec based spectra. All CubeStats based spectra must be continuum subtracted in order to obtain proper fits (peak, fwhm), but continuum subtraction for CubeSpectrum based spectra is optional. The first argument in the list is the order of polynomial to use for the CubeStats based spectrum and the second is the order of fit to use for CubeSpec based spectra. Default: [1, None] (1st order for CubeStat and no fitting for Cubespec based spectra).
- references: str
- The filename of a references list for optional overplotting in the LineID plots. This is an ASCII file containing two columns: one column of frequencies (a float), and one column of a reference (line, a string). You can specify file references relative to $ADMIT, e.g., references=”etc/ngc253_lines.list” this is preferred to keep scripts portable, but an absolute filename is perfectly legal. Default: “”.
- iterate: bool
- If True then iterate for both the segment finder and the peak finder to make them both sensitive to wide and strong narrow lines. Default: True.
- force: list of tuples or LineData objects
Force a given channel interval to be a specific line identification. If force is given, LineID_AT will not try to find any lines in the specified channel range, but rather take your input as correct. Format: [(frequency, UID, formula, name, transition, velocity, startchan, endchan)] Examples: [(115.2712, ‘CO’, ‘CO(1-0)’, ‘carbon monoxide’, ‘J=1-0’, 123.456, 23, 87)]
- [(342.998, ‘Fred’, ‘Flintsone’, ‘unknown’, ‘unknown’, 0, 64, 128),
- (238.012, ‘My Favorite Molecule’, ‘N/A’, ‘N/A’, ‘N/A’, 0, 4, 39)]
- [LineData(frequency=115.271, name=’Carbon Monoxide’, formula=’CO’,
- uid=’CO_115.271’, transition=‘1-0’, velocity=225.3, chans=[25, 119])]
Note uid is what is the label used in the plots that LineID_AT creates. LineData objects can be used instead of a tuple, as the contents of the tuple is converted to a LineData object internally anyway. Default: [].
- reject: list of tuples
Reject a specific line identification. Format: [(name, frequency)], e.g., [(“carbon monoxide”, 115.2712), (“carbon monosulfide”, 97.981)]. Name is case insensitive. Frequency should be given to enough precision that it uniquely identifies a line (a comparison is made at the 1 part in 10^6 for matching). If frequency is None, all lines from the given molecule will be rejected, i.e. [(“carbon monoxide”, None)] rejects all CO transitions, including isotopomers: 12CO, 13CO, C18O etc.
Default: [].
- Input BDPs
At least one of the following BDPs must be specified.
- CubeSpectrum_BDP: count: 1 (optional)
- Input spectrum, may contain several spectra. Typically the output of a CubeSpectrum_AT or GenerateSpectrum_AT.
- CubeStats_BDP: count: 1 (optional)
- Alternative input spectrum, as from a CubeStats_AT.
- PVCorr_BDP: count: 1 (optional)
- Spectrum based on the output of PVCorr_AT.
Output BDPs
- LineList_BDP: count: 1
- List of spectral lines.
Methods
addinput
(item[, slot])Add a BDP input to an AT. addinputbdp
(item[, slot, insert])Add a BDP to the _bdp_in list. addoutput
(item[, slot])Add a BDP output product to an AT. addoutputbdp
(item[, slot, insert])Add a BDP to the _bdp_out list. baseDir
([path])Get/set project base directory. bestMatch
(at1, at2)Determines the better match of two tasks to the current one. checkcount
(counts)Method to determine if there are too many peaks for the pattern finder to be of use. checkfiles
()Check if the files from all the BDP_out’s in an AT exist. checkfit
(peaks, peak, params, freq, segment)Method to determine if the given Gaussian fit paramters exceed 1.5 times the intensity of the peak channel, and are contained within the encompassing segment. checkforcechans
(peaks, chs)Method to check that no non-force segments overlap with force segments checkforcefreqs
(frq)Method to check that detected segments do not overlap with any force segments in checkforcesegs
(segs)Method to check that detected segments do not overlap with any force segments in checkreject
(lines)Method to check possible lines against the list of rejected lines. checktier1chans
(peaks, chs)Method to check that no non-tier1 segments overlap with tier1 segments in the same spectrum. checktype
(item)Check the type of an object to see if it is a BDP. clearinput
()Clear the input BDP list. clearoutput
([delete])Clear the output BDP list. copy
()Creates an independent duplicate of the task. counthfclines
(chfc, shfc, peak, wiggle, ...)Method to count the number of hyperfine lines that match a given offset. delete
()Method to delete the AT and underlying BDPs. delinput
(slot)Delete a specific BDP in the _bdp_in list. deloutput
(slot)Delete a specific BDP in the _bdp_out list. dir
([filename])Absolute directory reference of the ADMIT project. dryrun
()Method to do a dry run of the AT, generally just checks input values for errors. enabled
([state])Returns current task enabled setting, with optional reset. execute
([args])Executes the task. findpatterns
(spec, points, segments)Method to search for patterns in the peaks. freeAlias
(aliases[, alias])Deletes alias reservation, if present. generatepossibles
(frq)Method to generate a list of possible molecular identifications given a frequency range. get
(attrib)Method to get the given attributes value getProject
()Retrieves project ID associated with the task. getVersion
()Return the version string. getchannels
(peaks, noise[, sid, cid, asfreq])Method to determine the channel ranges for thr given spectral line. getdtd
(fl)Method to write out the dtd data. geteffectivelevel
()Method to get the effective logging level of the logging subsystem getkey
(key)Retrieval value for a key. getloggername
()Method to get the name of the logger for this AT instance getlogginglevel
()Method to get the current logging level of the AT getpeaks
(method, args, spec, segments[, iterate])Method to get the peaks from the input spectrum. gettier1
()Method to get the Tier 1 transitions that may be in the window. gettier1line
(chans)Method to return a line from the detected tier1 list. haskey
(key)Query if a key exists for an AT. html
(inheader)Method to represent the current AT in HTML format. id
([strip])Returns task ID number. identify
(peaks, noise, tier1, hfs[, ...])Method to identify lines, given their peak locations. integritycheck
()Method to make sure all data have the same frequency axis. isAutoAlias
([withEmpty, compat])Whether the task alias appears to be auto-generated. isequal
(at)Method to determine if two ATs are the same. isstale
()Returns whether the AT is out of date. len2
()Returns the length of _bdp_in and _bdp_out in a tuple. link
()Increments the task link count. markChanged
()Mark an AT that it’s state was changed, so it would need to be rerun. markUpToDate
()Resets _stale to indicate that the AT does not need to be run. merge
(at[, aliases])Merges attributes from another task. mkdir
(dirname)Make a directory in the ADMIT hierarchy. mkext
(filename, ext[, alias])Return a new filename with a new extension with optional ADMIT alias. narrowpossibles
(possible)Method to take the possible identifications of a spectral line and narrow it down to one possibility. newId
(tid)Assigns the task a new ID number. removepeaks
(pks, segments)Method to remove peak points from a list if they are not inside of reset
(a)Performs an in-place shallow copy. run
()The run method, locates lines, attempts to identify them, and running
([state])Returns current task execution flag, with optional reset. save
()Save (write) any BDPs connected to this AT. set
(item, val)Method to set protected attributes, rather than direct access setAlias
(aliases[, alias, auto])Sets and registers the task alias, guaranteed unique among registered aliases. setProject
(pid)Adds a project ID to task ID. set_bdp_in
([bdpin])Validate the _valid_bdp_in list and digest it into the appropriate attributes. set_bdp_out
([bout])Validate the _valid_bdp_out list and digest it into the appropriate attributes. seteffectivelevel
(level)Method to set the effective logging level of the logging subsystem setkey
([name, value, isinit])Set keyword value. setloggername
(name)Method to set the name of the logger for this AT instance setlogginglevel
(level)Method to set the logging level show
()Return the AT type. statusicons
()return some html icons representing the enabled/stale status of this task summary
()Returns the summary dictionary from the AT, for merging into the ADMIT Summary object. taghfclines
(chfc, shfc, peak, wiggle, ...)Method to identify hyperfine components in a given spectrum. unlink
()Decrements the task link count. userdata
()Returns the user dictionary from the AT, for merging into the ADMIT userdata object. validateinput
([describe])Method to validate the _bdp_in’s against a dictionary of expected types. validatekeys
()Method to error check all input keys. write
(node)Method to write the AT to disk. -
checkcount
(counts)[source]¶ Method to determine if there are too many peaks for the pattern finder to be of use. If there are too many points then false patterns can be found. The threshold has been experimentally determined to be a second order poynolmial based on the number of of channels. See the design documentation for specifics and details.
Parameters: counts : dict
Dictionary containing the peaks for each input spectrum.
Returns: Bool, True if there are too many peaks for the pattern finder to be of use, False
otherwise.
-
checkfit
(peaks, peak, params, freq, segment)[source]¶ Method to determine if the given Gaussian fit paramters exceed 1.5 times the intensity of the peak channel, and are contained within the encompassing segment. Adjustments are are made if necessary.
Parameters: peaks : Peaks instance
The Peaks instance used to supply the spectrum and segments
peak : float
The peak intensity within the segment
params : array like
The list of Gaussian parameters from a fit (peak, center (offset from freq), FWHM)
freq : float
The central frequency of the fit.
segment : list
Segment containing the peak
Returns: Tuple containing the corrected fit parameters
-
checkforcechans
(peaks, chs)[source]¶ Method to check that no non-force segments overlap with force segments
Parameters: peaks : Peaks instance
Instance of the Peaks class containing all of the line peaks
chs : list
List containing a pair of entries for the beginning and ending channel numbers for the segment.
Returns: List, containing a pair of entries, the start and end channels for the
segment, modified so that it does not overlap any tier1 segments.
-
checkforcefreqs
(frq)[source]¶ Method to check that detected segments do not overlap with any force segments in frequency space
Parameters: segs : list
List of the segments (in channel space) to check
Returns: List of segments that do not overlap with force segments
-
checkforcesegs
(segs)[source]¶ Method to check that detected segments do not overlap with any force segments in channel space
Parameters: segs : list
List of the segments (in channel space) to check
Returns: List of Segments objects that do not overlap with force segments
-
checkreject
(lines)[source]¶ Method to check possible lines against the list of rejected lines. Returns an edited version of the input data, removing those that match the reject list.
Parameters: lines : list or dict
The line identifications to check for rejects.
Returns: Data in the same form as input, with rejected lines removed
-
checktier1chans
(peaks, chs)[source]¶ Method to check that no non-tier1 segments overlap with tier1 segments in the same spectrum.
Parameters: peaks : Peaks instance
Instance of the Peaks class containing all of the line peaks
chs : list
List containing a pair of entries for the beginning and ending channel numbers for the segment.
Returns: List, containing a pair of entries, the start and end channels for the
segment, modified so that it does not overlap any tier1 segments.
-
counthfclines
(chfc, shfc, peak, wiggle, offset, hflines)[source]¶ Method to count the number of hyperfine lines that match a given offset. The offsets are determined by the wings of a cluster. This returns the number of hyperfine components that match emission features.
Parameters: chfc : dict
Dictionary containing the channel ranges and other line attributes of clusters
shfc : dict
Dictionary containing the channel ranges and other line attributes of single lines
peak : Peaks instance
Peaks instance used to calculate channel ranges
wiggle : float
The amount of wiggle room to allow for a match in channel space
offset : float
The offset to use for the calculations
hflines : list
List of all possible hyperfine components
Returns: Int, the number of matches
-
findpatterns
(spec, points, segments)[source]¶ Method to search for patterns in the peaks. Specifically it is looking for pairs of peaks that are the same distance apart (within the tolerance). These can be an indicator of rotation/infall/etc. Only two patterns are allowed to overlap. See the design documentation for specifics
Parameters: spec : array like
The spectrum that is currently being worked on.
points : numpy array
Listing of peak points
segments : list
List of the segments for the current spectrum
Returns: A Peaks class containing the spectra, segments, peaks and patterns
-
generatepossibles
(frq)[source]¶ Method to generate a list of possible molecular identifications given a frequency range. The methold calls slsearch and converts the output into a list.
Parameters: frq : list, length 2
The frequency range to search, it is just passed to slsearch, and no error checking is done.
Returns: A list containing the possible identifications. Each item in the
list is a list itself containing the chemical formula, chemical
name, rest frequency, transition quantum numbers, line strength,
lower state energy, and upper state energy, in this order.
-
getchannels
(peaks, noise, sid=-1, cid=-1, asfreq=False)[source]¶ Method to determine the channel ranges for thr given spectral line. First uses the segment to get the maximum extent of the line, then compares the channel range to all other peaks and makes adjustments so that the channel range does not incorporate mote than one peak.
Parameters: peaks : Peaks instance
The peaks instance which lists all peaks in the spectrum
noise : float
The noise level of the spectrum
sid : int
Center channel of the spectrum to find the channel ranges for. Default: -1
cid : int
Center channel of the cluster to find the channel ranges for. Default: -1
asfreq : bool
Whether to return the end poitns in frequency units (True) or channel numbers (False). Defult : False (channel numbers)
Returns: List containing both the start and end channels for the given peak
Notes
Both sid and cid are mutually exclusive.
-
getpeaks
(method, args, spec, segments, iterate=False)[source]¶ Method to get the peaks from the input spectrum. It calls the requested peak finder and can iterate over the inputs to find both wider weaker lines 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 peaks is returned.
Parameters: method : str
The peak finding method to use
args : dict
The arguments to send to the peak finder
spec : array like
The input spectrum which is searched for peaks
segments : list
A list of the previously detected segments
iterate : bool
If True then iterate over the minchan ans threshold to detect narrow strong lines. Default : False
Returns: List of the peak points in channel space
-
gettier1
()[source]¶ Method to get the Tier 1 transitions that may be in the window. These transitions are stored in a small sqlite3 database inside of Admit. The molecules in the database are:
CO all transitions
13CO all transitions
C18O all transitions
C17O all transitions
HCO+ all transitions
H13CO+ all transitions
DCO+ all transitions
HDO all transitions
CCH all transitions
CN excluding weakest lines
13CN excluding weakest lines
HCN all transitions
DCN all transitions
H13CN all transitions
HN13C all transitions
HNC all transitions
N2H+ all transitions
H2CO excluding weakest lines
CS all transitions
SiO all transitions
SO all transitions
HC3N excluding weakest lines
Parameters: None
Returns: tuple of dictionaries
The first contains a list of single transitions and the strongest component of any lines with hyperfine splitting, the second contains a listing of all possible hyperfine components, lined with the main components in the first list.
-
gettier1line
(chans)[source]¶ Method to return a line from the detected tier1 list. The line is found by looking for an entry which is between the end points of the input segment.
Parameters: chans : list
Two element list of the start and end channels to search over
Returns: A listing of any tier1 line which overlaps with the segment.
-
identify
(peaks, noise, tier1, hfs, isstats=False, ispvcorr=False)[source]¶ Method to identify lines, given their peak locations. This is a complex method that works as follows:
- search for any Tier 1 lines in the spectrum
- start with any detected patterns
- then search for individual lines
- any peak detected within ‘tier1width’ of the expected rest frequency of the Tier 1 line will be marked as being from that transition (defaults to 300 km/s for a source vlsr > 150 and 40 km/s for a source vlsr <= 150 km/s)
- if an identified line has hyperfine components, search for them before proceeding to the next transition in the Tier 1 list
- search for any remaining transitions in the spectrum
- start with any detected patterns
- then search any remaining single peaks
- when working with detected (really suspected) patterns both the emission/absorption peaks and the central frequency are searched for, since the pattern may not be due to rotation, but may be due to emission from multiple related transitions (internal molecular rotation)
- any detected lines in a given spectrum will be compared to detected peaks of any other spectra. Specifically this helps to identify transitions due to source rotation where the CubeStats spectrum see all of the emission (both red and blue shifted peaks), but a CubeSpectrum may ony see the red peak, this red only peak will be correctly identified because it matches part of the pattern from the CubeStats input.
Parameters: peaks : Peaks instance
A class containing both the sinlge peaks and those which may be grouped by a common offset
noise : float
The rms noise of the root spectrum
tier1 : dict
Dictionary containing any Tier 1 lines located in the band, rest frequency is the key, transition data are the values
hfs : dict
Dictionary of hyperfine components that correspond to any lines in tier1.
isstats : bool
Whether or not a CubeStats based spectrum is being processed. Default : False
ispvcorr : bool
Whether or not a PVCorr based spectrum is being processed. Specifically this disables the use of velocity offsets. Default: False
Returns: List of the line identifications
- search for any Tier 1 lines in the spectrum
-
integritycheck
()[source]¶ Method to make sure all data have the same frequency axis. This is necessary since this AT works in both channel and frequency space, thus it must be ensured that the frequency of channel 1 is the same for all input spectra. This method will throw an exception if a mismatch is found, as further analysis might be compromised. The comparison of the frequencies is done at the 1 part in 10^6 level in case they are recorded at differing precisions.
Parameters: None Returns: None
-
narrowpossibles
(possible)[source]¶ Method to take the possible identifications of a spectral line and narrow it down to one possibility. This is done by comparing the upper state energies of the transitions, masses, and isotope counts. NEED DETAILS
Parameters: possibles : list
A list containing all of the possible identifications for the line
Returns: The listing of the most likely identification
-
removepeaks
(pks, segments)[source]¶ Method to remove peak points from a list if they are not inside of a segment and merge those that are close to each other
Parameters: pks : list
List of peak points, any units
segments : list
List of segment end points (two for each segment), must have same units as pks
Returns: List of peak points that are inside of the segments
-
run
()[source]¶ The run method, locates lines, attempts to identify them, and creates the BDP
Parameters: None Returns: None
-
summary
()[source]¶ Returns the summary dictionary from the AT, for merging into the ADMIT Summary object.
LineID_AT adds the following to ADMIT summary:
Key type Description linelist table table of parameters of discovered lines spectra list the spectral plot of signal, noise, and S/N Parameters: None
Returns: dict
Dictionary of SummaryEntry
-
taghfclines
(chfc, shfc, peak, wiggle, offset, hflines)[source]¶ Method to identify hyperfine components in a given spectrum. If components are blended then the strongest line (based on transition line strength) is added to the transitions and all others are added to the blended lines. All are connected by the blend number.
Parameters: chfc : dict
Dictionary containing the channel ranges and other line attributes of clusters
shfc : dict
Dictionary containing the channel ranges and other line attributes of single lines
peak : Peaks instance
Peaks instance used to calculate channel ranges
wiggle : float
The amount of wiggle room to allow for a match in channel space
offset : float
The offset to use for the calculations
hflines : list
List of all possible hyperfine components
Returns: Tuple containing the identification(s) and blend(s)
-
class
admit.at.LineID_AT.
Peaks
(**kwargs)[source]¶ Lightweight class for working with the peaks found by one or more peak finding algorithms.
Parameters: kwargs : dict
A dictionary of keyword/value pairs of the parameters. Can contain any attribute. See Attributes below for a full listing of possible keywords and value types.
Attributes
centers (dict) fcenters (dict) singles (list) fsingles (list) pairs (dict) x (list) Listing of the x axis (frequency) for the given peaks y (list) Listing of the y axis (intensity) for the given peaks offsets (set) Listing of all possible offset values, shared among all instances of Peaks. offsetdone (boolean) Whether or not the offsets have been converted to frequency. Internal use only should not be set manually. Methods
centerfreq
()Method to get the center frequency of the spectrum converttofreq
()Method to convert the peak and pattern locations from channel to flatten
(tol)Method to collapse pair peaks that are close together into single getchan
(frq)Method to get the channel number given the frequency getchans
([masked])Method to get the entire channel axis getfreq
(chan)Method to get the frequency of the given channel, the channel can contain a fraction of a channel (e.g. getfreqs
([masked])Method to get the entire frequency axis getfsegment
(freq)Method to return the segment which contains the given frequency. getsegment
(chan)Method to get the segment that contains the given channel getspecs
([masked])Method to get the entire spectral axis limitwidth
(center, width)Method to ensure that the given peak and line width fit within its segment pairsort
(pairs)Method to sort a list of pairs into ascending order patternsort
(pattern)Method to sort a detected patterns into sorted lists removeidentified
(data, tol)Method to remove already identified peaks. reset
()Method to reset the Peaks static member variables so that LineID can be re-run without polluting the results with items from previous runs. sort
()Method to sort through all pairs and organize them into dictionary validatelinesegments
()Method to ensure that all line channel ranges do not go past the bounds of the original segments. -
blends
¶
-
centerfreq
()[source]¶ Method to get the center frequency of the spectrum
Parameters: None Returns: Float containing the center frequency of the spectrum
-
centers
¶
-
converttofreq
()[source]¶ Method to convert the peak and pattern locations from channel to frequency indexing
Parameters: None Returns: None
-
counts
¶
-
fcenters
¶
-
flatten
(tol)[source]¶ Method to collapse pair peaks that are close together into single pair
Parameters: tol : float
The tolerance (minimum distance between points)
Returns: List containing the consolidated points
-
fsegments
¶
-
fsingles
¶
-
getchan
(frq)[source]¶ Method to get the channel number given the frequency
Parameters: frq : float
The frequency whose channel number is to be found
Returns: int containing the channel number, will be 0 or len(self.x)-1 if
the frequency is outside of the frequency range in the class
-
getchans
(masked=True)[source]¶ Method to get the entire channel axis
Parameters: masked : bool
If True return a masked array with “bad” channels masked, else return a numpy array
Returns: array like containing the channel axis
-
getfreq
(chan)[source]¶ Method to get the frequency of the given channel, the channel can contain a fraction of a channel (e.g. 1.45)
Parameters: chan : float
The channel to convert
Returns: Float of the frequency corresponding to the channel
-
getfreqs
(masked=True)[source]¶ Method to get the entire frequency axis
Parameters: masked : bool
If True return a masked array with “bad” channels masked, else return a numpy array
Returns: array like containing the frequency axis
-
getfsegment
(freq)[source]¶ Method to return the segment which contains the given frequency.
Parameters: freq : float
The frequency for which the segment is requested
Returns: List containing the segment end points, or [None, None] if the frequency is not in a
segment.
-
getsegment
(chan)[source]¶ Method to get the segment that contains the given channel
Parameters: chan : int
The channel number to find the segment for
Returns: Two element List containing the starting and ending channels
for the segment containing the given channel
-
getspecs
(masked=True)[source]¶ Method to get the entire spectral axis
Parameters: masked : bool
If True return a masked array with “bad” channels masked, else return a numpy array
Returns: array like containing the spectral axis
-
limitwidth
(center, width)[source]¶ Method to ensure that the given peak and line width fit within its segment
Parameters: center : float
The center frequency in GHz
width : float
The half width of the line in GHz
Returns: Two element List containing the start and end frequencies, limited by the
segment boundaries
-
linelist
¶
-
offsetdone
= False¶
-
offsets
= set([])¶
-
pairs
¶
-
pairsort
(pairs)[source]¶ Method to sort a list of pairs into ascending order
Parameters: pairs : list
List of pairs (as lists) to be sorted
Returns: A list of the sorted pairs
-
patternsort
(pattern)[source]¶ Method to sort a detected patterns into sorted lists
Parameters: pattern : dict
Dictionary of the patterns to sort
Returns: Dictionary of sorted patterns
-
removeidentified
(data, tol)[source]¶ Method to remove already identified peaks.
Parameters: data : Peaks instance
A Peaks instance to use as the base for removal
tol : float
The tolerance to allow (in GHz) for comparable lines
Returns: None
-
static
reset
()[source]¶ Method to reset the Peaks static member variables so that LineID can be re-run without polluting the results with items from previous runs.
Parameters: None Returns: None
-
segments
¶
-
singles
¶
-
sort
()[source]¶ Method to sort through all pairs and organize them into dictionary entries indexed by their common separation
Parameters: None Returns: None
-
spec
¶
-