Skip to content

Commit

Permalink
update core.Plan -> tree.Plan
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Jun 20, 2024
1 parent f2ab0d2 commit 129d616
Show file tree
Hide file tree
Showing 34 changed files with 153 additions and 121 deletions.
15 changes: 8 additions & 7 deletions axon/layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"cogentcore.org/core/core"
"cogentcore.org/core/icons"
"cogentcore.org/core/tensor"
"cogentcore.org/core/tree"
"github.com/emer/emergent/v2/params"
)

Expand Down Expand Up @@ -891,21 +892,21 @@ func (ly *Layer) LesionNeurons(prop float32) int { //types:add
return nl
}

func (ly *Layer) MakeToolbar(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
func (ly *Layer) MakeToolbar(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ly.Defaults).SetIcon(icons.Reset)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ly.InitWts).SetIcon(icons.Reset)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ly.InitActs).SetIcon(icons.Reset)
})
core.Add(p, func(w *core.Separator) {})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.Separator) {})
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ly.LesionNeurons).SetIcon(icons.Cut)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ly.UnLesionNeurons).SetIcon(icons.Cut)
})
}
17 changes: 9 additions & 8 deletions axon/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"cogentcore.org/core/core"
"cogentcore.org/core/icons"
"cogentcore.org/core/tensor"
"cogentcore.org/core/tree"
"github.com/emer/emergent/v2/emer"
"github.com/emer/emergent/v2/paths"
)
Expand Down Expand Up @@ -686,29 +687,29 @@ func (nt *Network) SizeReport(detail bool) string {
return b.String()
}

func (nt *Network) MakeToolbar(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
func (nt *Network) MakeToolbar(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(nt.ShowAllGlobals).SetText("Global Vars").SetIcon(icons.Info)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(nt.SaveWtsJSON).
SetText("Save Weights").SetIcon(icons.Save)
w.Args[0].SetTag(`"ext:".wts,.wts.gz"`)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(nt.OpenWtsJSON).SetText("Open Weights").SetIcon(icons.Open)
w.Args[0].SetTag(`"ext:".wts,.wts.gz"`)
})

core.Add(p, func(w *core.Separator) {})
tree.Add(p, func(w *core.Separator) {})

core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(nt.Build).SetIcon(icons.Reset)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(nt.InitWts).SetIcon(icons.Reset)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(nt.InitActs).SetIcon(icons.Reset)
})
}
7 changes: 4 additions & 3 deletions chans/ak_plot/ak_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"cogentcore.org/core/icons"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
)

Expand Down Expand Up @@ -301,11 +302,11 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
9 changes: 5 additions & 4 deletions chans/gabab_plot/gabab_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"cogentcore.org/core/math32"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
)

Expand Down Expand Up @@ -318,14 +319,14 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VGRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.SGRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
7 changes: 4 additions & 3 deletions chans/kir_plot/kir_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"cogentcore.org/core/icons"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
)

Expand Down Expand Up @@ -244,11 +245,11 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
7 changes: 4 additions & 3 deletions chans/mahp_plot/mahp_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"cogentcore.org/core/icons"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
)

Expand Down Expand Up @@ -242,11 +243,11 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
7 changes: 4 additions & 3 deletions chans/nmda_plot/nmda_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"cogentcore.org/core/math32"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
)

Expand Down Expand Up @@ -250,11 +251,11 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.Run).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
7 changes: 4 additions & 3 deletions chans/sahp_plot/sahp_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"cogentcore.org/core/icons"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
)

Expand Down Expand Up @@ -218,11 +219,11 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.CaRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
7 changes: 4 additions & 3 deletions chans/skca_plot/skca_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"cogentcore.org/core/icons"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
"github.com/emer/axon/v2/kinase"
)
Expand Down Expand Up @@ -228,11 +229,11 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.CamRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
7 changes: 4 additions & 3 deletions chans/vgcc_plot/vgcc_plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"cogentcore.org/core/icons"
"cogentcore.org/core/plot/plotcore"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/chans"
)

Expand Down Expand Up @@ -246,11 +247,11 @@ func (ss *Sim) ConfigGUI() *core.Body {

split.SetSplits(.3, .7)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.FuncButton) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.VmRun).SetIcon(icons.PlayArrow)
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(ss.TimeRun).SetIcon(icons.PlayArrow)
})
})
Expand Down
17 changes: 9 additions & 8 deletions examples/choose/armaze/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"cogentcore.org/core/styles/abilities"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tensor/tensorcore"
"cogentcore.org/core/tree"
"cogentcore.org/core/xyz"
"cogentcore.org/core/xyz/physics"
"cogentcore.org/core/xyz/physics/world"
Expand Down Expand Up @@ -285,47 +286,47 @@ func (vw *GUI) ConfigWorldGUI(ev *Env) *core.Body {

split.SetSplits(.4, .6)

b.AddAppBar(func(p *core.Plan) {
core.Add(p, func(w *core.Button) {
b.AddAppBar(func(p *tree.Plan) {
tree.Add(p, func(w *core.Button) {
w.SetText("Init").SetIcon(icons.ClearAll).
SetTooltip("Init env").
OnClick(func(e events.Event) {
vw.Env.Init(0)
})
})
core.Add(p, func(w *core.Button) {
tree.Add(p, func(w *core.Button) {
w.SetText("Reset Trace").SetIcon(icons.Undo).
SetTooltip("Reset trace of position, etc, shown in 2D View").
OnClick(func(e events.Event) {
vw.Trace = nil
})
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Forward).SetText("Fwd").SetIcon(icons.SkipNext).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Left).SetText("Left").SetIcon(icons.KeyboardArrowLeft).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Right).SetText("Right").SetIcon(icons.KeyboardArrowRight).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})
core.Add(p, func(w *core.FuncButton) {
tree.Add(p, func(w *core.FuncButton) {
w.SetFunc(vw.Consume).SetText("Consume").SetIcon(icons.SentimentExcited).
Styler(func(s *styles.Style) {
s.SetAbilities(true, abilities.RepeatClickable)
})
})

core.Add(p, func(w *core.Separator) {})
tree.Add(p, func(w *core.Separator) {})
})
return b
}
Expand Down
7 changes: 4 additions & 3 deletions examples/choose/choose.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"cogentcore.org/core/tensor/stats/split"
"cogentcore.org/core/tensor/stats/stats"
"cogentcore.org/core/tensor/table"
"cogentcore.org/core/tree"
"github.com/emer/axon/v2/axon"
"github.com/emer/axon/v2/examples/choose/armaze"
"github.com/emer/emergent/v2/econfig"
Expand Down Expand Up @@ -1363,7 +1364,7 @@ func (ss *Sim) ConfigGUI() {
plt.Params.XAxisColumn = "BadUSGate"
plt.SetTable(dt)

ss.GUI.Body.AddAppBar(func(p *core.Plan) {
ss.GUI.Body.AddAppBar(func(p *tree.Plan) {
ss.GUI.AddToolbarItem(p, egui.ToolbarItem{Label: "Init", Icon: icons.Update,
Tooltip: "Initialize everything including network weights, and start over. Also applies current params.",
Active: egui.ActiveStopped,
Expand All @@ -1376,7 +1377,7 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.AddLooperCtrl(p, ss.Loops, []etime.Modes{etime.Train})

////////////////////////////////////////////////
core.Add(p, func(w *core.Separator) {})
tree.Add(p, func(w *core.Separator) {})
ss.GUI.AddToolbarItem(p, egui.ToolbarItem{Label: "Reset RunLog",
Icon: icons.Reset,
Tooltip: "Reset the accumulated log of all NRuns, which are tagged with the ParamSet used",
Expand All @@ -1387,7 +1388,7 @@ func (ss *Sim) ConfigGUI() {
},
})
////////////////////////////////////////////////
core.Add(p, func(w *core.Separator) {})
tree.Add(p, func(w *core.Separator) {})
ss.GUI.AddToolbarItem(p, egui.ToolbarItem{Label: "New Seed",
Icon: icons.Add,
Tooltip: "Generate a new initial random seed to get different results. By default, Init re-establishes the same initial seed every time.",
Expand Down
Loading

0 comments on commit 129d616

Please sign in to comment.