data

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package data contains structs and methods common for listening test datasets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccuracyScore added in v0.1.11

type AccuracyScore struct {
	ScoreType ScoreType
	Threshold float64
	Accuracy  float64
}

AccuracyScore contains the accuracy for a metric when used to predict audible differences, and the threshold when that accuracy was achieved.

type AccuracyScores added in v0.1.11

type AccuracyScores []AccuracyScore

AccuracyScores contains the accuracy scores for multiple score types.

func (AccuracyScores) String added in v0.1.11

func (a AccuracyScores) String() string

type CorrelationScore

type CorrelationScore struct {
	ScoreTypeA ScoreType
	ScoreTypeB ScoreType
	Score      float64
}

CorrelationScore contains the scorrelation score between two score types.

type CorrelationTable

type CorrelationTable [][]CorrelationScore

CorrelationTable contains the pairwise correlations between a set of score types.

func (CorrelationTable) String

func (c CorrelationTable) String() string

type Distortion

type Distortion struct {
	Name   string
	Path   string
	Scores map[ScoreType]float64
}

Distortion contains data for a distortion of a reference.

func (*Distortion) Load

func (d *Distortion) Load(dir string) (*audio.Audio, error)

Load returns the audio for this distortion.

type Measurement

type Measurement func(reference, distortion *audio.Audio) (float64, error)

Measurement returns distance between sounds.

type Reference

type Reference struct {
	Name        string
	Path        string
	Distortions []*Distortion
}

Reference contains data for a reference.

func (*Reference) Load

func (r *Reference) Load(dir string) (*audio.Audio, error)

Load returns the audio for this reference.

type Row

type Row []string

Row is a row of table data.

type ScoreType

type ScoreType string

ScoreType represents a type of score, such as MOS or Zimtohrli.

const (
	// MOS is mean opinion score from human evaluators.
	MOS ScoreType = "MOS"
	// Zimtohrli is the Zimtohrli distance.
	Zimtohrli ScoreType = "Zimtohrli"
	// JND is 1 if the evaluator detected a difference and 0 if not.
	JND ScoreType = "JND"
	// ViSQOL is the ViSQOL MOS.
	ViSQOL = "ViSQOL"
)

func (ScoreType) Better added in v0.1.11

func (s ScoreType) Better() int

Better returns 1 if higher is better for the score type, or -1 if lower is better.

type ScoreTypes

type ScoreTypes []ScoreType

ScoreTypes is a slice of ScoreType.

func (ScoreTypes) Len

func (s ScoreTypes) Len() int

func (ScoreTypes) Less

func (s ScoreTypes) Less(i, j int) bool

func (ScoreTypes) Swap

func (s ScoreTypes) Swap(i, j int)

type Study

type Study struct {
	// contains filtered or unexported fields
}

Study contains data from a study.

func OpenStudy

func OpenStudy(dir string) (*Study, error)

OpenStudy opens a study from a database directory. If the study doesn't exist, it will be created.

func (*Study) Accuracy added in v0.1.11

func (s *Study) Accuracy() (AccuracyScores, error)

Accuracy returns the accuracy of each score type when used to predict audible differences.

func (*Study) Calculate

func (s *Study) Calculate(measurements map[ScoreType]Measurement, pool *worker.Pool[any]) error

Calculate computes measurements and populates the scores of the distortions.

func (*Study) Close

func (s *Study) Close() error

Close closes the study.

func (*Study) Correlate

func (s *Study) Correlate() (CorrelationTable, error)

Correlate returns a table of all scores in the study Spearman correlated to each other.

func (*Study) Put

func (s *Study) Put(refs []*Reference) error

Put inserts some references into a study.

func (*Study) ViewEachReference

func (s *Study) ViewEachReference(f func(*Reference) error) error

ViewEachReference returns each reference in the study.

type Table

type Table []Row

Table is table structured data that can render in straight columns in a terminal.

func (Table) String

func (t Table) String(colSpacing int) string

String returns a string representation of the table with colSpacing blanks between columns.

Jump to

Keyboard shortcuts

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