PhysUnits class

Helper class to convert array indices to "physical" units, and to scale ("normalize") the values of the array. Its is used to label x and y axes when the array is displayed as a graph, e.g. using Polyline.

Constructors

PhysUnits()

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited

Static Methods

normalize(double num, double num2, double normalizedNum2) → double
Normalizes num such that num2 would obtain the value normalizedNum2. Returns the respective new value for num. If normalizedNum2 is null, num is returned.
physFromIndex(double index, double physStart, double physWidth, int n, bool center, bool increasing, double calib) → double
Returns the physical unit for index. Assume you have a data array of n points. You want to assign each index of the array a "physical unit", e.g. seconds, Hertz, or whatever. Also assume that there is a linear relationship between indices and unit. physStart is the unit for index=0. physWidth is the unit range covered by all indices, from the first to the last one. center defines whether the computed unit value corresponds exactly to index (if false), or to the mean value between to subsequent indices (if true). Either choice can be convenient, depending on the application. increasing defines whether physXRangeStart will be the smallest value (true, increasing units), or the biggest one (false: decreasing unit). calib is an optional calibration factor. If not null, both physStart and physWidth are multiplied with calib.
physToIndex(double physX, double physStart, double physWidth, int n, bool center, bool increasing, double calib) → double
This is the inverse of getPhysXFromDataIndex: Returns the index corresponding to the physcial unit physX.
undoNormalize(double numNormalized, double num2, double normalizedNum2) → double
Inverse of normalize: If numNormalized was computed by normalize using num2 and normalizedNum2, this method returns the original value num which was fed into normalize. If normalizedNum2 is null, num is returned.