Documentation
¶
Overview ¶
Package netview provides the NetView interactive 3D network viewer, implemented in the GoGi 3D framework.
Index ¶
- Constants
- Variables
- type LayData
- type LayMesh
- func (lm *LayMesh) RasterSet2DX(sc *xyz.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- func (lm *LayMesh) RasterSet2DZ(sc *xyz.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- func (lm *LayMesh) RasterSet4DX(sc *xyz.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- func (lm *LayMesh) RasterSet4DZ(sc *xyz.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- func (lm *LayMesh) RasterSize2D() (nVtx, nIdx int)
- func (lm *LayMesh) RasterSize4D() (nVtx, nIdx int)
- func (lm *LayMesh) Set(sc *xyz.Scene, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- func (lm *LayMesh) Set2D(sc *xyz.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- func (lm *LayMesh) Set4D(sc *xyz.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- func (lm *LayMesh) Size2D() (nVtx, nIdx int)
- func (lm *LayMesh) Size4D() (nVtx, nIdx int)
- func (lm *LayMesh) Sizes() (nVtx, nIdx int, hasColor bool)
- func (lm *LayMesh) Update(sc *xyz.Scene, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, ...)
- type LayName
- type LayObj
- type NetData
- func (nd *NetData) Config()
- func (nd *NetData) CounterRec(recno int) string
- func (nd *NetData) Init(net emer.Network, max int, noSynData bool, maxData int)
- func (nd *NetData) OpenJSON(filename gi.Filename) error
- func (nd *NetData) RasterCtr(recno int) (int, bool)
- func (nd *NetData) ReadJSON(r io.Reader) error
- func (nd *NetData) RecIdx(recno int) int
- func (nd *NetData) Record(ctrs string, rastCtr, rastMax int)
- func (nd *NetData) RecordLastCtrs(ctrs string)
- func (nd *NetData) RecordSyns()
- func (nd *NetData) RecvUnitVal(laynm string, vnm string, uidx1d int) (float32, bool)
- func (nd *NetData) SaveJSON(filename gi.Filename) error
- func (nd *NetData) SelectedUnitTable(di int) *etable.Table
- func (nd *NetData) SendUnitVal(laynm string, vnm string, uidx1d int) (float32, bool)
- func (nd *NetData) UnitVal(laynm string, vnm string, uidx1d int, recno int, di int) (float32, bool)
- func (nd *NetData) UnitValIdx(laynm string, vnm string, uidx1d int, ridx int, di int) (float32, bool)
- func (nd *NetData) UnitValRaster(laynm string, vnm string, uidx1d int, rastCtr int, di int) (float32, bool)
- func (nd *NetData) UpdateUnVarRange()
- func (nd *NetData) VarRange(vnm string) (float32, float32, bool)
- func (nd *NetData) WriteJSON(w io.Writer) error
- type NetView
- func (nv *NetView) ConfigLabels(labs []string) bool
- func (nv *NetView) ConfigNetView()
- func (nv *NetView) ConfigToolbar(tb *gi.Toolbar)
- func (nv *NetView) ConfigViewbar(tb *gi.Toolbar)
- func (nv *NetView) ConfigWidget()
- func (nv *NetView) Counters() *gi.Label
- func (nv *NetView) Current()
- func (nv *NetView) GoUpdateView()
- func (nv *NetView) HasLayers() bool
- func (t *NetView) KiType() *gti.Type
- func (nv *NetView) LabelByName(lab string) *xyz.Text2D
- func (nv *NetView) LayerByName(lay string) *xyz.Group
- func (nv *NetView) NetLay() *gi.Layout
- func (nv *NetView) NetVarsList(net emer.Network, layEven bool) (nvars, synvars []string)
- func (t *NetView) New() ki.Ki
- func (nv *NetView) OnInit()
- func (nv *NetView) OpenWeights(filename gi.Filename)
- func (nv *NetView) ReadLock()
- func (nv *NetView) ReadUnlock()
- func (nv *NetView) RecBkwd() bool
- func (nv *NetView) RecFastBkwd() bool
- func (nv *NetView) RecFastFwd() bool
- func (nv *NetView) RecFullBkwd() bool
- func (nv *NetView) RecFwd() bool
- func (nv *NetView) RecTrackLatest() bool
- func (nv *NetView) ReconfigMeshes()
- func (nv *NetView) Record(counters string, rastCtr int)
- func (nv *NetView) RecordCounters(counters string)
- func (nv *NetView) RecordSyns()
- func (nv *NetView) SaveWeights(filename gi.Filename)
- func (nv *NetView) SceneWidget() *Scene
- func (nv *NetView) SceneXYZ() *xyz.Scene
- func (t *NetView) SetColorMap(v *colormap.Map) *NetView
- func (t *NetView) SetColorMapVal(v *giv.ColorMapValue) *NetView
- func (nv *NetView) SetCounters(ctrs string)
- func (t *NetView) SetCurVarParams(v *VarParams) *NetView
- func (t *NetView) SetData(v NetData) *NetView
- func (t *NetView) SetDataMu(v sync.RWMutex) *NetView
- func (t *NetView) SetDi(v int) *NetView
- func (t *NetView) SetLastCtrs(v string) *NetView
- func (nv *NetView) SetMaxRecs(max int)
- func (nv *NetView) SetNet(net emer.Network)
- func (t *NetView) SetParams(v Params) *NetView
- func (t *NetView) SetRecNo(v int) *NetView
- func (t *NetView) SetStackTop(v int) *NetView
- func (t *NetView) SetSynVars(v ...string) *NetView
- func (t *NetView) SetSynVarsMap(v map[string]int) *NetView
- func (t *NetView) SetTooltip(v string) *NetView
- func (nv *NetView) SetVar(vr string)
- func (t *NetView) SetVarParams(v map[string]*VarParams) *NetView
- func (t *NetView) SetVars(v ...string) *NetView
- func (nv *NetView) ShowAllParams() string
- func (nv *NetView) ShowKeyLayerParams() string
- func (nv *NetView) ShowKeyPrjnParams() string
- func (nv *NetView) ShowNonDefaultParams() string
- func (nv *NetView) Toolbar() *gi.Toolbar
- func (nv *NetView) UnitVal(lay emer.Layer, idx []int) (raw, scaled float32, clr color.RGBA, hasval bool)
- func (nv *NetView) UnitValColor(lay emer.Layer, idx1d int, raw float32, hasval bool) (scaled float32, clr color.RGBA)
- func (nv *NetView) UnitValRaster(lay emer.Layer, idx []int, rCtr int) (raw, scaled float32, clr color.RGBA, hasval bool)
- func (nv *NetView) UpdateImpl()
- func (nv *NetView) UpdateRecNo()
- func (nv *NetView) UpdateView()
- func (nv *NetView) VarScaleUpdate(varNm string) bool
- func (nv *NetView) VarsConfig()
- func (nv *NetView) VarsLay() *gi.Frame
- func (nv *NetView) VarsListUpdate()
- func (nv *NetView) VarsUpdate()
- func (nv *NetView) ViewConfig()
- func (nv *NetView) ViewDefaults()
- func (nv *NetView) Viewbar() *gi.Toolbar
- type Params
- type PrjnData
- type RasterParams
- type Scene
- func (sw *Scene) HandleEvents()
- func (t *Scene) KiType() *gti.Type
- func (sw *Scene) LayerUnitAtPoint(e events.Event) (lay emer.Layer, lx, ly, unIdx int)
- func (sw *Scene) LongHoverEvent(e events.Event)
- func (sw *Scene) MouseDownEvent(e events.Event)
- func (t *Scene) New() ki.Ki
- func (sw *Scene) OnInit()
- func (t *Scene) SetCurManipPt(v *xyzv.ManipPt) *Scene
- func (t *Scene) SetCurSel(v xyz.Node) *Scene
- func (t *Scene) SetNetView(v *NetView) *Scene
- func (t *Scene) SetSelMode(v xyzv.SelModes) *Scene
- func (t *Scene) SetSelParams(v xyzv.SelParams) *Scene
- func (t *Scene) SetTooltip(v string) *Scene
- type VarParams
- type ViewUpdt
- func (vu *ViewUpdt) Config(nv *NetView, train, test etime.Times)
- func (vu *ViewUpdt) IsCycleUpdating() bool
- func (vu *ViewUpdt) IsViewingSynapse() bool
- func (vu *ViewUpdt) RecordSyns()
- func (vu *ViewUpdt) Update()
- func (vu *ViewUpdt) UpdateCycle(cyc int)
- func (vu *ViewUpdt) UpdateCycleRaster(cyc int)
- func (vu *ViewUpdt) UpdateTime(time etime.Times)
- func (vu *ViewUpdt) UpdateWhenStopped()
- func (vu *ViewUpdt) UpdtTime(testing bool) etime.Times
Constants ¶
const NaNSub = -1.11e-37
NaNSub is used to replace NaN values for saving -- JSON doesn't handle nan's
Variables ¶
var LayNameType = gti.AddType(>i.Type{Name: "github.com/emer/emergent/v2/netview.LayName", IDName: "lay-name", Doc: "LayName is the Layer name as a Text2D within the NetView", Embeds: []gti.Field{{Name: "Text2D"}}, Fields: []gti.Field{{Name: "NetView", Doc: "our netview"}}, Instance: &LayName{}})
LayNameType is the gti.Type for LayName
var LayObjType = gti.AddType(>i.Type{Name: "github.com/emer/emergent/v2/netview.LayObj", IDName: "lay-obj", Doc: "LayObj is the Layer 3D object within the NetView", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}, Embeds: []gti.Field{{Name: "Solid"}}, Fields: []gti.Field{{Name: "LayName", Doc: "name of the layer we represent"}, {Name: "NetView", Doc: "our netview"}}, Instance: &LayObj{}})
LayObjType is the gti.Type for LayObj
var MinUnitHeight = float32(1.0e-6)
MinUnitHeight ensures that there is always at least some dimensionality to the unit cubes -- affects transparency rendering etc
var NVarCols = 2
NVarCols is the default number of variable columns in the NetView
var NetViewType = gti.AddType(>i.Type{Name: "github.com/emer/emergent/v2/netview.NetView", IDName: "net-view", Doc: "NetView is a GoGi Widget that provides a 3D network view using the GoGi gi3d\n3D framework.", Methods: []gti.Method{{Name: "Current", Doc: "Current records the current state of the network, including synaptic values,\nand updates the display. Use this when switching to NetView tab after network\nhas been running while viewing another tab, because the network state\nis typically not recored then.", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}}, {Name: "SaveWeights", Doc: "SaveWeights saves the network weights -- when called with giv.CallMethod\nit will auto-prompt for filename", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}, Args: []string{"filename"}}, {Name: "OpenWeights", Doc: "OpenWeights opens the network weights -- when called with giv.CallMethod\nit will auto-prompt for filename", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}, Args: []string{"filename"}}, {Name: "ShowNonDefaultParams", Doc: "ShowNonDefaultParams shows a dialog of all the parameters that\nare not at their default values in the network. Useful for setting params.", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}, Returns: []string{"string"}}, {Name: "ShowAllParams", Doc: "ShowAllParams shows a dialog of all the parameters in the network.", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}, Returns: []string{"string"}}, {Name: "ShowKeyLayerParams", Doc: "ShowKeyLayerParams shows a dialog with a listing for all layers in the network,\nof the most important layer-level params (specific to each algorithm)", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}, Returns: []string{"string"}}, {Name: "ShowKeyPrjnParams", Doc: "ShowKeyPrjnParams shows a dialog with a listing for all Recv projections in the network,\nof the most important projection-level params (specific to each algorithm)", Directives: []gti.Directive{{Tool: "gti", Directive: "add"}}, Returns: []string{"string"}}}, Embeds: []gti.Field{{Name: "Layout"}}, Fields: []gti.Field{{Name: "Net", Doc: "the network that we're viewing"}, {Name: "Var", Doc: "current variable that we're viewing"}, {Name: "Di", Doc: "current data parallel index di, for networks capable of processing input patterns in parallel."}, {Name: "Vars", Doc: "the list of variables to view"}, {Name: "SynVars", Doc: "list of synaptic variables"}, {Name: "SynVarsMap", Doc: "map of synaptic variable names to index"}, {Name: "VarParams", Doc: "parameters for the list of variables to view"}, {Name: "CurVarParams", Doc: "current var params -- only valid during Update of display"}, {Name: "Params", Doc: "parameters controlling how the view is rendered"}, {Name: "ColorMap", Doc: "color map for mapping values to colors -- set by name in Params"}, {Name: "ColorMapVal", Doc: "color map value representing ColorMap"}, {Name: "RecNo", Doc: "record number to display -- use -1 to always track latest, otherwise in range"}, {Name: "LastCtrs", Doc: "last non-empty counters string provided -- re-used if no new one"}, {Name: "Data", Doc: "contains all the network data with history"}, {Name: "DataMu", Doc: "mutex on data access"}}, Instance: &NetView{}})
NetViewType is the gti.Type for NetView
var NilColor = color.RGBA{0x20, 0x20, 0x20, 0x40}
Functions ¶
This section is empty.
Types ¶
type LayData ¶
type LayData struct {
// the layer name
LayName string
// cached number of units
NUnits int
// the full data, in that order
Data []float32
// receiving projection data -- shared with SendPrjns
RecvPrjns []*PrjnData
// sending projection data -- shared with RecvPrjns
SendPrjns []*PrjnData
}
LayData maintains a record of all the data for a given layer
func (*LayData) AllocSendPrjns ¶
AllocSendPrjns allocates Sending projections for given layer. does nothing if already allocated.
type LayMesh ¶
type LayMesh struct {
xyz.MeshBase
// layer that we render
Lay emer.Layer
// current shape that has been constructed -- if same, just update
Shape etensor.Shape
// netview that we're in
View *NetView
}
LayMesh is a xyz.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 NewLayMesh ¶
NewLayMesh adds LayMesh mesh to given scene for given layer
func (*LayMesh) RasterSet2DX ¶
func (*LayMesh) RasterSet2DZ ¶
func (*LayMesh) RasterSet4DX ¶
func (*LayMesh) RasterSet4DZ ¶
func (*LayMesh) RasterSize2D ¶
func (*LayMesh) RasterSize4D ¶
type LayName ¶
type LayName struct {
xyz.Text2D
// our netview
NetView *NetView `copy:"-" json:"-" xml:"-" view:"-"`
}
LayName is the Layer name as a Text2D within the NetView
func NewLayName ¶
NewLayName adds a new LayName with the given name to the given parent: LayName is the Layer name as a Text2D within the NetView
func (*LayName) SetNetView ¶
SetNetView sets the [LayName.NetView]: our netview
type LayObj ¶
type LayObj struct {
xyz.Solid
// name of the layer we represent
LayName string
// our netview
NetView *NetView `copy:"-" json:"-" xml:"-" view:"-"`
}
LayObj is the Layer 3D object within the NetView
func NewLayObj ¶
NewLayObj adds a new LayObj with the given name to the given parent: LayObj is the Layer 3D object within the NetView
func (*LayObj) SetLayName ¶
SetLayName sets the [LayObj.LayName]: name of the layer we represent
func (*LayObj) SetNetView ¶
SetNetView sets the [LayObj.NetView]: our netview
type NetData ¶
type NetData struct {
// the network that we're viewing
Net emer.Network `json:"-"`
// copied from Params -- do not record synapse level data -- turn this on for very large networks where recording the entire synaptic state would be prohibitive
NoSynData bool
// name of the layer with unit for viewing projections (connection / synapse-level values)
PrjnLay string
// 1D index of unit within PrjnLay for for viewing projections
PrjnUnIdx int
// copied from NetView Params: if non-empty, this is the type projection to show when there are multiple projections from the same layer -- e.g., Inhib, Lateral, Forward, etc
PrjnType string `inactive:"+"`
// the list of unit variables saved
UnVars []string
// index of each variable in the Vars slice
UnVarIdxs map[string]int
// the list of synaptic variables saved
SynVars []string
// index of synaptic variable in the SynVars slice
SynVarIdxs map[string]int
// the circular ring index -- Max here is max number of values to store, Len is number stored, and Idx(Len-1) is the most recent one, etc
Ring ringidx.Idx
// max data parallel data per unit
MaxData int
// the layer data -- map keyed by layer name
LayData map[string]*LayData
// unit var min values for each Ring.Max * variable
UnMinPer []float32
// unit var max values for each Ring.Max * variable
UnMaxPer []float32
// min values for unit variables
UnMinVar []float32
// max values for unit variables
UnMaxVar []float32
// min values for syn variables
SynMinVar []float32
// max values for syn variables
SynMaxVar []float32
// counter strings
Counters []string
// raster counter values
RasterCtrs []int
// map of raster counter values to record numbers
RasterMap map[int]int
// dummy raster counter when passed a -1 -- increments and wraps around
RastCtr int
}
NetData maintains a record of all the network data that has been displayed up to a given maximum number of records (updates), using efficient ring index logic with no copying to store in fixed-sized buffers.
func (*NetData) Config ¶
func (nd *NetData) Config()
Config configures the data storage for given network only re-allocates if needed.
func (*NetData) CounterRec ¶
CounterRec returns counter string for given record, which is -1 for current (last) record, or in [0..Len-1] for prior records.
func (*NetData) RasterCtr ¶
RasterCtr returns the raster counter value at given record number (-1 = current)
func (*NetData) RecIdx ¶
RecIdx returns record index for given record number, which is -1 for current (last) record, or in [0..Len-1] for prior records.
func (*NetData) Record ¶
Record records the current full set of data from the network, and the given counters string (displayed at bottom of window) and raster counter value -- if negative, then an internal wraping-around counter is used.
func (*NetData) RecordLastCtrs ¶
RecordLastCtrs records just the last counter string to be the given string overwriting what was there before.
func (*NetData) RecordSyns ¶
func (nd *NetData) RecordSyns()
RecordSyns records synaptic data -- stored separate from unit data and only needs to be called when synaptic values are updated. Should be done when the DWt values have been computed, before updating Wts and zeroing. NetView displays this recorded data when Update is next called.
func (*NetData) RecvUnitVal ¶
RecvUnitVal returns the value for given layer, variable name, unit index, for receiving projection variable, based on recorded synaptic projection data. Returns false if value unavailable for any reason (including recorded as such as NaN).
func (*NetData) SelectedUnitTable ¶
SelectedUnitTable returns a table with all of the data for the currently-selected unit, and data parallel index.
func (*NetData) SendUnitVal ¶
SendUnitVal returns the value for given layer, variable name, unit index, for sending projection variable, based on recorded synaptic projection data. Returns false if value unavailable for any reason (including recorded as such as NaN).
func (*NetData) UnitVal ¶
UnitVal returns the value for given layer, variable name, unit index, data parallel idx di, and record number, which is -1 for current (last) record, or in [0..Len-1] for prior records. Returns false if value unavailable for any reason (including recorded as such as NaN).
func (*NetData) UnitValIdx ¶
func (nd *NetData) UnitValIdx(laynm string, vnm string, uidx1d int, ridx int, di int) (float32, bool)
UnitValIdx returns the value for given layer, variable name, unit index, stored idx, and data parallel index. Returns false if value unavailable for any reason (including recorded as such as NaN).
func (*NetData) UnitValRaster ¶
func (nd *NetData) UnitValRaster(laynm string, vnm string, uidx1d int, rastCtr int, di int) (float32, bool)
UnitValRaster returns the value for given layer, variable name, unit index, and raster counter number. Returns false if value unavailable for any reason (including recorded as such as NaN).
func (*NetData) UpdateUnVarRange ¶
func (nd *NetData) UpdateUnVarRange()
UpdateUnVarRange updates the range for unit variables, integrating over the entire range of stored values, so it is valid when iterating over history.
type NetView ¶
type NetView struct {
gi.Layout
// the network that we're viewing
Net emer.Network `set:"-"`
// current variable that we're viewing
Var string `set:"-"`
// current data parallel index di, for networks capable of processing input patterns in parallel.
Di int
// the list of variables to view
Vars []string
// list of synaptic variables
SynVars []string
// map of synaptic variable names to index
SynVarsMap map[string]int
// parameters for the list of variables to view
VarParams map[string]*VarParams
// current var params -- only valid during Update of display
CurVarParams *VarParams `json:"-" xml:"-" view:"-"`
// parameters controlling how the view is rendered
Params Params
// color map for mapping values to colors -- set by name in Params
ColorMap *colormap.Map
// color map value representing ColorMap
ColorMapVal *giv.ColorMapValue
// record number to display -- use -1 to always track latest, otherwise in range
RecNo int
// last non-empty counters string provided -- re-used if no new one
LastCtrs string
// contains all the network data with history
Data NetData
// mutex on data access
DataMu sync.RWMutex `view:"-" copy:"-" json:"-" xml:"-"`
}
NetView is a GoGi Widget that provides a 3D network view using the GoGi gi3d 3D framework.
func NewNetView ¶
NewNetView adds a new NetView with the given name to the given parent: NetView is a GoGi Widget that provides a 3D network view using the GoGi gi3d 3D framework.
func (*NetView) ConfigLabels ¶
ConfigLabels ensures that given label xyz.Text2D objects are created and initialized in a top-level group called Labels. Use LabelByName() to get a given label, and LayerByName() to get a Layer group, whose Pose can be copied to put a label in position relative to a layer. Default alignment is Left, Top. Returns true set of labels was changed (mods).
func (*NetView) ConfigNetView ¶
func (nv *NetView) ConfigNetView()
ConfigNetView configures the overall view widget
func (*NetView) ConfigToolbar ¶
func (*NetView) ConfigViewbar ¶
func (*NetView) ConfigWidget ¶
func (nv *NetView) ConfigWidget()
func (*NetView) Current ¶
func (nv *NetView) Current()
Current records the current state of the network, including synaptic values, and updates the display. Use this when switching to NetView tab after network has been running while viewing another tab, because the network state is typically not recored then.
func (*NetView) GoUpdateView ¶
func (nv *NetView) GoUpdateView()
GoUpdateView 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) LabelByName ¶
LabelByName returns given Text2D label (see ConfigLabels). nil if not found.
func (*NetView) LayerByName ¶
LayerByName returns the xyz.Group that represents layer of given name. nil if not found.
func (*NetView) NetVarsList ¶
NetVarsList returns the list of layer and prjn variables for given network. layEven ensures that the number of layer variables is an even number if true (used for display but not storage).
func (*NetView) OpenWeights ¶
OpenWeights opens the network weights -- when called with giv.CallMethod it will auto-prompt for filename
func (*NetView) ReadLock ¶
func (nv *NetView) ReadLock()
ReadLock locks data for reading -- call ReadUnlock when done. Call this surrounding calls to UnitVal.
func (*NetView) RecFastBkwd ¶
RecFastBkwd move view record N (default 10) steps backward. Returns true if updated.
func (*NetView) RecFastFwd ¶
RecFastFwd move view record N (default 10) steps forward. Returns true if updated.
func (*NetView) RecFullBkwd ¶
RecFullBkwd move view record to start of history.
func (*NetView) RecTrackLatest ¶
RecTrackLatest sets view to track latest record (-1). Returns true if updated.
func (*NetView) ReconfigMeshes ¶
func (nv *NetView) ReconfigMeshes()
ReconfigMeshes reconfigures the layer meshes
func (*NetView) Record ¶
Record records the current state of the network, along with provided counters string, which is displayed at the bottom of the view to show the current state of the counters. The rastCtr is the raster counter value used for the raster plot mode -- use -1 for a default incrementing counter. The NetView displays this recorded data when Update is next called.
func (*NetView) RecordCounters ¶
RecordCounters saves the counters, so they are available for a Current update
func (*NetView) RecordSyns ¶
func (nv *NetView) RecordSyns()
RecordSyns records synaptic data -- stored separate from unit data and only needs to be called when synaptic values are updated. Should be done when the DWt values have been computed, before updating Wts and zeroing. NetView displays this recorded data when Update is next called.
func (*NetView) SaveWeights ¶
SaveWeights saves the network weights -- when called with giv.CallMethod it will auto-prompt for filename
func (*NetView) SceneWidget ¶
func (*NetView) SetColorMap ¶
SetColorMap sets the [NetView.ColorMap]: color map for mapping values to colors -- set by name in Params
func (*NetView) SetColorMapVal ¶
func (t *NetView) SetColorMapVal(v *giv.ColorMapValue) *NetView
SetColorMapVal sets the [NetView.ColorMapVal]: color map value representing ColorMap
func (*NetView) SetCounters ¶
SetCounters sets the counters widget view display at bottom of netview
func (*NetView) SetCurVarParams ¶
SetCurVarParams sets the [NetView.CurVarParams]: current var params -- only valid during Update of display
func (*NetView) SetData ¶
SetData sets the [NetView.Data]: contains all the network data with history
func (*NetView) SetDi ¶
SetDi sets the [NetView.Di]: current data parallel index di, for networks capable of processing input patterns in parallel.
func (*NetView) SetLastCtrs ¶
SetLastCtrs sets the [NetView.LastCtrs]: last non-empty counters string provided -- re-used if no new one
func (*NetView) SetMaxRecs ¶
SetMaxRecs sets the maximum number of records that are maintained (default 210) resets the current data in the process
func (*NetView) SetParams ¶
SetParams sets the [NetView.Params]: parameters controlling how the view is rendered
func (*NetView) SetRecNo ¶
SetRecNo sets the [NetView.RecNo]: record number to display -- use -1 to always track latest, otherwise in range
func (*NetView) SetStackTop ¶
SetStackTop sets the [NetView.StackTop]
func (*NetView) SetSynVars ¶
SetSynVars sets the [NetView.SynVars]: list of synaptic variables
func (*NetView) SetSynVarsMap ¶
SetSynVarsMap sets the [NetView.SynVarsMap]: map of synaptic variable names to index
func (*NetView) SetTooltip ¶
SetTooltip sets the [NetView.Tooltip]
func (*NetView) SetVarParams ¶
SetVarParams sets the [NetView.VarParams]: parameters for the list of variables to view
func (*NetView) ShowAllParams ¶
ShowAllParams shows a dialog of all the parameters in the network.
func (*NetView) ShowKeyLayerParams ¶
ShowKeyLayerParams shows a dialog with a listing for all layers in the network, of the most important layer-level params (specific to each algorithm)
func (*NetView) ShowKeyPrjnParams ¶
ShowKeyPrjnParams shows a dialog with a listing for all Recv projections in the network, of the most important projection-level params (specific to each algorithm)
func (*NetView) ShowNonDefaultParams ¶
ShowNonDefaultParams shows a dialog of all the parameters that are not at their default values in the network. Useful for setting params.
func (*NetView) UnitVal ¶
func (nv *NetView) UnitVal(lay emer.Layer, idx []int) (raw, scaled float32, clr color.RGBA, hasval bool)
UnitVal returns the raw value, scaled value, and color representation for given unit of given layer. scaled is in range -1..1
func (*NetView) UnitValColor ¶
func (nv *NetView) UnitValColor(lay emer.Layer, idx1d int, raw float32, hasval bool) (scaled float32, clr color.RGBA)
UnitValColor returns the raw value, scaled value, and color representation for given unit of given layer. scaled is in range -1..1
func (*NetView) UnitValRaster ¶
func (nv *NetView) UnitValRaster(lay emer.Layer, idx []int, rCtr int) (raw, scaled float32, clr color.RGBA, hasval bool)
UnitValRaster returns the raw value, scaled value, and color representation for given unit of given layer, and given raster counter index value (0..RasterMax) scaled is in range -1..1
func (*NetView) UpdateImpl ¶
func (nv *NetView) UpdateImpl()
UpdateImpl does the guts of updating -- backend for Update or GoUpdate
func (*NetView) UpdateRecNo ¶
func (nv *NetView) UpdateRecNo()
UpdateRecNo updates the record number viewing
func (*NetView) UpdateView ¶
func (nv *NetView) UpdateView()
UpdateView updates the display based on last recorded state of network.
func (*NetView) VarScaleUpdate ¶
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) 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) ViewDefaults ¶
func (nv *NetView) ViewDefaults()
ViewDefaults are the default 3D view params
type Params ¶
type Params struct {
// raster plot parameters
Raster RasterParams `view:"inline"`
// do not record synapse level data -- turn this on for very large networks where recording the entire synaptic state would be prohibitive
NoSynData bool
// if non-empty, this is the type projection to show when there are multiple projections from the same layer -- e.g., Inhib, Lateral, Forward, etc
PrjnType string
// maximum number of records to store to enable rewinding through prior states
MaxRecs int `min:"1"`
// number of variable columns
NVarCols int
// size of a single unit, where 1 = full width and no space.. .9 default
UnitSize float32 `min:"0.1" max:"1" step:"0.1" def:"0.9"`
// size of the layer name labels -- entire network view is unit sized
LayNmSize float32 `min:"0.01" max:".1" step:"0.01" def:"0.05"`
// name of color map to use
ColorMap giv.ColorMapName
// opacity (0-1) of zero values -- greater magnitude values become increasingly opaque on either side of this minimum
ZeroAlpha float32 `min:"0" max:"1" step:"0.1" def:"0.5"`
// our netview, for update method
NetView *NetView `copy:"-" json:"-" xml:"-" view:"-"`
// the number of records to jump for fast forward/backward
NFastSteps int
}
Params holds parameters controlling how the view is rendered
type PrjnData ¶
type PrjnData struct {
// name of sending layer
Send string
// name of recv layer
Recv string
// source projection
Prjn emer.Prjn
// synaptic data, by variable in SynVars and number of data points
SynData []float32
}
PrjnData holds display state for a projection
func (*PrjnData) Alloc ¶
func (pd *PrjnData) Alloc()
Alloc allocates SynData to hold number of variables * nsyn synapses. If already has capacity, nothing happens.
func (*PrjnData) RecordData ¶
RecordData records synaptic data from given prjn. must use sender or recv based depending on natural ordering.
type RasterParams ¶
type RasterParams struct {
// if true, show a raster plot over time, otherwise units
On bool
// if true, the raster counter (time) is plotted across the X axis -- otherwise the Z depth axis
XAxis bool
// maximum count for the counter defining the raster plot
Max int
// size of a single unit, where 1 = full width and no space.. 1 default
UnitSize float32 `min:"0.1" max:"1" step:"0.1" def:"1"`
// height multiplier for units, where 1 = full height.. 0.2 default
UnitHeight float32 `min:"0.1" max:"1" step:"0.1" def:"0.2"`
}
RasterParams holds parameters controlling the raster plot view
func (*RasterParams) Defaults ¶
func (nv *RasterParams) Defaults()
type Scene ¶
Scene is a Widget for managing the 3D Scene of the NetView
func NewScene ¶
NewScene adds a new Scene with the given name to the given parent: Scene is a Widget for managing the 3D Scene of the NetView
func (*Scene) HandleEvents ¶
func (sw *Scene) HandleEvents()
func (*Scene) LayerUnitAtPoint ¶
func (*Scene) LongHoverEvent ¶
func (*Scene) MouseDownEvent ¶
func (*Scene) SetCurManipPt ¶
SetCurManipPt sets the [Scene.CurManipPt]
func (*Scene) SetNetView ¶
SetNetView sets the [Scene.NetView]
func (*Scene) SetSelMode ¶
SetSelMode sets the [Scene.SelMode]
func (*Scene) SetSelParams ¶
SetSelParams sets the [Scene.SelParams]
func (*Scene) SetTooltip ¶
SetTooltip sets the [Scene.Tooltip]
type VarParams ¶
type VarParams struct {
// name of the variable
Var string
// keep Min - Max centered around 0, and use negative heights for units -- else use full min-max range for height (no negative heights)
ZeroCtr bool
// range to display
Range minmax.Range32 `view:"inline"`
// if not using fixed range, this is the actual range of data
MinMax minmax.F32 `view:"inline"`
}
VarParams holds parameters for display of each variable
type ViewUpdt ¶
type ViewUpdt struct {
// the network view
View *NetView `view:"-"`
// whether in testing mode -- can be set in advance to drive appropriate updating
Testing bool `view:"-"`
// text to display at the bottom of the view
Text string `view:"-"`
// toggles update of display on
On bool
// if true, do not record network data when the NetView is invisible -- this speeds up running when not visible, but the NetView display will not show the current state when switching back to it
SkipInvis bool
// at what time scale to update the display during training?
Train etime.Times
// at what time scale to update the display during testing?
Test etime.Times
}
ViewUpdt manages time scales for updating the NetView
func (*ViewUpdt) IsCycleUpdating ¶
IsCycleUpdating returns true if the view is updating at a cycle level, either from raster or literal cycle level.
func (*ViewUpdt) IsViewingSynapse ¶
IsViewingSynapse returns true if netview is actively viewing synapses.
func (*ViewUpdt) RecordSyns ¶
func (vu *ViewUpdt) RecordSyns()
RecordSyns records synaptic data -- stored separate from unit data and only needs to be called when synaptic values are updated. Should be done when the DWt values have been computed, before updating Wts and zeroing. NetView displays this recorded data when Update is next called.
func (*ViewUpdt) Update ¶
func (vu *ViewUpdt) Update()
Update does an update if view is On, visible and active, including recording new data and driving update of display
func (*ViewUpdt) UpdateCycle ¶
UpdateCycle triggers an update at the Cycle (Millisecond) timescale, using given text to display at bottom of view
func (*ViewUpdt) UpdateCycleRaster ¶
UpdateCycleRaster raster version of Cycle update
func (*ViewUpdt) UpdateTime ¶
UpdateTime triggers an update at given timescale.
func (*ViewUpdt) UpdateWhenStopped ¶
func (vu *ViewUpdt) UpdateWhenStopped()
UpdateWhenStopped does an update when the network updating was stopped either via stepping or hitting the stop button -- this has different logic for the raster view vs. regular.