Documentation ¶
Overview ¶
Package dsp has a set of digital signal processing functions that are primarily designed to support the discrete wavelet transform ("https://github.com/goccmack/dsp/dwt")
Index ¶
- func Abs(x []float64) []float64
- func AbsAll(X [][]float64) [][]float64
- func AbsInt(x []int) []int
- func Average(x []float64) float64
- func DivS(x []float64, s float64) []float64
- func DownSample(x []float64, n int) []float64
- func DownSampleAll(xs [][]float64) [][]float64
- func FindMax(x []float64) (value float64, index int)
- func FindMaxI(x []int) (value int, index int)
- func FindMin(x []float64) (value float64, index int)
- func Float32ToFloat64(x []float32) []float64
- func IsPowerOf2(x int) bool
- func LoadFloats(fname string) []float64
- func Log2(n int) int
- func LowpassFilter(x []float64, alpha float64) []float64
- func LowpassFilterAll(xs [][]float64, alpha float64) [][]float64
- func Max(x []float64) float64
- func MaxInt(x []int) int
- func MovAvg(x []float64, w int) []float64
- func Multiplex(channels [][]float64) []float64
- func Normalise(x []float64) []float64
- func NormaliseAll(xs [][]float64) [][]float64
- func Pow2(x int) int
- func Range(n int) []int
- func ReadWavFile(wavName string) (channels [][]float64, sampleRate, bitsPerSample int)
- func RemoveAvg(x []float64) []float64
- func RemoveAvgAllZ(xs [][]float64) [][]float64
- func Smooth(x []float64, wdw int)
- func Sub(x, y []float64) []float64
- func Sum(x []float64) float64
- func SumVectors(X [][]float64) []float64
- func ToFloat(x []int) []float64
- func ToInt(x []float64, bitsPerSample int) []int
- func ToIntS(x float64, bitsPerSample int) int
- func WriteAllDataFile(xs [][]float64, fname string)
- func WriteDataFile(x []float64, fname string)
- func WriteIntDataFile(x []int, fname string)
- func Xcorr(x, y []float64, maxDelay int) (corr []float64)
- type Peak
- type Peaks
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownSample ¶
DownSample returns x downsampled by n Function panics if n or len(x) is not a power of 2.
func DownSampleAll ¶
DownSampleAll returns DownSample(x, len(x)/min(len(xs))) for all x in xs
func FindMax ¶
FindMax returns the value and index of the first element of x equal to the maximum value in x.
func FindMaxI ¶ added in v0.0.2
FindMax* returns the value and index of the first element of x equal to the maximum value in x.
func FindMin ¶
FindMin returns the value and index of the first element of x equal to the minimum value in x.
func Float32ToFloat64 ¶
Float32ToFloat64 returns a copy of x with type []float64
func IsPowerOf2 ¶
func LoadFloats ¶
LoadFloats reads a text file containing one float per line.
func LowpassFilter ¶
LowpassFilter returns x filtered by alpha
func LowpassFilterAll ¶
LowpassFilterAll returns LowpassFilter(x) for all x in xs.
func MovAvg ¶ added in v0.0.2
MovAvg returns the moving average for each x[i], given by sum(x[i-w:i+w])/(2w)
func NormaliseAll ¶
Normalise returns x/max(x) for all x in xs
func ReadWavFile ¶
ReadWavFile returns the demultiplexed channels of a wav file, and the sample rate in Hz.
func RemoveAvgAllZ ¶
RemoveAvgAllZ removes the average of all vectors x in xs. The minimum value of any x[i] is 0.
func SumVectors ¶
SumVectors returns the sum of the vectors in X. The function panics if all vectors don't have the same length
func ToInt ¶ added in v0.0.3
ToInt returns y * math.MaxInt64. The range of x is [-1.0,1.0]. The function panics if bitsPerSample is not one of 8,16,32.
func WriteAllDataFile ¶
WriteAllDataFile writes each xs[i] in xs to a test file `fname_i.txt`
func WriteDataFile ¶
WriteDataFile writes x to a text file `fname.txt`
func WriteIntDataFile ¶
WriteIntDataFile writes x to a text file `fname.txt`
Types ¶
type Peaks ¶
type Peaks struct {
// contains filtered or unexported fields
}
func GetPeaks ¶
GetPeaks detects the peaks in a time series `seq` by means of persistent homology: https://www.sthu.org/blog/13-perstopology-peakdetection/index.html. The returned peaks are in increasing order of their indices in `seq`.
func GetPeaksInt ¶
func (*Peaks) GetIndices ¶
GetIndices returns the indices in the original time series `seq` of the peaks with persistence/max(persitence of seq) >= `fracOfMaxPersistence`
func (*Peaks) MinMaxPersistence ¶
MinMaxPersistence returns the minimum and maximum persistence of the peaks in `seq`.
Directories ¶
Path | Synopsis |
---|---|
Package dbscan implements the DBSCAN clustering algorithm (https://en.wikipedia.org/wiki/DBSCAN)
|
Package dbscan implements the DBSCAN clustering algorithm (https://en.wikipedia.org/wiki/DBSCAN) |
Package DWT has functions supporting the Discrete Wavelet Transform.
|
Package DWT has functions supporting the Discrete Wavelet Transform. |
Package ioutil implements some convenience functions for working with files.
|
Package ioutil implements some convenience functions for working with files. |