Skip to content

Commit

Permalink
updated to latest api
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Dec 20, 2023
1 parent 9848f83 commit bc1c277
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
sudo apt-get install libgl1-mesa-dev xorg-dev mesa-vulkan-drivers
- uses: actions/setup-go@v3
with:
go-version: "1.19"
go-version: "1.21"
- run: go build ./...
- run: go test -tags=multinet -race ./...

Expand All @@ -38,7 +38,7 @@ jobs:
sudo apt-get install libgl1-mesa-dev xorg-dev mesa-vulkan-drivers
- uses: actions/setup-go@v3
with:
go-version: "1.19"
go-version: "1.21"
- name: Generate coverage report
run: go test -tags=multinet ./... -coverprofile=coverage.txt -covermode=atomic -timeout=20m
- name: Upload coverage report
Expand Down
4 changes: 2 additions & 2 deletions axon/networkbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ func (nt *NetworkBase) Layout() {

// BoundsUpdt updates the Min / Max display bounds for 3D display
func (nt *NetworkBase) BoundsUpdt() {
mn := mat32.NewVec3Scalar(mat32.Infinity)
mx := mat32.Vec3Zero
mn := mat32.V3Scalar(mat32.Infinity)
mx := mat32.Vec3{}
for _, ly := range nt.Layers {
ps := ly.Pos()
sz := ly.Size()
Expand Down
4 changes: 2 additions & 2 deletions examples/bench_objrec/leds.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (ld *LEDraw) Init() {
}
ld.Paint = paint.NewContextFromImage(ld.Image)
ld.Paint.StrokeStyle.Width.Pw(ld.Width)
ld.Paint.StrokeStyle.Color.SetSolid(ld.LineColor)
ld.Paint.FillStyle.Color.SetSolid(ld.BgColor)
ld.Paint.StrokeStyle.Color = colors.C(ld.LineColor)
ld.Paint.FillStyle.Color = colors.C(ld.BgColor)
ld.Paint.SetUnitContextExt(ld.ImgSize)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/bench_objrec/objrec.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ func (ss *Sim) ConfigGUI() {
nv.SetNet(ss.Net)
ss.ViewUpdt.Config(nv, etime.Phase, etime.Phase)

cam := &(nv.Scene().Camera)
cam := &(nv.SceneXYZ().Camera)
cam.Pose.Pos.Set(0.0, 1.733, 2.3)
cam.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})

Expand Down
23 changes: 12 additions & 11 deletions examples/boa/armaze/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type GUI struct {
EnvName string

// 3D visualization of the Scene
Scene3D *xyzv.Scene3D
SceneView *xyzv.SceneView

// 2D visualization of the Scene
Scene2D *gi.SVG
Expand Down Expand Up @@ -250,16 +250,17 @@ func (vw *GUI) ConfigWorldGUI(ev *Env) *gi.Body {

vw.ConfigWorld()

vw.Scene3D = xyzv.NewScene3D(scfr, "sceneview")
se := vw.Scene3D.Scene
vw.SceneView = xyzv.NewSceneView(scfr, "sceneview")
vw.SceneView.Config()
se := vw.SceneView.SceneXYZ()
vw.ConfigView3D(se)

se.Camera.Pose.Pos = mat32.Vec3{0, 29, -4}
se.Camera.LookAt(mat32.Vec3{0, 4, -5}, mat32.Vec3Y)
se.Camera.LookAt(mat32.Vec3{0, 4, -5}, mat32.V3(0, 1, 0))
se.SaveCamera("2")

se.Camera.Pose.Pos = mat32.Vec3{0, 17, 21}
se.Camera.LookAt(mat32.Vec3{0, 3.6, 0}, mat32.Vec3Y)
se.Camera.LookAt(mat32.Vec3{0, 3.6, 0}, mat32.V3(0, 1, 0))
se.SaveCamera("1")
se.SaveCamera("default")

Expand Down Expand Up @@ -560,7 +561,7 @@ func (vw *GUI) ConfigWorldView(tg *etview.TensorGrid) {
func (vw *GUI) UpdateWorld(ctx *axon.Context, ev *Env, net *axon.Network, state TraceStates) {
vw.State = state
vw.Trace.AddRec(ctx, uint32(ev.Di), ev, net, state)
if vw.Scene3D == nil || !vw.Disp {
if vw.SceneView == nil || !vw.Disp {
return
}

Expand All @@ -583,11 +584,11 @@ func (vw *GUI) SetEmeryPose() {
}

func (vw *GUI) UpdateWorldGUI() {
if vw.Scene3D == nil || !vw.Disp {
if vw.SceneView == nil || !vw.Disp {
return
}
updt := vw.Scene3D.Sc.UpdateStartAsync()
defer vw.Scene3D.Sc.UpdateEndAsyncRender(updt)
updt := vw.SceneView.Sc.UpdateStartAsync()
defer vw.SceneView.Sc.UpdateEndAsyncRender(updt)

// update state:
vw.SetEmeryPose()
Expand All @@ -599,8 +600,8 @@ func (vw *GUI) UpdateWorldGUI() {

// update views:
vw.GrabEyeImg()
if vw.Scene3D.IsVisible() {
vw.Scene3D.SetNeedsRender(true)
if vw.SceneView.IsVisible() {
vw.SceneView.SetNeedsRender(true)
}
// if vw.Scene2D.IsVisible() {
// vw.Scene2D.SetNeedsRender(true)
Expand Down
4 changes: 2 additions & 2 deletions examples/boa/boa.go
Original file line number Diff line number Diff line change
Expand Up @@ -1221,8 +1221,8 @@ func (ss *Sim) ConfigGUI() {
nv.SetNet(ss.Net)
ss.ViewUpdt.Config(nv, etime.Phase, etime.Phase)

nv.Scene().Camera.Pose.Pos.Set(0, 1.4, 2.6)
nv.Scene().Camera.LookAt(mat32.Vec3{X: 0, Y: 0, Z: 0}, mat32.Vec3{X: 0, Y: 1, Z: 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 1.4, 2.6)
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{X: 0, Y: 0, Z: 0}, mat32.Vec3{X: 0, Y: 1, Z: 0})

ss.GUI.ViewUpdt = &ss.ViewUpdt

Expand Down
4 changes: 2 additions & 2 deletions examples/deep_move/deep_move.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@ func (ss *Sim) Log(mode etime.Modes, time etime.Times) {

func (ss *Sim) ConfigNetView(nv *netview.NetView) {
nv.ViewDefaults()
nv.Scene().Camera.Pose.Pos.Set(0, 2.1, 2.0)
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 2.1, 2.0)
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
}

// ConfigGUI configures the GoGi gui interface for this simulation,
Expand Down
4 changes: 2 additions & 2 deletions examples/deep_music/deep_music.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ func (ss *Sim) Log(mode etime.Modes, time etime.Times) {

func (ss *Sim) ConfigNetView(nv *netview.NetView) {
nv.ViewDefaults()
nv.Scene().Camera.Pose.Pos.Set(0, 2.1, 2.0)
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 2.1, 2.0)
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
}

// ConfigGUI configures the GoGi gui interface for this simulation,
Expand Down
4 changes: 2 additions & 2 deletions examples/hip/hip.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,8 @@ func (ss *Sim) ConfigGUI() {
ss.ViewUpdt.Config(nv, etime.Phase, etime.Phase)
ss.GUI.ViewUpdt = &ss.ViewUpdt

nv.Scene().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})

ss.GUI.AddPlots(title, &ss.Logs)

Expand Down
4 changes: 2 additions & 2 deletions examples/inhib/inhib.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ func (ss *Sim) ConfigGUI() {
ss.ViewUpdt.Config(nv, etime.AlphaCycle, etime.AlphaCycle)
ss.GUI.ViewUpdt = &ss.ViewUpdt

nv.Scene().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})

ss.GUI.AddPlots(title, &ss.Logs)

Expand Down
4 changes: 2 additions & 2 deletions examples/mpi/ra25.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,8 @@ func (ss *Sim) ConfigGUI() {
ss.ViewUpdt.Config(nv, etime.Phase, etime.Phase)
ss.GUI.ViewUpdt = &ss.ViewUpdt

nv.Scene().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})

ss.GUI.AddPlots(title, &ss.Logs)

Expand Down
19 changes: 8 additions & 11 deletions examples/neuron/neuron.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/emer/emergent/v2/params"
"github.com/emer/emergent/v2/prjn"
"github.com/emer/empi/v2/mpi"
"goki.dev/etable/v2/eplot"
"goki.dev/etable/v2/etable"
"goki.dev/etable/v2/etensor"
_ "goki.dev/etable/v2/etview" // include to get gui views
Expand Down Expand Up @@ -122,9 +121,6 @@ type Sim struct {
// manages all the gui elements
GUI egui.GUI `view:"-"`

// the test-trial plot
TstCycPlot *eplot.Plot2D `view:"-"`

// map of values for detailed debugging / testing
ValMap map[string]float32 `view:"-"`
}
Expand Down Expand Up @@ -201,7 +197,7 @@ func (ss *Sim) Counters() string {
}

func (ss *Sim) UpdateView() {
ss.TstCycPlot.UpdatePlot()
ss.GUI.UpdatePlot(etime.Test, etime.Cycle)
ss.GUI.ViewUpdt.Text = ss.Counters()
ss.GUI.ViewUpdt.UpdateCycle(int(ss.Context.Cycle))
}
Expand Down Expand Up @@ -373,7 +369,7 @@ func (ss *Sim) ConfigLogItems() {

func (ss *Sim) ResetTstCycPlot() {
ss.Logs.ResetLog(etime.Test, etime.Cycle)
ss.TstCycPlot.GoUpdatePlot()
ss.GUI.UpdatePlot(etime.Test, etime.Cycle)
}

////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -396,11 +392,12 @@ func (ss *Sim) ConfigGUI() {
ss.ViewUpdt.Config(nv, etime.AlphaCycle, etime.AlphaCycle)
ss.GUI.ViewUpdt = &ss.ViewUpdt

plt := eplot.NewPlot2D(ss.GUI.Tabs.NewTab("TstCycPlot"))
key := etime.Scope(etime.Test, etime.Cycle)
plt.SetTable(ss.Logs.Table(etime.Test, etime.Cycle))
egui.ConfigPlotFromLog("Neuron", plt, &ss.Logs, key)
ss.TstCycPlot = plt
ss.GUI.AddPlots(title, &ss.Logs)
// key := etime.Scope(etime.Test, etime.Cycle)
// plt := ss.GUI.NewPlot(key, ss.GUI.Tabs.NewTab("TstCycPlot"))
// plt.SetTable(ss.Logs.Table(etime.Test, etime.Cycle))
// egui.ConfigPlotFromLog("Neuron", plt, &ss.Logs, key)
// ss.TstCycPlot = plt

ss.GUI.Body.AddAppBar(func(tb *gi.Toolbar) {
ss.GUI.AddToolbarItem(tb, egui.ToolbarItem{Label: "Init", Icon: "update",
Expand Down
4 changes: 2 additions & 2 deletions examples/pvlv/pvlv.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,8 @@ func (ss *Sim) ConfigGUI() {
ss.ViewUpdt.Config(nv, etime.Phase, etime.Phase)
ss.GUI.ViewUpdt = &ss.ViewUpdt

nv.Scene().Camera.Pose.Pos.Set(0, 1.4, 2.6)
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 1.4, 2.6)
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})

ss.GUI.AddPlots(title, &ss.Logs)

Expand Down
4 changes: 2 additions & 2 deletions examples/ra25/ra25.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,8 @@ func (ss *Sim) ConfigGUI() {
ss.ViewUpdt.Config(nv, etime.Phase, etime.Phase)
ss.GUI.ViewUpdt = &ss.ViewUpdt

nv.Scene().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})

ss.GUI.AddPlots(title, &ss.Logs)

Expand Down
4 changes: 2 additions & 2 deletions examples/ra25x/ra25x.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,8 @@ func (ss *Sim) ConfigGUI() {
ss.ViewUpdt.Config(nv, etime.Phase, etime.Phase)
ss.GUI.ViewUpdt = &ss.ViewUpdt

nv.Scene().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.Scene().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})
nv.SceneXYZ().Camera.Pose.Pos.Set(0, 1, 2.75) // more "head on" than default which is more "top down"
nv.SceneXYZ().Camera.LookAt(mat32.Vec3{0, 0, 0}, mat32.Vec3{0, 1, 0})

ss.GUI.AddPlots(title, &ss.Logs)

Expand Down

0 comments on commit bc1c277

Please sign in to comment.