oscilloscope

package
v0.0.0-...-efe4ef5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package oscilloscope provides type and interface definitions for oscilloscopes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	// Data is the actual buffer, []byte, []int16, []uint16, or similar
	Data Data

	// Scale is the vertical scale of the data or size of a single increment
	// in Data's native dtype
	Scale float64

	// Offset is the offset applied to the data
	Offset float64

	// Reference is the reference value for the given channel in DN
	Reference float64
}

Channel represents a stream of data from an ADC. To convert to physical units, compute (data-offset)*scale

func (Channel) Physical

func (c Channel) Physical() []float64

Physical computes the data scaled to real units

type Data

type Data interface{}

Data is a moniker for an empty interface, expected to be a slice of a concrete numerical type

type Recording

type Recording struct {
	// RelTimes is the relative time of each sample
	RelTimes []float64

	// AbsTimes is the absolute time of each sample
	AbsTimes []time.Time

	// Measurement is the actual numeric data
	Measurement []float64

	// Name is the label to use for the data
	Name string
}

Recording is a sequence of data from the DAQ

func (Recording) EncodeCSV

func (r Recording) EncodeCSV(w io.Writer) error

EncodeCSV writes the recording to a CSV file if either of the time columns are empty or nil, the ther is used, or no time column in the event that both are empty or nil

type Waveform

type Waveform struct {
	// DT is the temporal sample spacing in seconds
	DT float64 `json:"dt"`

	// Channels holds named data streams
	Channels map[string]Channel
}

Waveform describes a waveform recording from a scope

func (*Waveform) EncodeCSV

func (wav *Waveform) EncodeCSV(w io.Writer) error

EncodeCSV converts the waveform data to physical units and writes it to a CSV in streaming fashion

Jump to

Keyboard shortcuts

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