MCPcopy Create free account
hub / github.com/cogentcore/core / AvgCat

Function AvgCat

tensor/cmd/tablecat/tablecat.go:110–132  ·  view source on GitHub ↗

AvgCat computes average across all runs

(files []string)

Source from the content-addressed store, hash-verified

108
109// AvgCat computes average across all runs
110func AvgCat(files []string) {
111 dts := make([]*table.Table, 0, len(files))
112 for _, fn := range files {
113 dt := &table.Table{}
114 err := dt.OpenCSV(core.Filename(fn), table.Tab)
115 if err != nil {
116 fmt.Println("Error opening file: ", err)
117 continue
118 }
119 if dt.Rows == 0 {
120 fmt.Printf("File %v empty\n", fn)
121 continue
122 }
123 dts = append(dts, dt)
124 }
125 if len(dts) == 0 {
126 fmt.Println("No files or files are empty, exiting")
127 return
128 }
129 avgdt := stats.MeanTables(dts)
130 avgdt.SetMetaData("precision", strconv.Itoa(LogPrec))
131 avgdt.SaveCSV(core.Filename(Output), table.Tab, table.Headers)
132}
133
134// AvgByColumn computes average by given column for given files
135// If column is empty, averages across all rows.

Callers 1

mainFunction · 0.85

Calls 7

OpenCSVMethod · 0.95
FilenameTypeAlias · 0.92
MeanTablesFunction · 0.92
PrintlnMethod · 0.80
SetMetaDataMethod · 0.65
PrintfMethod · 0.45
SaveCSVMethod · 0.45

Tested by

no test coverage detected