go: standardise output dirs for reporting material
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
65b1ce02df
commit
7b22723cb0
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,6 +4,8 @@
|
||||
result
|
||||
result-*
|
||||
math-optim
|
||||
# output dir for generated plot pics/tex files
|
||||
out
|
||||
|
||||
.vimrc
|
||||
|
||||
|
@ -14,8 +14,6 @@ import (
|
||||
// methods over it.
|
||||
type Values []float64
|
||||
|
||||
var picPath = "res/"
|
||||
|
||||
var plotWg sync.WaitGroup
|
||||
|
||||
// DoRandomSearch executes a search using the 'Random search' method.
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"git.dotya.ml/wanderer/math-optim/report"
|
||||
)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
@ -18,7 +20,9 @@ func TestDoRandomSearchExec(t *testing.T) {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
if err := os.RemoveAll(picPath); err != nil {
|
||||
picsDir := report.GetPicsDir()
|
||||
|
||||
if err := os.RemoveAll(picsDir); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
@ -30,7 +34,9 @@ func TestDoSHCExec(t *testing.T) {
|
||||
|
||||
wg.Wait()
|
||||
|
||||
if err := os.RemoveAll(picPath); err != nil {
|
||||
picsDir := report.GetPicsDir()
|
||||
|
||||
if err := os.RemoveAll(picsDir); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
14
algo/plot.go
14
algo/plot.go
@ -9,6 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.dotya.ml/wanderer/math-optim/report"
|
||||
"git.dotya.ml/wanderer/math-optim/stats"
|
||||
"git.dotya.ml/wanderer/math-optim/util"
|
||||
"gonum.org/v1/gonum/floats"
|
||||
@ -26,6 +27,13 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string, wg *sync.WaitGro
|
||||
defer wg.Done() // does this work with panic in the mix? TODO(me): find out.
|
||||
|
||||
start := time.Now()
|
||||
|
||||
picsDir := report.GetPicsDir()
|
||||
|
||||
if err := util.CreatePath(picsDir); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
pWidth := 13 * vg.Centimeter
|
||||
pHeight := 13 * vg.Centimeter
|
||||
|
||||
@ -89,11 +97,7 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string, wg *sync.WaitGro
|
||||
log.Panic(err)
|
||||
}
|
||||
|
||||
if err := util.CreatePath(picPath); err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
filename := picPath +
|
||||
filename := picsDir +
|
||||
fPrefix + "-" +
|
||||
util.SanitiseFName(s.Algo) + "-" +
|
||||
util.SanitiseFName(dim.BenchName) + "-" +
|
||||
|
@ -12,6 +12,16 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
const (
|
||||
outPrefix = "out/"
|
||||
picsDir = "pics/"
|
||||
)
|
||||
|
||||
// GetPicsDirPrefix returns the path to the folder meant for plot pics.
|
||||
func GetPicsDir() string {
|
||||
return outPrefix + picsDir
|
||||
}
|
||||
|
||||
// Print prints stats in a report format.
|
||||
func Print() {
|
||||
fmt.Fprint(os.Stderr, "\n* printing the report...\n\n")
|
||||
|
Loading…
Reference in New Issue
Block a user