Documentation
¶
Index ¶
- func Compare(x float64, y float64) (max float64, min float64)
- func Delta(floats []float64) []float64
- func DropNan(slice []float64) []float64
- func FillNan(slice []float64, method string, prefill bool, validTime int) []float64
- func FindIndex(slice []float64, val float64) (int, bool)
- func Insert(slice []float64, idx int, val float64) []float64
- func IsValid(value float64) bool
- func NanSlice(size int) (nanslice []float64)
- func NumRange(start int, end int, step int) (numberrange []float64)
- func RemoveFrom(slice []float64, s int) []float64
- func ReplaceNan(value float64, replacewith float64) float64
- func ReplaceNans(values []float64, replacewith float64) []float64
- func RoundTo(val float64, digits int) float64
- func RoundToNearest(value float64, nearest float64) float64
- func SetDefault(defaultval float64, confval float64) float64
- type Rounded
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FillNan ¶
Fillna Fills NaN values with a value base on method. method "previous" fills with previous value,method "linear" fills the NaNs with linear interpolation If no previous value found for filling, first valid value can be used by setting prefill=true validTime (higher number than 1) sets the sample's lifetime. If the sample "dies", NaN is written. This overrides prefill = true -setting
func RemoveFrom ¶ added in v0.2.3
RemoveFrom removes an integer from given index
func ReplaceNan ¶
ReplaceNan If <value> is NaN or Inf, replaces <value> with <replacewith>
func ReplaceNans ¶
ReplaceNanSlice Replace NaNs in a slice with given value
func RoundToNearest ¶ added in v0.2.4
RoundToNearest rounds <value> to <nearest> value
func SetDefault ¶
SetDefault set default value for a parameter, if the configuration value is zero (=initialized empty variable)
Types ¶
type Rounded ¶
type Rounded struct {
Rawvalue float64 // raw value with given digits
Prefix string // prefix string
Value float64 // rounded value with given digits and prefix
Response string // response as <Value> <Prefix><unit>
}
func RoundWithPrefix ¶
RoundPrefix returns the rounded value to given digits and correct prefix (Megas, Kilos etc.) Special case is abs value between 1000....10000 which is not converted to kilos (because I like it like that) set prefix to force certain prefix, otherwise the function figures it out on its' own.