Measured functions

MeasuredFunction is the datatype workhorse. Most data can be formulated as one variable vs. another, the ordinate and abscissa. What we measure is discrete, but we can assume it represents something continuous. That means interpolation and math are supported with appropriate processing of abscissa basis.

Basic manipulation is supported, such as splicing, deleting segments, adding points, etc. Math is also supported with a scalar and a measured function and two measured functions (with appropriate abscissa basis handling.)

Child classes include Spectrum, meant for cases where the abscissa is frequency or wavelength and the ordinate is power or transmission. It has extra methods for conversion from linear to decibel power units. Also Waveform is meant for cases where abscissa is time.

Peak finding

The data module is particularly good with peaks. A very basic classless peak finder comes with findPeaks(). The arguments are arrays and indeces. It is more useful to do peakfinding in an object-oriented way with findResonanceFeatures(). The ResonanceFeature class stores information on the position, width, and height of peaks, in addition to more powerful aspects like refining position based on convolution with a known peak shape.

Much of this functionality is handled within the SpectrumMeasurementAssistant, good for when you are looking at real spectra of a single device over and over again. Makes assumptions such as background not changing and filter shape not changing. The notebook doesn’t really show the full potential of SpectrumMeasurementAssistant.

Descent-based function inversion

Inverting a measured function is desirable for evoking a particular response that was measured. For example, finding the proper wavelength shift needed to set a given transmission value, based on a known MeasuredFunction of transmission vs. wavelength. Descent functions use linear interpolation. Descent only works on monotonically increasing (decreasing) sections. When the entire object is monotonic, use the MeasuredFunction.invert method. When the function is peak-like, it is possible to specify a direction to start the descent until either the target value is reached, or the function changes slope.

FunctionBundle and FunctionalBasis

Often there are two abscissas. The “third dimension” could be a continuous variable (as in MeasuredSurface) or a discrete variable (as in FunctionBundle). They each have different implications and operations and subclasses. Spectrogram inherits MeasuredSurface with continuous time as the second abscissa. FunctionalBasis is basically a bundle with increased attention paid to linear algebra and function order for the sake of decomposing, synthesizing, and projecting weighted additions of other functions.

FunctionBundle(measFunList=None)[source]

A bundle of MeasuredFunction’s: “z” vs. “x”, “i”

The key is that they have the same abscissa base. This class will take care of resampling in a common abscissa base.

The bundle can be:
  • iterated to get the individual :class`~lightlab.util.data.one_dim.MeasuredFunction`’s
  • operated on with other FunctionBundles
  • plotted with :meth`simplePlot` and multiAxisPlot()

Feeds through callable signal processing methods to its members (type MeasuredFunction), If the method is not found in the FunctionBundle, and it is in it’s member, it will be mapped to every function in the bundle, returning a new bundle.

Distinct from a MeasuredSurface because the additional axis does not represent a continuous thing. It is discrete and sometimes unordered.

Distinct from a FunctionalBasis because it does not support most linear algebra-like stuff (e.g. decomposision, matrix multiplication, etc.). This is not a strict rule.