Documentation
¶
Overview ¶
Package dataset loads ULog streams into eager, column-oriented views.
Use Read when an entire log fits in memory and analysis needs repeated or column-wise access. Use ulog.Reader when data records can be processed without materialising the complete log. Numeric arrays and nested formats are flattened into stable column paths; character arrays remain string columns.
Index ¶
- type Column
- type Dataset
- type File
- func (f *File) Dataset(name string, multiID uint8) (*Dataset, error)
- func (f *File) Datasets() []*Dataset
- func (f *File) DefaultParameters() []ulog.DefaultParameter
- func (f *File) Dropouts() []ulog.Dropout
- func (f *File) Header() ulog.Header
- func (f *File) Information() []ulog.KeyValue
- func (f *File) Logs() []ulog.LogEntry
- func (f *File) MultiInformation() []ulog.MultiInformationGroup
- func (f *File) Parameters() []ulog.KeyValue
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
Column is a nullable dataset column. Column.Values returns one of []int8, []uint8, []int16, []uint16, []int32, []uint32, []int64, []uint64, []float32, []float64, []bool, or []string. Character arrays use []string; scalar characters use []uint8.
func (Column) ArrayLength ¶ added in v0.2.0
ArrayLength returns the fixed byte width of a character array, or zero for a scalar value.
func (Column) Value ¶
Value returns one value and whether it is valid. It returns nil, false for a null or out-of-range row.
func (Column) Values ¶
Values returns an independent copy of the typed values. Null rows contain the primitive type's zero value; use Column.Value to distinguish them.
type Dataset ¶
type Dataset struct {
// contains filtered or unexported fields
}
Dataset contains every record for one format name and multi ID. Numeric arrays and nested formats are flattened into stable paths; character arrays remain string-valued Column values. A record that omits compatible trailing fields contributes nulls to the corresponding columns.
func (*Dataset) Column ¶
Column returns a flattened scalar column by its case-sensitive path, such as "q[0]" or "position.x".
func (*Dataset) Columns ¶
Columns returns the flattened, non-padding columns in wire order. Mutating the returned slice does not change the dataset.
func (*Dataset) Format ¶
Format returns an independent copy of the ulog.Format that defined the dataset's first record.
func (*Dataset) Len ¶
Len returns the number of data records in the dataset, including records with null trailing fields.
func (*Dataset) MultiID ¶
MultiID returns the format's instance identifier. Zero is the first and default instance.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File owns the datasets and metadata loaded from one complete ULog stream.
func Read ¶
Read consumes source to the end and groups records by format name and multi ID. It returns no partial File if the ULog stream is invalid. Read does not close source.
Example ¶
package main
import (
"fmt"
"os"
"github.com/sunfish-robotics/ulog/pkg/dataset"
)
func main() {
source, err := os.Open("flight.ulg")
if err != nil {
panic(err)
}
defer func() {
if err := source.Close(); err != nil {
panic(err)
}
}()
file, err := dataset.Read(source)
if err != nil {
panic(err)
}
attitude, err := file.Dataset("vehicle_attitude", 0)
if err != nil {
panic(err)
}
timestamps, ok := attitude.Column("timestamp")
if !ok {
panic("timestamp column is missing")
}
values := timestamps.Values().([]uint64)
fmt.Printf("%d attitude samples, from %d µs\n", attitude.Len(), values[0])
}
Output:
func (*File) Dataset ¶
Dataset returns the dataset for the case-sensitive format name and instance identifier, or an error if Read saw no matching data record.
func (*File) DefaultParameters ¶
func (f *File) DefaultParameters() []ulog.DefaultParameter
DefaultParameters returns independent copies of the parameter defaults in file order. Missing defaults are not synthesised.
func (*File) Information ¶
Information returns independent copies of the typed metadata entries in file order.
func (*File) MultiInformation ¶ added in v0.2.0
func (f *File) MultiInformation() []ulog.MultiInformationGroup
MultiInformation returns independent copies of grouped multi-information values in the order each group started.
func (*File) Parameters ¶
Parameters returns independent copies of the initial parameter values and later changes in file order.