etview

package
v2.0.0-dev0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: BSD-3-Clause Imports: 29 Imported by: 5

README

etview

Docs: GoDoc

etview provides GUI Views of etable.Table and etensor.Tensor structures using the GoGi View framework, as GoGi Widgets.

Add this to import to get these views to be registered with the GoGi ValueView system:

	_ "github.com/goki/etable/v2/etview" // include to get gui views
  • TableView provides a row-and-column tabular GUI interface, similar to a spreadsheet, for viewing and editing Table data. Any higher-dimensional tensor columns are shown as TensorGrid elements that can be clicked to open a TensorView editor with actual numeric values in a similar spreadsheet-like GUI.

  • TensorView provides a spreadsheet-like GUI for viewing and editing tensor data.

  • TensorGrid provides a 2D colored grid display of tensor data, collapsing any higher dimensions down to 2D. Different giv.ColorMaps can be used to translate values into colors.

Documentation

Overview

Package etview provides GUI Views of etable Table and Tensor structures using the GoGi View framework: https://github.com/goki/gi

* TableView provides a row-and-column tabular GUI interface, similar to a spreadsheet, for viewing and editing Table data. Any higher-dimensional tensor columns are shown as TensorGrid elements that can be clicked to open a TensorView editor with actual numeric values in a similar spreadsheet- like GUI.

* TensorView provides a spreadsheet-like GUI for viewing and editing tensor data.

* TensorGrid provides a 2D colored grid display of tensor data, collapsing any higher dimensions down to 2D. Different giv.ColorMaps can be used to translate values into colors.

Index

Constants

View Source
const LabelSpace = float32(8)

Variables

View Source
var SimMatGridType = gti.AddType(&gti.Type{
	Name:      "github.com/emer/etable/v2/etview.SimMatGrid",
	ShortName: "etview.SimMatGrid",
	IDName:    "sim-mat-grid",
	Doc:       "SimMatGrid is a widget that displays a similarity / distance matrix\nwith tensor values as a grid of colored squares, and labels for rows, cols",
	Directives: gti.Directives{
		&gti.Directive{Tool: "gti", Directive: "add", Args: []string{}},
	},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"SimMat", &gti.Field{Name: "SimMat", Type: "*github.com/emer/etable/v2/simat.SimMat", LocalType: "*simat.SimMat", Doc: "the similarity / distance matrix", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"rowMaxSz", &gti.Field{Name: "rowMaxSz", Type: "goki.dev/mat32.Vec2", LocalType: "mat32.Vec2", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		{"rowMinBlank", &gti.Field{Name: "rowMinBlank", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		{"rowNGps", &gti.Field{Name: "rowNGps", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		{"colMaxSz", &gti.Field{Name: "colMaxSz", Type: "goki.dev/mat32.Vec2", LocalType: "mat32.Vec2", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		{"colMinBlank", &gti.Field{Name: "colMinBlank", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: ""}},
		{"colNGps", &gti.Field{Name: "colNGps", Type: "int", LocalType: "int", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"TensorGrid", &gti.Field{Name: "TensorGrid", Type: "github.com/emer/etable/v2/etview.TensorGrid", LocalType: "TensorGrid", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &SimMatGrid{},
})

SimMatGridType is the gti.Type for SimMatGrid

View Source
var TableViewType = gti.AddType(&gti.Type{
	Name:       "github.com/emer/etable/v2/etview.TableView",
	ShortName:  "etview.TableView",
	IDName:     "table-view",
	Doc:        "etview.TableView provides a GUI interface for etable.Table's",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Table", &gti.Field{Name: "Table", Type: "*github.com/emer/etable/v2/etable.IdxView", LocalType: "*etable.IdxView", Doc: "the idx view of the table that we're a view of", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"TsrDisp", &gti.Field{Name: "TsrDisp", Type: "github.com/emer/etable/v2/etview.TensorDisp", LocalType: "TensorDisp", Doc: "overall display options for tensor display", Directives: gti.Directives{}, Tag: ""}},
		{"ColTsrDisp", &gti.Field{Name: "ColTsrDisp", Type: "map[int]*github.com/emer/etable/v2/etview.TensorDisp", LocalType: "map[int]*TensorDisp", Doc: "per column tensor display params", Directives: gti.Directives{}, Tag: ""}},
		{"ColTsrBlank", &gti.Field{Name: "ColTsrBlank", Type: "map[int]*github.com/emer/etable/v2/etensor.Float64", LocalType: "map[int]*etensor.Float64", Doc: "per column blank tensor values", Directives: gti.Directives{}, Tag: ""}},
		{"NCols", &gti.Field{Name: "NCols", Type: "int", LocalType: "int", Doc: "number of columns in table (as of last update)", Directives: gti.Directives{}, Tag: "edit:\"-\""}},
		{"SortIdx", &gti.Field{Name: "SortIdx", Type: "int", LocalType: "int", Doc: "current sort index", Directives: gti.Directives{}, Tag: ""}},
		{"SortDesc", &gti.Field{Name: "SortDesc", Type: "bool", LocalType: "bool", Doc: "whether current sort order is descending", Directives: gti.Directives{}, Tag: ""}},
		{"HeaderWidths", &gti.Field{Name: "HeaderWidths", Type: "[]int", LocalType: "[]int", Doc: "HeaderWidths has number of characters in each header, per visfields", Directives: gti.Directives{}, Tag: "copy:\"-\" view:\"-\" json:\"-\" xml:\"-\""}},
		{"BlankString", &gti.Field{Name: "BlankString", Type: "string", LocalType: "string", Doc: "\tblank values for out-of-range rows", Directives: gti.Directives{}, Tag: ""}},
		{"BlankFloat", &gti.Field{Name: "BlankFloat", Type: "float64", LocalType: "float64", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"SliceViewBase", &gti.Field{Name: "SliceViewBase", Type: "goki.dev/giv.SliceViewBase", LocalType: "giv.SliceViewBase", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &TableView{},
})

TableViewType is the gti.Type for TableView

View Source
var TensorGridType = gti.AddType(&gti.Type{
	Name:       "github.com/emer/etable/v2/etview.TensorGrid",
	ShortName:  "etview.TensorGrid",
	IDName:     "tensor-grid",
	Doc:        "TensorGrid is a widget that displays tensor values as a grid of colored squares.",
	Directives: gti.Directives{},
	Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"Tensor", &gti.Field{Name: "Tensor", Type: "github.com/emer/etable/v2/etensor.Tensor", LocalType: "etensor.Tensor", Doc: "the tensor that we view", Directives: gti.Directives{}, Tag: "set:\"-\""}},
		{"Disp", &gti.Field{Name: "Disp", Type: "github.com/emer/etable/v2/etview.TensorDisp", LocalType: "TensorDisp", Doc: "display options", Directives: gti.Directives{}, Tag: ""}},
		{"ColorMap", &gti.Field{Name: "ColorMap", Type: "*goki.dev/colors/colormap.Map", LocalType: "*colormap.Map", Doc: "the actual colormap", Directives: gti.Directives{}, Tag: ""}},
	}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"WidgetBase", &gti.Field{Name: "WidgetBase", Type: "goki.dev/gi.WidgetBase", LocalType: "gi.WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &TensorGrid{},
})

TensorGridType is the gti.Type for TensorGrid

View Source
var TensorViewType = gti.AddType(&gti.Type{
	Name:       "github.com/emer/etable/v2/etview.TensorView",
	ShortName:  "etview.TensorView",
	IDName:     "tensor-view",
	Doc:        "etview.TensorView provides a GUI interface for etable.Tensor's\nusing a tabular rows-and-columns interface using textfields for editing.\nThis provides an editable complement to the TensorGrid graphical display.",
	Directives: gti.Directives{},
	Fields:     ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}),
	Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{
		{"WidgetBase", &gti.Field{Name: "WidgetBase", Type: "goki.dev/gi.WidgetBase", LocalType: "gi.WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}},
	}),
	Methods:  ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}),
	Instance: &TensorView{},
})

TensorViewType is the gti.Type for TensorView

Functions

This section is empty.

Types

type SimMatGrid

type SimMatGrid struct {
	TensorGrid

	// the similarity / distance matrix
	SimMat *simat.SimMat `set:"-"`
	// contains filtered or unexported fields
}

SimMatGrid is a widget that displays a similarity / distance matrix with tensor values as a grid of colored squares, and labels for rows, cols

func NewSimMatGrid

func NewSimMatGrid(par ki.Ki, name ...string) *SimMatGrid

NewSimMatGrid adds a new SimMatGrid with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*SimMatGrid) KiType

func (t *SimMatGrid) KiType() *gti.Type

KiType returns the *gti.Type of SimMatGrid

func (*SimMatGrid) MinSize

func (tg *SimMatGrid) MinSize() mat32.Vec2

func (*SimMatGrid) New

func (t *SimMatGrid) New() ki.Ki

New returns a new *SimMatGrid value

func (*SimMatGrid) OnInit

func (tg *SimMatGrid) OnInit()

Defaults sets defaults for values that are at nonsensical initial values

func (*SimMatGrid) Render

func (tg *SimMatGrid) Render()

func (*SimMatGrid) RenderSimMat

func (tg *SimMatGrid) RenderSimMat()

func (*SimMatGrid) SetColMaxSz

func (t *SimMatGrid) SetColMaxSz(v mat32.Vec2) *SimMatGrid

SetColMaxSz sets the [SimMatGrid.colMaxSz]

func (*SimMatGrid) SetColMinBlank

func (t *SimMatGrid) SetColMinBlank(v int) *SimMatGrid

SetColMinBlank sets the [SimMatGrid.colMinBlank]

func (*SimMatGrid) SetColNgps

func (t *SimMatGrid) SetColNgps(v int) *SimMatGrid

SetColNgps sets the [SimMatGrid.colNGps]

func (*SimMatGrid) SetColorMap

func (t *SimMatGrid) SetColorMap(v *colormap.Map) *SimMatGrid

SetColorMap sets the [SimMatGrid.ColorMap]

func (*SimMatGrid) SetDisp

func (t *SimMatGrid) SetDisp(v TensorDisp) *SimMatGrid

SetDisp sets the [SimMatGrid.Disp]

func (*SimMatGrid) SetRowMaxSz

func (t *SimMatGrid) SetRowMaxSz(v mat32.Vec2) *SimMatGrid

SetRowMaxSz sets the [SimMatGrid.rowMaxSz]

func (*SimMatGrid) SetRowMinBlank

func (t *SimMatGrid) SetRowMinBlank(v int) *SimMatGrid

SetRowMinBlank sets the [SimMatGrid.rowMinBlank]

func (*SimMatGrid) SetRowNgps

func (t *SimMatGrid) SetRowNgps(v int) *SimMatGrid

SetRowNgps sets the [SimMatGrid.rowNGps]

func (*SimMatGrid) SetSimMat

func (tg *SimMatGrid) SetSimMat(smat *simat.SimMat) *SimMatGrid

SetSimMat sets the similarity matrix and triggers a display update

func (*SimMatGrid) SetTooltip

func (t *SimMatGrid) SetTooltip(v string) *SimMatGrid

SetTooltip sets the [SimMatGrid.Tooltip]

func (*SimMatGrid) SizeLabel

func (tg *SimMatGrid) SizeLabel(lbs []string, col bool) (minBlank, ngps int, sz mat32.Vec2)

type SimMatValue

type SimMatValue struct {
	giv.ValueBase
}

SimMatValue presents a button that pulls up the SimMatGridView viewer for an etable.Table

func (*SimMatValue) ConfigDialog

func (vv *SimMatValue) ConfigDialog(d *gi.Body) (bool, func())

func (*SimMatValue) ConfigWidget

func (vv *SimMatValue) ConfigWidget(w gi.Widget)

func (*SimMatValue) HasDialog

func (vv *SimMatValue) HasDialog() bool

func (*SimMatValue) OpenDialog

func (vv *SimMatValue) OpenDialog(ctx gi.Widget, fun func())

func (*SimMatValue) UpdateWidget

func (vv *SimMatValue) UpdateWidget()

func (*SimMatValue) WidgetType

func (vv *SimMatValue) WidgetType() *gti.Type

type TableValue

type TableValue struct {
	giv.ValueBase
}

TableValue presents a button that pulls up the TableView viewer for an etable.Table

func (*TableValue) ConfigDialog

func (vv *TableValue) ConfigDialog(d *gi.Body) (bool, func())

func (*TableValue) ConfigWidget

func (vv *TableValue) ConfigWidget(w gi.Widget)

func (*TableValue) HasDialog

func (vv *TableValue) HasDialog() bool

func (*TableValue) OpenDialog

func (vv *TableValue) OpenDialog(ctx gi.Widget, fun func())

func (*TableValue) UpdateWidget

func (vv *TableValue) UpdateWidget()

func (*TableValue) WidgetType

func (vv *TableValue) WidgetType() *gti.Type

type TableView

type TableView struct {
	giv.SliceViewBase

	// the idx view of the table that we're a view of
	Table *etable.IdxView `set:"-"`

	// overall display options for tensor display
	TsrDisp TensorDisp

	// per column tensor display params
	ColTsrDisp map[int]*TensorDisp

	// per column blank tensor values
	ColTsrBlank map[int]*etensor.Float64

	// number of columns in table (as of last update)
	NCols int `edit:"-"`

	// current sort index
	SortIdx int

	// whether current sort order is descending
	SortDesc bool

	// HeaderWidths has number of characters in each header, per visfields
	HeaderWidths []int `copy:"-" view:"-" json:"-" xml:"-"`

	//	blank values for out-of-range rows
	BlankString string
	BlankFloat  float64
}

etview.TableView provides a GUI interface for etable.Table's

func NewTableView

func NewTableView(par ki.Ki, name ...string) *TableView

NewTableView adds a new TableView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*TableView) ColTensorBlank

func (tv *TableView) ColTensorBlank(cidx int, col etensor.Tensor) *etensor.Float64

ColTensorBlank returns tensor blanks for given tensor col

func (*TableView) ColTensorDisp

func (tv *TableView) ColTensorDisp(col int) *TensorDisp

ColTensorDisp returns tensor display parameters for this column either the overall defaults or the per-column if set

func (*TableView) ConfigFrame

func (tv *TableView) ConfigFrame()

func (*TableView) ConfigHeader

func (tv *TableView) ConfigHeader()

func (*TableView) ConfigRows

func (tv *TableView) ConfigRows()

ConfigRows configures VisRows worth of widgets to display slice data. It should only be called when NeedsConfigRows is true: when VisRows changes.

func (*TableView) ConfigTableView

func (tv *TableView) ConfigTableView()

func (*TableView) ConfigToolbar

func (tv *TableView) ConfigToolbar(tb *gi.Toolbar)

func (*TableView) ConfigWidget

func (tv *TableView) ConfigWidget()

Config configures the view

func (*TableView) EditIdx

func (tv *TableView) EditIdx(idx int)

func (*TableView) GoUpdateView

func (tv *TableView) GoUpdateView()

GoUpdateView updates the display for asynchronous updating from other goroutines. Also updates indexview (calling Sequential).

func (*TableView) KiType

func (t *TableView) KiType() *gti.Type

KiType returns the *gti.Type of TableView

func (*TableView) New

func (t *TableView) New() ki.Ki

New returns a new *TableView value

func (*TableView) OnInit

func (tv *TableView) OnInit()

func (*TableView) RowFirstVisWidget

func (tv *TableView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)

RowFirstVisWidget returns the first visible widget for given row (could be index or not) -- false if out of range

func (*TableView) RowGrabFocus

func (tv *TableView) RowGrabFocus(row int) *gi.WidgetBase

RowGrabFocus grabs the focus for the first focusable widget in given row -- returns that element or nil if not successful -- note: grid must have already rendered for focus to be grabbed!

func (*TableView) RowWidgetNs

func (tv *TableView) RowWidgetNs() (nWidgPerRow, idxOff int)

RowWidgetNs returns number of widgets per row and offset for index label

func (*TableView) SelectRowWidgets

func (tv *TableView) SelectRowWidgets(row int, sel bool)

SelectRowWidgets sets the selection state of given row of widgets

func (*TableView) SetBlankFloat

func (t *TableView) SetBlankFloat(v float64) *TableView

SetBlankFloat sets the [TableView.BlankFloat]

func (*TableView) SetBlankString

func (t *TableView) SetBlankString(v string) *TableView

SetBlankString sets the [TableView.BlankString]:

blank values for out-of-range rows

func (*TableView) SetColTensorDisp

func (tv *TableView) SetColTensorDisp(col int) *TensorDisp

SetColTensorDisp sets per-column tensor display params and returns them if already set, just returns them

func (*TableView) SetColTsrBlank

func (t *TableView) SetColTsrBlank(v map[int]*etensor.Float64) *TableView

SetColTsrBlank sets the [TableView.ColTsrBlank]: per column blank tensor values

func (*TableView) SetColTsrDisp

func (t *TableView) SetColTsrDisp(v map[int]*TensorDisp) *TableView

SetColTsrDisp sets the [TableView.ColTsrDisp]: per column tensor display params

func (*TableView) SetConfigIter

func (t *TableView) SetConfigIter(v int) *TableView

SetConfigIter sets the [TableView.ConfigIter]

func (*TableView) SetDraggedIdxs

func (t *TableView) SetDraggedIdxs(v []int) *TableView

SetDraggedIdxs sets the [TableView.DraggedIdxs]

func (*TableView) SetElVal

func (t *TableView) SetElVal(v reflect.Value) *TableView

SetElVal sets the [TableView.ElVal]

func (*TableView) SetHeaderWidths

func (t *TableView) SetHeaderWidths(v []int) *TableView

SetHeaderWidths sets the [TableView.HeaderWidths]: HeaderWidths has number of characters in each header, per visfields

func (*TableView) SetInitSelIdx

func (t *TableView) SetInitSelIdx(v int) *TableView

SetInitSelIdx sets the [TableView.InitSelIdx]

func (*TableView) SetMinRows

func (t *TableView) SetMinRows(v int) *TableView

SetMinRows sets the [TableView.MinRows]

func (*TableView) SetNcols

func (t *TableView) SetNcols(v int) *TableView

SetNcols sets the [TableView.NCols]: number of columns in table (as of last update)

func (*TableView) SetSelIdx

func (t *TableView) SetSelIdx(v int) *TableView

SetSelIdx sets the [TableView.SelIdx]

func (*TableView) SetSelIdxs

func (t *TableView) SetSelIdxs(v map[int]struct{}) *TableView

SetSelIdxs sets the [TableView.SelIdxs]

func (*TableView) SetSelVal

func (t *TableView) SetSelVal(v any) *TableView

SetSelVal sets the [TableView.SelVal]

func (*TableView) SetSliceNpval

func (t *TableView) SetSliceNpval(v reflect.Value) *TableView

SetSliceNpval sets the [TableView.SliceNPVal]

func (*TableView) SetSliceSize

func (t *TableView) SetSliceSize(v int) *TableView

SetSliceSize sets the [TableView.SliceSize]

func (*TableView) SetSliceValView

func (t *TableView) SetSliceValView(v giv.Value) *TableView

SetSliceValView sets the [TableView.SliceValView]

func (*TableView) SetSortDesc

func (t *TableView) SetSortDesc(v bool) *TableView

SetSortDesc sets the [TableView.SortDesc]: whether current sort order is descending

func (*TableView) SetSortFieldName

func (tv *TableView) SetSortFieldName(nm string)

SetSortField sets sorting to happen on given field and direction -- see SortFieldName for details

func (*TableView) SetSortIdx

func (t *TableView) SetSortIdx(v int) *TableView

SetSortIdx sets the [TableView.SortIdx]: current sort index

func (*TableView) SetStackTop

func (t *TableView) SetStackTop(v int) *TableView

SetStackTop sets the [TableView.StackTop]

func (*TableView) SetStartIdx

func (t *TableView) SetStartIdx(v int) *TableView

SetStartIdx sets the [TableView.StartIdx]

func (*TableView) SetStripes

func (t *TableView) SetStripes(v gi.Stripes) *TableView

SetStripes sets the [TableView.Stripes]

func (*TableView) SetStyles

func (tv *TableView) SetStyles()

func (*TableView) SetTable

func (tv *TableView) SetTable(et *etable.Table) *TableView

SetTable sets the source table that we are viewing, using a sequential IdxView and then configures the display

func (*TableView) SetTableView

func (tv *TableView) SetTableView(ix *etable.IdxView) *TableView

SetTableView sets the source IdxView of a table (using a copy so original is not modified) and then configures the display

func (*TableView) SetTmpIdx

func (t *TableView) SetTmpIdx(v int) *TableView

SetTmpIdx sets the [TableView.TmpIdx]

func (*TableView) SetTmpSave

func (t *TableView) SetTmpSave(v giv.Value) *TableView

SetTmpSave sets the [TableView.TmpSave]

func (*TableView) SetTooltip

func (t *TableView) SetTooltip(v string) *TableView

SetTooltip sets the [TableView.Tooltip]

func (*TableView) SetTsrDisp

func (t *TableView) SetTsrDisp(v TensorDisp) *TableView

SetTsrDisp sets the [TableView.TsrDisp]: overall display options for tensor display

func (*TableView) SetValues

func (t *TableView) SetValues(v []giv.Value) *TableView

SetValues sets the [TableView.Values]

func (*TableView) SetViewMu

func (t *TableView) SetViewMu(v *sync.Mutex) *TableView

SetViewMu sets the [TableView.ViewMu]

func (*TableView) SetViewPath

func (t *TableView) SetViewPath(v string) *TableView

SetViewPath sets the [TableView.ViewPath]

func (*TableView) SetVisRows

func (t *TableView) SetVisRows(v int) *TableView

SetVisRows sets the [TableView.VisRows]

func (*TableView) SizeFinal

func (tv *TableView) SizeFinal()

func (*TableView) SliceDeleteAt

func (tv *TableView) SliceDeleteAt(idx int)

SliceDeleteAt deletes element at given index from slice -- doUpdt means call UpdateSliceGrid to update display

func (*TableView) SliceGrid

func (tv *TableView) SliceGrid() *giv.SliceViewGrid

SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values, within SliceFrame

func (*TableView) SliceHeader

func (tv *TableView) SliceHeader() *gi.Frame

SliceHeader returns the Frame header for slice grid

func (*TableView) SliceNewAt

func (tv *TableView) SliceNewAt(idx int)

SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end

func (*TableView) SortFieldName

func (tv *TableView) SortFieldName() string

SortFieldName returns the name of the field being sorted, along with :up or :down depending on descending

func (*TableView) SortSliceAction

func (tv *TableView) SortSliceAction(fldIdx int)

SortSliceAction sorts the slice for given field index -- toggles ascending vs. descending if already sorting on this dimension

func (*TableView) StyleRow

func (tv *TableView) StyleRow(w gi.Widget, idx, fidx int)

func (*TableView) TensorDispAction

func (tv *TableView) TensorDispAction(fldIdx int)

TensorDispAction allows user to select tensor display options for column pass -1 for global params for the entire table

func (*TableView) UpdateWidgets

func (tv *TableView) UpdateWidgets()

UpdateWidgets updates the row widget display to represent the current state of the slice data, including which range of data is being displayed. This is called for scrolling, navigation etc.

func (*TableView) UpdtSliceSize

func (tv *TableView) UpdtSliceSize() int

type TensorDisp

type TensorDisp struct {
	TensorLayout

	// range to plot
	Range minmax.Range64 `view:"inline"`

	// if not using fixed range, this is the actual range of data
	MinMax minmax.F64 `view:"inline"`

	// the name of the color map to use in translating values to colors
	ColorMap giv.ColorMapName

	// what proportion of grid square should be filled by color block -- 1 = all, .5 = half, etc
	GridFill float32 `min:"0.1" max:"1" step:"0.1" def:"0.9,1"`

	// amount of extra space to add at dimension boundaries, as a proportion of total grid size
	DimExtra float32 `min:"0" max:"1" step:"0.02" def:"0.1,0.3"`

	// minimum size for grid squares -- they will never be smaller than this
	GridMinSize float32

	// maximum size for grid squares -- they will never be larger than this
	GridMaxSize float32

	// total preferred display size along largest dimension.
	// grid squares will be sized to fit within this size,
	// subject to harder GridMin / Max size constraints
	TotPrefSize float32

	// font size in standard point units for labels (e.g., SimMat)
	FontSize float32

	// our gridview, for update method
	GridView *TensorGrid `copy:"-" json:"-" xml:"-" view:"-"`
}

TensorDisp are options for displaying tensors

func (*TensorDisp) Defaults

func (td *TensorDisp) Defaults()

Defaults sets defaults for values that are at nonsensical initial values

func (*TensorDisp) FmMeta

func (td *TensorDisp) FmMeta(tsr etensor.Tensor)

FmMeta sets display options from Tensor meta-data

type TensorGrid

type TensorGrid struct {
	gi.WidgetBase

	// the tensor that we view
	Tensor etensor.Tensor `set:"-"`

	// display options
	Disp TensorDisp

	// the actual colormap
	ColorMap *colormap.Map
}

TensorGrid is a widget that displays tensor values as a grid of colored squares.

func NewTensorGrid

func NewTensorGrid(par ki.Ki, name ...string) *TensorGrid

NewTensorGrid adds a new TensorGrid with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*TensorGrid) Color

func (tg *TensorGrid) Color(val float64) (norm float64, clr color.Color)

func (*TensorGrid) EnsureColorMap

func (tg *TensorGrid) EnsureColorMap()

EnsureColorMap makes sure there is a valid color map that matches specified name

func (*TensorGrid) HandleEvents

func (tg *TensorGrid) HandleEvents()

func (*TensorGrid) KiType

func (t *TensorGrid) KiType() *gti.Type

KiType returns the *gti.Type of TensorGrid

func (*TensorGrid) MinSize

func (tg *TensorGrid) MinSize() mat32.Vec2

MinSize returns minimum size based on tensor and display settings

func (*TensorGrid) New

func (t *TensorGrid) New() ki.Ki

New returns a new *TensorGrid value

func (*TensorGrid) OnInit

func (tg *TensorGrid) OnInit()

func (*TensorGrid) OpenTensorView

func (tg *TensorGrid) OpenTensorView()

OpenTensorView pulls up a TensorView of our tensor

func (*TensorGrid) Render

func (tg *TensorGrid) Render()

func (*TensorGrid) RenderTensor

func (tg *TensorGrid) RenderTensor()

func (*TensorGrid) SetColorMap

func (t *TensorGrid) SetColorMap(v *colormap.Map) *TensorGrid

SetColorMap sets the [TensorGrid.ColorMap]: the actual colormap

func (*TensorGrid) SetDisp

func (t *TensorGrid) SetDisp(v TensorDisp) *TensorGrid

SetDisp sets the [TensorGrid.Disp]: display options

func (*TensorGrid) SetStyles

func (tg *TensorGrid) SetStyles()

func (*TensorGrid) SetTensor

func (tg *TensorGrid) SetTensor(tsr etensor.Tensor) *TensorGrid

SetTensor sets the tensor and triggers a display update

func (*TensorGrid) SetTooltip

func (t *TensorGrid) SetTooltip(v string) *TensorGrid

SetTooltip sets the [TensorGrid.Tooltip]

func (*TensorGrid) UpdateRange

func (tg *TensorGrid) UpdateRange()

type TensorGridValue

type TensorGridValue struct {
	giv.ValueBase
}

TensorGridValue manages a TensorGrid view of an etensor.Tensor

func (*TensorGridValue) ConfigWidget

func (vv *TensorGridValue) ConfigWidget(w gi.Widget)

func (*TensorGridValue) HasDialog

func (vv *TensorGridValue) HasDialog() bool

func (*TensorGridValue) UpdateWidget

func (vv *TensorGridValue) UpdateWidget()

func (*TensorGridValue) WidgetType

func (vv *TensorGridValue) WidgetType() *gti.Type

type TensorLayout

type TensorLayout struct {

	// even-numbered dimensions are displayed as Y*X rectangles -- this determines along which dimension to display any remaining odd dimension: OddRow = true = organize vertically along row dimension, false = organize horizontally across column dimension
	OddRow bool

	// if true, then the Y=0 coordinate is displayed from the top-down; otherwise the Y=0 coordinate is displayed from the bottom up, which is typical for emergent network patterns.
	TopZero bool

	// display the data as a bitmap image.  if a 2D tensor, then it will be a greyscale image.  if a 3D tensor with size of either the first or last dim = either 3 or 4, then it is a RGB(A) color image
	Image bool
}

TensorLayout are layout options for displaying tensors

type TensorValue

type TensorValue struct {
	giv.ValueBase
}

TensorValue presents a button that pulls up the TensorView viewer for an etensor.Tensor

func (*TensorValue) ConfigDialog

func (vv *TensorValue) ConfigDialog(d *gi.Body) (bool, func())

func (*TensorValue) ConfigWidget

func (vv *TensorValue) ConfigWidget(w gi.Widget)

func (*TensorValue) HasDialog

func (vv *TensorValue) HasDialog() bool

func (*TensorValue) OpenDialog

func (vv *TensorValue) OpenDialog(ctx gi.Widget, fun func())

func (*TensorValue) UpdateWidget

func (vv *TensorValue) UpdateWidget()

func (*TensorValue) WidgetType

func (vv *TensorValue) WidgetType() *gti.Type

type TensorView

type TensorView struct {
	gi.WidgetBase
}

etview.TensorView provides a GUI interface for etable.Tensor's using a tabular rows-and-columns interface using textfields for editing. This provides an editable complement to the TensorGrid graphical display.

func NewTensorView

func NewTensorView(par ki.Ki, name ...string) *TensorView

NewTensorView adds a new TensorView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.

func (*TensorView) KiType

func (t *TensorView) KiType() *gti.Type

KiType returns the *gti.Type of TensorView

func (*TensorView) New

func (t *TensorView) New() ki.Ki

New returns a new *TensorView value

func (*TensorView) SetTooltip

func (t *TensorView) SetTooltip(v string) *TensorView

SetTooltip sets the [TensorView.Tooltip]

Jump to

Keyboard shortcuts

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