analysis

package
v0.0.0-...-1afd41f Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchToCSVRow

func MatchToCSVRow(m api.Match) []string

Function that converts a match type object to a string slice to allow writing it to a csv file. Takes in a match type object and outputs a string slice.

func MatchesToCSV

func MatchesToCSV(matches []api.Match, filename string) ([][]string, error)

Helper function that writes an array of Matches to a csv file. Takes in slice of Match types and a filename for the output csv file. Returns the output 2D array and an error. This function does not modify the global state and has the side effect of creating a file under filename.

func OPRToCSV

func OPRToCSV(oprs []OPR, filename string) ([][]string, error)

Function OPRToCSV converts an OPR type slice into a 2D string array and then writes it to a csv file called 'filename'.

func OPRToCSVRow

func OPRToCSVRow(o OPR) []string

Function OPRToCSVRow is a helper function for OPRToCSV that converts a singular OPR object 'o' to a string slice, formatted as a csv file row.

func SummaryStatsToCSV

func SummaryStatsToCSV(stats []SummaryStats, filename string) ([][]string, error)

Function SummaryStatsToCSV converts an array of SummaryStats to a 2D string array and writes the output to a csv file. It takes in a SummaryStats slice and a string for the filename and returns a 2D string slice and an error.

func SummaryStatsToCSVRow

func SummaryStatsToCSVRow(s SummaryStats) []string

Function SummaryStatsToCSVRow converts a SummaryStats object to a csv row string. It takes in a SummaryStats object and outputs a string slice.

func TeamMatches

func TeamMatches(matches []api.Match, teamKey string) ([]api.Match, error)

Function to get a subset of matches from an event containing only matches a specified team was a part of. Takes in a pointer to the event matches object and a team key to search for. Returns a slice of matches and error. This function does not modify the global state and has no side effects

func TeamMatchesToCSV

func TeamMatchesToCSV(matches []api.Match, teamKey string, filename string) ([][]string, error)

Function that writes the output of TeamMatches to a csv file. Takes in a pointer to the event matches object and a team key to search for. Returns an error if the write failed.

Types

type AllianceInfo

type AllianceInfo struct {
	Alliances  [][]string
	Scores     []float64
	AutoScores []float64
	TeleScores []float64
	RP         []float64
}

func GetEventAlliances

func GetEventAlliances(matches []api.Match) (AllianceInfo, []string, error)

Function GetEventAlliances is a helper function for statistical analysis functions that extracts team and score info from match breakdowns. It takes in a api.Match slice and outputs an AllianceInfo object, a string slice containing all unique team keys for an event, and an error.

type OPR

type OPR struct {
	TeamKey   string
	OPR       float64
	AutoOPR   float64
	TeleopOPR float64
	RPOPR     float64
}

func CalcEventOPR

func CalcEventOPR(matches []api.Match, a AllianceInfo, teams []string) ([]OPR, error)

Function that calculates expected contribution for each team at an event. Takes in []Match type array and outputs []OPR type array and error. Does not modify the global state and has no side effects.

type SummaryStats

type SummaryStats struct {
	TeamKey   string
	MeanScore float64
	// MedianScore float64 // TODO: add median later
	MaxScore   float64 // TODO: maybe make this a weighted metric to reduce outliers
	MeanAuto   float64
	MeanTeleop float64
}

func CalcTeamSummaryStats

func CalcTeamSummaryStats(a AllianceInfo, teamKey string) (SummaryStats, error)

Function CalcTeamSummaryStats calculates summary statistics (mean, max, median) for each team at an event. It takes in an AllianceInfo object from alliance_utils.go and a string definining which team to evaluate statistics for. It returns a SummaryStats object and an error.

Jump to

Keyboard shortcuts

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