common

package
v0.0.0-...-b4d0ca1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: BSD-3-Clause Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const InvalidCpuTemp = float32(-99.0)

Variables

This section is empty.

Functions

func ArrayMax

func ArrayMax(x []float64) (float64, bool)

arrayMax calculates the maximum value in array x

func ArrayMin

func ArrayMin(x []float64) (float64, bool)

arrayMin calculates the minimum value in array x

func ArrayRange

func ArrayRange(x []float64) (float64, bool)

arrayRange calculates the range of values in array x

func CalcAltitude

func CalcAltitude(press float64, altoffset int) (altitude float64)

CalcAltitude determines the pressure altitude (feet) from the atmospheric pressure (hPa)

func CpuTempMonitor

func CpuTempMonitor(updater CpuTempUpdateFunc)

func Degrees

func Degrees(angle float64) float64

degrees converts angle from radians, and returns its value in degrees

func DegreesHdg

func DegreesHdg(angle float64) float64

degreesHdg converts angle from radians, and returns its value in the range of 0+ to 360 degrees

func DegreesRel

func DegreesRel(angle float64) float64

degreesRel converts angle from radians, and returns its value in the range of -180 to +180 degrees

func DistRect

func DistRect(lat1, lon1, lat2, lon2 float64) (dist, bearing, distN, distE float64)

func DistRectEast

func DistRectEast(lat1, lon1, lat2, lon2 float64) float64

distRectEast returns east-west distance from point 1 to point 2. Inputs are lat/lon in decimal degrees. Output is distance in meters (north positive)

func DistRectNorth

func DistRectNorth(lat1, lat2 float64) float64

distRectNorth returns north-south distance from point 1 to point 2. Inputs are lat in decimal degrees. Output is distance in meters (east positive)

func Distance

func Distance(lat1, lon1, lat2, lon2 float64) (dist, bearing float64)

distance calculates distance between two points using the law of cosines. Inputs are lat / lon of both points in decimal degrees Outputs are distance in meters and bearing to the target from origin in degrees (0° = north, 90° = east)

func IMax

func IMax(x, y int) int

func IMin

func IMin(x, y int) int

golang only defines min/max for float64. Really.

func IsCPUTempValid

func IsCPUTempValid(cpuTemp float32) bool

Check if CPU temperature is valid. Assume <= 0 is invalid.

func IsRunningAsRoot

func IsRunningAsRoot() bool

func LinReg

func LinReg(x, y []float64) (slope, intercept float64, valid bool)

func LinRegWeighted

func LinRegWeighted(x, y, w []float64) (slope, intercept float64, valid bool)

func Mean

func Mean(x []float64) (float64, bool)

mean returns the arithmetic mean of array x

func Radians

func Radians(angle float64) float64

radians converts angle from degrees, and returns its value in radians

func RadiansRel

func RadiansRel(angle float64) float64

radiansRel converts angle from degrees, and returns its value in radians in the range -Pi to + Pi

func RoundToInt16

func RoundToInt16(in float64) (out int16)

roundToInt16 cheaply rounds a float64 to an int16, rather than truncating

func Stdev

func Stdev(x []float64) (float64, bool)

stdev estimates the sample standard deviation of array x

func TriCubeWeight

func TriCubeWeight(center, halfwidth, x float64) float64

triCubeWeight returns the value of the tricube weight function at point x, for the given center and halfwidth.

Types

type CpuTempUpdateFunc

type CpuTempUpdateFunc func(cpuTemp float32)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL