netview

package
v2.0.0-dev0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: BSD-3-Clause Imports: 33 Imported by: 9

README

Docs: GoDoc

Package netview provides the NetView type that displays a neural network using the emer.Layer etc interfaces defined in the emer package.

Documentation

Overview

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

Index

Constants

View Source
const NaNSub = -1.11e-37

NaNSub is used to replace NaN values for saving -- JSON doesn't handle nan's

Variables

View Source
var KiT_LayMesh = kit.Types.AddType(&LayMesh{}, nil)
View Source
var KiT_LayName = kit.Types.AddType(&LayName{}, nil)
View Source
var KiT_LayObj = kit.Types.AddType(&LayObj{}, LayObjProps)
View Source
var KiT_NetData = kit.Types.AddType(&NetData{}, NetDataProps)
View Source
var KiT_NetView = kit.Types.AddType(&NetView{}, NetViewProps)
View Source
var LayObjProps = ki.Props{
	"EnumType:Flag": gi.KiT_NodeFlags,
}
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 NVarCols = 2

NVarCols is the default number of variable columns in the NetView

View Source
var NetDataProps = ki.Props{
	"CallMethods": ki.PropSlice{
		{"SaveJSON", ki.Props{
			"desc": "save recorded network view data to file",
			"icon": "file-save",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"ext": ".netdat,.netdat.gz",
				}},
			},
		}},
		{"OpenJSON", ki.Props{
			"desc": "open recorded network view data from file",
			"icon": "file-open",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"ext": ".netdat,.netdat.gz",
				}},
			},
		}},
	},
}
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,.wts.gz",
				}},
			},
		}},
		{"OpenWeights", ki.Props{
			"desc": "open network weights from file",
			"icon": "file-open",
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"ext": ".wts,.wts.gz",
				}},
			},
		}},
	},
}
View Source
var NilColor = gist.Color{0x20, 0x20, 0x20, 0x40}

Functions

This section is empty.

Types

type LayData

type LayData struct {

	// the layer name
	LayName string `desc:"the layer name"`

	// cached number of units
	NUnits int `desc:"cached number of units"`

	// the full data, [Ring.Max][len(Vars)][MaxData][NUnits] in that order
	Data []float32 `desc:"the full data, [Ring.Max][len(Vars)][MaxData][NUnits] in that order"`

	// receiving projection data -- shared with SendPrjns
	RecvPrjns []*PrjnData `desc:"receiving projection data -- shared with SendPrjns"`

	// sending projection data -- shared with RecvPrjns
	SendPrjns []*PrjnData `desc:"sending projection data -- shared with RecvPrjns"`
}

LayData maintains a record of all the data for a given layer

func (*LayData) AllocSendPrjns

func (ld *LayData) AllocSendPrjns(ly emer.Layer)

AllocSendPrjns allocates Sending projections for given layer. does nothing if already allocated.

func (*LayData) FreePrjns

func (ld *LayData) FreePrjns()

FreePrjns nils prjn data -- for NoSynDat

type LayMesh

type LayMesh struct {
	gi3d.MeshBase

	// layer that we render
	Lay emer.Layer `desc:"layer that we render"`

	// current shape that has been constructed -- if same, just update
	Shape etensor.Shape `desc:"current shape that has been constructed -- if same, just update"`

	// netview that we're in
	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) RasterSet2DX

func (lm *LayMesh) RasterSet2DX(sc *gi3d.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

func (*LayMesh) RasterSet2DZ

func (lm *LayMesh) RasterSet2DZ(sc *gi3d.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

func (*LayMesh) RasterSet4DX

func (lm *LayMesh) RasterSet4DX(sc *gi3d.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

func (*LayMesh) RasterSet4DZ

func (lm *LayMesh) RasterSet4DZ(sc *gi3d.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

func (*LayMesh) RasterSize2D

func (lm *LayMesh) RasterSize2D() (nVtx, nIdx int)

func (*LayMesh) RasterSize4D

func (lm *LayMesh) RasterSize4D() (nVtx, nIdx int)

func (*LayMesh) Set

func (lm *LayMesh) Set(sc *gi3d.Scene, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

func (*LayMesh) Set2D

func (lm *LayMesh) Set2D(sc *gi3d.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

func (*LayMesh) Set4D

func (lm *LayMesh) Set4D(sc *gi3d.Scene, init bool, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

func (*LayMesh) Size2D

func (lm *LayMesh) Size2D() (nVtx, nIdx int)

func (*LayMesh) Size4D

func (lm *LayMesh) Size4D() (nVtx, nIdx int)

func (*LayMesh) Sizes

func (lm *LayMesh) Sizes() (nVtx, nIdx int, hasColor bool)

func (*LayMesh) Update

func (lm *LayMesh) Update(sc *gi3d.Scene, vtxAry, normAry, texAry, clrAry mat32.ArrayF32, idxAry mat32.ArrayU32)

type LayName

type LayName struct {
	gi3d.Text2D

	// [view: -] our netview
	NetView *NetView `copy:"-" json:"-" xml:"-" view:"-" desc:"our netview"`
}

LayName is the Layer name as a Text2D within the NetView

func (*LayName) ConnectEvents3D

func (ln *LayName) ConnectEvents3D(sc *gi3d.Scene)

type LayObj

type LayObj struct {
	gi3d.Solid

	// name of the layer we represent
	LayName string `desc:"name of the layer we represent"`

	// [view: -] our netview
	NetView *NetView `copy:"-" json:"-" xml:"-" view:"-" desc:"our netview"`
}

LayObj is the Layer 3D object within the NetView

func (*LayObj) ConnectEvents3D

func (lo *LayObj) ConnectEvents3D(sc *gi3d.Scene)

type NetData

type NetData struct {

	// the network that we're viewing
	Net emer.Network `json:"-" desc:"the network that we're viewing"`

	// 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 `` /* 164-byte string literal not displayed */

	// name of the layer with unit for viewing projections (connection / synapse-level values)
	PrjnLay string `desc:"name of the layer with unit for viewing projections (connection / synapse-level values)"`

	// 1D index of unit within PrjnLay for for viewing projections
	PrjnUnIdx int `desc:"1D index of unit within PrjnLay for for viewing projections"`

	// 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 `` /* 191-byte string literal not displayed */

	// the list of unit variables saved
	UnVars []string `desc:"the list of unit variables saved"`

	// index of each variable in the Vars slice
	UnVarIdxs map[string]int `desc:"index of each variable in the Vars slice"`

	// the list of synaptic variables saved
	SynVars []string `desc:"the list of synaptic variables saved"`

	// index of synaptic variable in the SynVars slice
	SynVarIdxs map[string]int `desc:"index of synaptic variable in the SynVars slice"`

	// 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 `` /* 141-byte string literal not displayed */

	// max data parallel data per unit
	MaxData int `desc:"max data parallel data per unit"`

	// the layer data -- map keyed by layer name
	LayData map[string]*LayData `desc:"the layer data -- map keyed by layer name"`

	// unit var min values for each Ring.Max * variable
	UnMinPer []float32 `desc:"unit var min values for each Ring.Max * variable"`

	// unit var max values for each Ring.Max * variable
	UnMaxPer []float32 `desc:"unit var max values for each Ring.Max * variable"`

	// min values for unit variables
	UnMinVar []float32 `desc:"min values for unit variables"`

	// max values for unit variables
	UnMaxVar []float32 `desc:"max values for unit variables"`

	// min values for syn variables
	SynMinVar []float32 `desc:"min values for syn variables"`

	// max values for syn variables
	SynMaxVar []float32 `desc:"max values for syn variables"`

	// counter strings
	Counters []string `desc:"counter strings"`

	// raster counter values
	RasterCtrs []int `desc:"raster counter values"`

	// map of raster counter values to record numbers
	RasterMap map[int]int `desc:"map of raster counter values to record numbers"`

	// dummy raster counter when passed a -1 -- increments and wraps around
	RastCtr int `desc:"dummy raster counter when passed a -1 -- increments and wraps around"`
}

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

func (nd *NetData) CounterRec(recno int) string

CounterRec returns counter string for given record, which is -1 for current (last) record, or in [0..Len-1] for prior records.

func (*NetData) Init

func (nd *NetData) Init(net emer.Network, max int, noSynData bool, maxData int)

Init initializes the main params and configures the data

func (*NetData) OpenJSON

func (nd *NetData) OpenJSON(filename gi.FileName) error

OpenJSON opens colors from a JSON-formatted file.

func (*NetData) RasterCtr

func (nd *NetData) RasterCtr(recno int) (int, bool)

RasterCtr returns the raster counter value at given record number (-1 = current)

func (*NetData) ReadJSON

func (nd *NetData) ReadJSON(r io.Reader) error

ReadJSON reads netdata from JSON format

func (*NetData) RecIdx

func (nd *NetData) RecIdx(recno int) int

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

func (nd *NetData) Record(ctrs string, rastCtr, rastMax int)

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

func (nd *NetData) RecordLastCtrs(ctrs string)

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

func (nd *NetData) RecvUnitVal(laynm string, vnm string, uidx1d int) (float32, bool)

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) SaveJSON

func (nd *NetData) SaveJSON(filename gi.FileName) error

SaveJSON saves colors to a JSON-formatted file.

func (*NetData) SelectedUnitTable

func (nd *NetData) SelectedUnitTable(di int) *etable.Table

SelectedUnitTable returns a table with all of the data for the currently-selected unit, and data parallel index.

func (*NetData) SendUnitVal

func (nd *NetData) SendUnitVal(laynm string, vnm string, uidx1d int) (float32, bool)

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

func (nd *NetData) UnitVal(laynm string, vnm string, uidx1d int, recno int, di int) (float32, bool)

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.

func (*NetData) VarRange

func (nd *NetData) VarRange(vnm string) (float32, float32, bool)

VarRange returns the current min, max range for given variable. Returns false if not found or no data.

func (*NetData) WriteJSON

func (nd *NetData) WriteJSON(w io.Writer) error

WriteJSON writes netdata to JSON format

type NetView

type NetView struct {
	gi.Layout

	// the network that we're viewing
	Net emer.Network `desc:"the network that we're viewing"`

	// current variable that we're viewing
	Var string `desc:"current variable that we're viewing"`

	// current data parallel index di, for networks capable of processing input patterns in parallel.
	Di int `desc:"current data parallel index di, for networks capable of processing input patterns in parallel."`

	// the list of variables to view
	Vars []string `desc:"the list of variables to view"`

	// list of synaptic variables
	SynVars []string `desc:"list of synaptic variables"`

	// map of synaptic variable names to index
	SynVarsMap map[string]int `desc:"map of synaptic variable names to index"`

	// parameters for the list of variables to view
	VarParams map[string]*VarParams `desc:"parameters for the list of variables to view"`

	// [view: -] current var params -- only valid during Update of display
	CurVarParams *VarParams `json:"-" xml:"-" view:"-" desc:"current var params -- only valid during Update of display"`

	// parameters controlling how the view is rendered
	Params Params `desc:"parameters controlling how the view is rendered"`

	// color map for mapping values to colors -- set by name in Params
	ColorMap *colormap.Map `desc:"color map for mapping values to colors -- set by name in Params"`

	// record number to display -- use -1 to always track latest, otherwise in range [0..Data.Ring.Len-1]
	RecNo int `desc:"record number to display -- use -1 to always track latest, otherwise in range [0..Data.Ring.Len-1]"`

	// last non-empty counters string provided -- re-used if no new one
	LastCtrs string `desc:"last non-empty counters string provided -- re-used if no new one"`

	// contains all the network data with history
	Data NetData `desc:"contains all the network data with history"`

	// [view: -] mutex on data access
	DataMu sync.RWMutex `view:"-" copy:"-" json:"-" xml:"-" desc:"mutex on data access"`
}

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) ConfigLabels

func (nv *NetView) ConfigLabels(labs []string) bool

ConfigLabels ensures that given label gi3d.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) Counters

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

func (*NetView) Defaults

func (nv *NetView) Defaults()

func (*NetView) GoUpdate

func (nv *NetView) GoUpdate()

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

HasLayers returns true if network has any layers -- else no display

func (*NetView) IsConfiged

func (nv *NetView) IsConfiged() bool

IsConfiged returns true if widget is fully configured

func (*NetView) LabelByName

func (nv *NetView) LabelByName(lab string) *gi3d.Text2D

LabelByName returns given Text2D label (see ConfigLabels). nil if not found.

func (*NetView) LayerByName

func (nv *NetView) LayerByName(lay string) *gi3d.Group

LayerByName returns the gi3d.Group that represents layer of given name. nil if not found.

func (*NetView) NetLay

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

func (*NetView) NetVarsList

func (nv *NetView) NetVarsList(net emer.Network, layEven bool) (nvars, synvars []string)

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

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) PlotSelectedUnit

func (nv *NetView) PlotSelectedUnit() (*gi.Window, *etable.Table, *eplot.Plot2D)

PlotSelectedUnit opens a window with a plot of all the data for the currently-selected unit. Useful for replaying detailed trace for units of interest.

func (*NetView) ReadLock

func (nv *NetView) ReadLock()

ReadLock locks data for reading -- call ReadUnlock when done. Call this surrounding calls to UnitVal.

func (*NetView) ReadUnlock

func (nv *NetView) ReadUnlock()

ReadUnlock unlocks data for reading.

func (*NetView) RecBkwd

func (nv *NetView) RecBkwd() bool

RecBkwd move view record 1 steps backward. Returns true if updated.

func (*NetView) RecFastBkwd

func (nv *NetView) RecFastBkwd() bool

RecFastBkwd move view record N (default 10) steps backward. Returns true if updated.

func (*NetView) RecFastFwd

func (nv *NetView) RecFastFwd() bool

RecFastFwd move view record N (default 10) steps forward. Returns true if updated.

func (*NetView) RecFullBkwd

func (nv *NetView) RecFullBkwd() bool

RecFullBkwd move view record to start of history.

func (*NetView) RecFwd

func (nv *NetView) RecFwd() bool

RecFwd move view record 1 step forward. Returns true if updated.

func (*NetView) RecTrackLatest

func (nv *NetView) RecTrackLatest() bool

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

func (nv *NetView) Record(counters string, rastCtr int)

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

func (nv *NetView) RecordCounters(counters string)

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) Render2D

func (nv *NetView) Render2D()

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)

SetCounters sets the counters widget view display at bottom of netview

func (*NetView) SetMaxRecs

func (nv *NetView) SetMaxRecs(max int)

SetMaxRecs sets the maximum number of records that are maintained (default 210) resets the current data in the process

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) ShowKeyLayerParams

func (nv *NetView) ShowKeyLayerParams() string

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

func (nv *NetView) ShowKeyPrjnParams() string

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

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 gist.Color, 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 gist.Color)

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 gist.Color, 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) Update

func (nv *NetView) Update()

Update updates the display based on current state of network. 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()

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) 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 {

	// [view: inline] raster plot parameters
	Raster RasterParams `view:"inline" desc:"raster plot parameters"`

	// do not record synapse level data -- turn this on for very large networks where recording the entire synaptic state would be prohibitive
	NoSynData bool `` /* 142-byte string literal not displayed */

	// 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 `` /* 150-byte string literal not displayed */

	// [min: 1] maximum number of records to store to enable rewinding through prior states
	MaxRecs int `min:"1" desc:"maximum number of records to store to enable rewinding through prior states"`

	// number of variable columns
	NVarCols int `desc:"number of variable columns"`

	// [def: 0.9] [min: 0.1] [max: 1] [step: 0.1] 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" desc:"size of a single unit, where 1 = full width and no space.. .9 default"`

	// [def: 0.05] [min: 0.01] [max: .1] [step: 0.01] 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" desc:"size of the layer name labels -- entire network view is unit sized"`

	// name of color map to use
	ColorMap giv.ColorMapName `desc:"name of color map to use"`

	// [def: 0.5] [min: 0] [max: 1] [step: 0.1] opacity (0-1) of zero values -- greater magnitude values become increasingly opaque on either side of this minimum
	ZeroAlpha float32 `` /* 158-byte string literal not displayed */

	// [view: -] our netview, for update method
	NetView *NetView `copy:"-" json:"-" xml:"-" view:"-" desc:"our netview, for update method"`

	// the number of records to jump for fast forward/backward
	NFastSteps int `desc:"the number of records to jump for fast forward/backward"`
}

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 PrjnData

type PrjnData struct {

	// name of sending layer
	Send string `desc:"name of sending layer"`

	// name of recv layer
	Recv string `desc:"name of recv layer"`

	// source projection
	Prjn emer.Prjn `desc:"source projection"`

	// synaptic data, by variable in SynVars and number of data points
	SynData []float32 `desc:"synaptic data, by variable in SynVars and number of data points"`
}

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

func (pd *PrjnData) RecordData(nd *NetData)

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 `desc:"if true, show a raster plot over time, otherwise units"`

	// if true, the raster counter (time) is plotted across the X axis -- otherwise the Z depth axis
	XAxis bool `desc:"if true, the raster counter (time) is plotted across the X axis -- otherwise the Z depth axis"`

	// maximum count for the counter defining the raster plot
	Max int `desc:"maximum count for the counter defining the raster plot"`

	// [def: 1] [min: 0.1] [max: 1] [step: 0.1] 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" desc:"size of a single unit, where 1 = full width and no space.. 1 default"`

	// [def: 0.2] [min: 0.1] [max: 1] [step: 0.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" desc:"height multiplier for units, where 1 = full height.. 0.2 default"`
}

RasterParams holds parameters controlling the raster plot view

func (*RasterParams) Defaults

func (nv *RasterParams) Defaults()

type VarParams

type VarParams struct {

	// name of the variable
	Var string `desc:"name of the variable"`

	// 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 `` /* 139-byte string literal not displayed */

	// [view: inline] range to display
	Range minmax.Range32 `view:"inline" desc:"range to display"`

	// [view: inline] if not using fixed range, this is the actual range of data
	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

func (*VarParams) SetProps

func (vp *VarParams) SetProps(pstr string)

SetProps parses Go struct-tag style properties for variable and sets values accordingly for customized defaults

type ViewUpdt

type ViewUpdt struct {

	// [view: -] the network view
	View *NetView `view:"-" desc:"the network view"`

	// [view: -] whether in testing mode -- can be set in advance to drive appropriate updating
	Testing bool `view:"-" desc:"whether in testing mode -- can be set in advance to drive appropriate updating"`

	// [view: -] text to display at the bottom of the view
	Text string `view:"-" desc:"text to display at the bottom of the view"`

	// toggles update of display on
	On bool `desc:"toggles update of display on"`

	// 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 `` /* 198-byte string literal not displayed */

	// at what time scale to update the display during training?
	Train etime.Times `desc:"at what time scale to update the display during training?"`

	// at what time scale to update the display during testing?
	Test etime.Times `desc:"at what time scale to update the display during testing?"`
}

ViewUpdt manages time scales for updating the NetView

func (*ViewUpdt) Config

func (vu *ViewUpdt) Config(nv *NetView, train, test etime.Times)

Config configures for given NetView and default train, test times

func (*ViewUpdt) IsCycleUpdating

func (vu *ViewUpdt) IsCycleUpdating() bool

IsCycleUpdating returns true if the view is updating at a cycle level, either from raster or literal cycle level.

func (*ViewUpdt) IsViewingSynapse

func (vu *ViewUpdt) IsViewingSynapse() bool

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

func (vu *ViewUpdt) UpdateCycle(cyc int)

UpdateCycle triggers an update at the Cycle (Millisecond) timescale, using given text to display at bottom of view

func (*ViewUpdt) UpdateCycleRaster

func (vu *ViewUpdt) UpdateCycleRaster(cyc int)

UpdateCycleRaster raster version of Cycle update

func (*ViewUpdt) UpdateTime

func (vu *ViewUpdt) UpdateTime(time etime.Times)

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.

func (*ViewUpdt) UpdtTime

func (vu *ViewUpdt) UpdtTime(testing bool) etime.Times

UpdtTime returns the relevant update time based on testing flag

Jump to

Keyboard shortcuts

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