signal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Processor

type Processor func(window []float64) []float64

Processor is a function, that can be used to calculate features of a signal.

The result of a Processor might be one, or multiple values depending on the type of work it does. For example a DWT, or AR function might want to return multiple coefficients. A Processor could implement a 'memory' to propagate values (see RMS implementation for example).

type ProcessorResult

type ProcessorResult struct {
	Id               string      `json:"id"`
	Value            float64     `json:"value"`
	ProcessorResults [][]float64 `json:"processorResults"`
}

ProcessorResult is a container for the results of a data push into a signal.

type Signal

type Signal struct {
	Id string
	// contains filtered or unexported fields
}

Signal is a representation of a signal with a pre-defined window size. A Signal uses Processors to calculate features of itself.

func NewSignal

func NewSignal(windowSize int, id string) *Signal

NewSignal creates a new signal with window size and an identifier.

func (*Signal) AddProcessor

func (s *Signal) AddProcessor(processor Processor) (index int)

AddProcessor adds a signal processor to be executed when pushing a new data point to the window. Results will be in the same order as the processors have been appended to the signal.

func (*Signal) ClearWindow

func (s *Signal) ClearWindow()

ClearWindow sets the window values to zero.

func (*Signal) Push

func (s *Signal) Push(value float64) (dataPoint *ProcessorResult)

Push appends the value and shifts the Window. Returns the updated feature of the signal for the current Window.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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