netview

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package netview provides the NetView interactive 3D network viewer, implemented in the GoGi 3D framework.

Index

Constants

This section is empty.

Variables

View Source
var KiT_LayMesh = kit.Types.AddType(&LayMesh{}, nil)
View Source
var KiT_NetView = kit.Types.AddType(&NetView{}, NetViewProps)
View Source
var MinUnitHeight = float32(1.0e-6)

MinUnitHeight ensures that there is always at least some dimensionality to the unit cubes -- affects transparency rendering etc

View Source
var NetViewProps = ki.Props{
	"max-width":  -1,
	"max-height": -1,

	"CallMethods": ki.PropSlice{
		{"SaveWeights", ki.Props{
			"desc": "save network weights to file",
			"icon": "file-save",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"ext": ".wts",
				}},
			},
		}},
		{"OpenWeights", ki.Props{
			"desc": "open network weights from file",
			"icon": "file-open",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"ext": ".wts",
				}},
			},
		}},
	},
}

Functions

This section is empty.

Types

type LayMesh

type LayMesh struct {
	gi3d.MeshBase
	Lay   emer.Layer    `desc:"layer that we render"`
	Shape etensor.Shape `desc:"current shape that has been constructed -- if same, just update"`
	View  *NetView      `desc:"netview that we're in"`
}

LayMesh is a gi3d.Mesh that represents a layer -- it is dynamically updated using the Update method which only resets the essential Vertex elements. The geometry is literal in the layer size: 0,0,0 lower-left corner and increasing X,Z for the width and height of the layer, in unit (1) increments per unit.. NetView applies an overall scaling to make it fit within the larger view.

func AddNewLayMesh

func AddNewLayMesh(sc *gi3d.Scene, nv *NetView, lay emer.Layer) *LayMesh

AddNewLayMesh adds LayMesh mesh to given scene for given layer

func (*LayMesh) Make

func (lm *LayMesh) Make(sc *gi3d.Scene)

func (*LayMesh) Make2D

func (lm *LayMesh) Make2D(init bool)

func (*LayMesh) Make4D

func (lm *LayMesh) Make4D(init bool)

func (*LayMesh) Update

func (lm *LayMesh) Update(sc *gi3d.Scene)

type NetView

type NetView struct {
	gi.Layout
	Net          emer.Network          `desc:"the network that we're viewing"`
	Var          string                `desc:"current variable that we're viewing"`
	Vars         []string              `desc:"the list of variables to view, along with view-specific params"`
	VarParams    map[string]*VarParams `desc:"parameters for the list of variables to view"`
	CurVarParams *VarParams            `json:"-" xml:"-" view:"-" desc:"current var params -- only valid during Update of display"`
	Params       Params                `desc:"parameters controlling how the view is rendered"`
	ColorMap     *giv.ColorMap         `desc:"color map for mapping values to colors -- set by name in Params"`
}

NetView is a GoGi Widget that provides a 3D network view using the GoGi gi3d 3D framework.

func AddNewNetView

func AddNewNetView(parent ki.Ki, name string) *NetView

AddNewNetView adds a new NetView to given parent node, with given name.

func (*NetView) Config

func (nv *NetView) Config()

Config configures the overall view widget

func (*NetView) Counters

func (nv *NetView) Counters() *gi.Label

func (*NetView) Defaults

func (nv *NetView) Defaults()

func (*NetView) GoUpdate

func (nv *NetView) GoUpdate(counters string)

GoUpdate is the update call to make from another go routine it does the proper blocking to coordinate with GUI updates generated on the main GUI thread.

func (*NetView) HasLayers

func (nv *NetView) HasLayers() bool

func (*NetView) IsConfiged

func (nv *NetView) IsConfiged() bool

IsConfiged returns true if widget is fully configured

func (*NetView) NetLay

func (nv *NetView) NetLay() *gi.Layout

func (*NetView) OpenWeights

func (nv *NetView) OpenWeights(filename gi.FileName)

OpenWeights opens the network weights -- when called with giv.CallMethod it will auto-prompt for filename

func (*NetView) SaveWeights

func (nv *NetView) SaveWeights(filename gi.FileName)

SaveWeights saves the network weights -- when called with giv.CallMethod it will auto-prompt for filename

func (*NetView) Scene

func (nv *NetView) Scene() *gi3d.Scene

func (*NetView) SetCounters

func (nv *NetView) SetCounters(ctrs string)

func (*NetView) SetNet

func (nv *NetView) SetNet(net emer.Network)

SetNet sets the network to view and updates view

func (*NetView) SetVar

func (nv *NetView) SetVar(vr string)

SetVar sets the variable to view and updates the display

func (*NetView) ShowAllParams

func (nv *NetView) ShowAllParams() string

ShowAllParams shows a dialog of all the parameters in the network.

func (*NetView) ShowNonDefaultParams

func (nv *NetView) ShowNonDefaultParams() string

ShowNonDefaultParams shows a dialog of all the parameters that are not at their default values in the network. Useful for setting params.

func (*NetView) Toolbar

func (nv *NetView) Toolbar() *gi.ToolBar

func (*NetView) ToolbarConfig

func (nv *NetView) ToolbarConfig()

func (*NetView) UnitVal

func (nv *NetView) UnitVal(lay emer.Layer, idx []int) (raw, scaled float32, clr gi.Color)

UnitVal returns the raw value, scaled value, and color representation for given unit of given layer scaled is in range -1..1 todo: incorporate history etc..

func (*NetView) Update

func (nv *NetView) Update(counters string)

Update updates the display based on current state of network counters string, if non-empty, will be displayed at bottom of view, showing current counter state This version is for calling within main window eventloop goroutine use GoUpdate version for calling outside of main goroutine.

func (*NetView) UpdateImpl

func (nv *NetView) UpdateImpl(counters string)

func (*NetView) VarScaleUpdate

func (nv *NetView) VarScaleUpdate(varNm string) bool

VarScaleUpdate updates display of the scaling params for given variable (use nv.Var for current) returns true if any setting changed (update always triggered)

func (*NetView) VarsConfig

func (nv *NetView) VarsConfig()

VarsConfig configures the variables

func (*NetView) VarsLay

func (nv *NetView) VarsLay() *gi.Frame

func (*NetView) VarsListUpdate

func (nv *NetView) VarsListUpdate()

VarsListUpdate updates the list of network variables

func (*NetView) VarsUpdate

func (nv *NetView) VarsUpdate()

VarsUpdate updates the selection status of the variables and the view range state too

func (*NetView) ViewConfig

func (nv *NetView) ViewConfig()

ViewConfig configures the 3D view

func (*NetView) ViewDefaults

func (nv *NetView) ViewDefaults()

ViewDefaults are the default 3D view params

func (*NetView) Viewbar

func (nv *NetView) Viewbar() *gi.ToolBar

func (*NetView) ViewbarConfig

func (nv *NetView) ViewbarConfig()

type Params

type Params struct {
	UnitSize  float32          `min:"0.1" max:"1" step:"0.1" def:"0.9" desc:"size of a single unit, where 1 = full width and no space.. .9 default"`
	LayNmSize float32          `min:"0.01" max:".1" step:"0.01" def:"0.05" desc:"size of the layer name labels -- entire network view is unit sized"`
	ColorMap  giv.ColorMapName `desc:"name of color map to use"`
	ZeroAlpha float32          `` /* 158-byte string literal not displayed */
	NetView   *NetView         `copy:"-" json:"-" xml:"-" view:"-" desc:"our netview, for update method"`
}

Params holds parameters controlling how the view is rendered

func (*Params) Defaults

func (nv *Params) Defaults()

func (*Params) Update

func (nv *Params) Update()

Update satisfies the gi.Updater interface and will trigger display update on edits

type VarParams

type VarParams struct {
	Var     string         `desc:"name of the variable"`
	ZeroCtr bool           `` /* 139-byte string literal not displayed */
	Range   minmax.Range32 `view:"inline" desc:"range to display"`
	MinMax  minmax.F32     `view:"inline" desc:"if not using fixed range, this is the actual range of data"`
}

VarParams holds parameters for display of each variable

func (*VarParams) Defaults

func (vp *VarParams) Defaults()

Defaults sets default values if otherwise not set

Jump to

Keyboard shortcuts

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