lightlab.util.measprocessing module

Useful stuff having to do with measurement processing. For example, if you want to set up a spectrum transmission baseline, or a weight functional basis Generally, these states are not device states, but could change from day to day

Summary

Classes:

SpectrumMeasurementAssistant Class for preprocessing measured spectra Calculates background spectra by 1) smoothing, 2) tuning/splicing, and 3) peak nulling Also handles resonance finding (This could move to a separate manager or external function) Interfaces directly with OSA.

Reference

class SpectrumMeasurementAssistant(nChan=1, arePeaks=False, osaRef=None)[source]

Bases: object

Class for preprocessing measured spectra Calculates background spectra by 1) smoothing, 2) tuning/splicing, and 3) peak nulling Also handles resonance finding (This could move to a separate manager or external function) Interfaces directly with OSA. It DOES NOT set tuning states.

useBgs = ['tuned', 'smoothed', 'const']
bgSmoothDefault = 2.0
rawSpect(avgCnt=1)[source]
fgSpect(avgCnt=1, raw=None, bgType=None)[source]

Returns the current spectrum with background removed.

Also plots so you can see what’s going on, if visualize mode was specified

If raw is specified, does not sweep, just removes background

resonances(spect=None, avgCnt=1)[source]

Returns the current wavelengths of detected peaks in order sorted by wavelength. Uses the simple findPeaks function, but it could later use a convolutive peak finder for more accuracy. :param spect: if this is specified, then a new spectrum will not be taken

killResonances(spect=None, avgCnt=1, fwhmsAround=3.0)[source]
fgResPlot(spect=None, axis=None, avgCnt=1)[source]

Takes a foreground spectrum, plots it and its peaks. Currently the axis input is unused.

setBgConst(raw=None)[source]

Makes a background the maximum transmission observed

setBgSmoothed(raw=None, smoothNm=None)[source]

Attempts to find background using a low-pass filter. Does not return. Stores results in the assistant variables.

setBgTuned(base, displaced)[source]

Insert the pieces of the displaced spectrum into where the peaks are It is assumed that these spectra were taken with this object’s fgSpect method

setBgNulled(filtShapes, avgCnt=3)[source]

Uses the peak shape information to null out resonances This gives the best estimate of background INDEPENDENT of the tuning state. It is assumed that the fine background taken by tuning is present, and the filter shapes were taken with that spect should be a foreground spect, but be careful when it is also derived from bgNulled

getBgSpect(bgType=None)[source]