Debian Codegraph @

hdf_compass/compass_viewer/geo_surface/frame.py

raw symbols SCIP
1 ##############################################################################
2 # Copyright by The HDF Group. #
3 # All rights reserved. #
4 # #
5 # This file is part of the HDF Compass Viewer. The full HDF Compass #
6 # copyright notice, including terms governing use, modification, and #
7 # terms governing use, modification, and redistribution, is contained in #
8 # the file COPYING, which can be found at the root of the source code #
9 # distribution tree. If you do not have access to this file, you may #
10 # request a copy from [email protected]. #
11 # #
12 # author: [email protected] #
13 ##############################################################################
14 """
15 Implements a viewer frame for compass_model.Array.
16 """
17
18 import wx
19 import wx.grid
20 from wx.lib.neweventscip-python python hdf_compass 0.7b15 `wx.lib.newevent`/__init__: import NewCommandEvent
21
22 import osscip-python python python-stdlib 3.11 os/__init__:
23 import loggingscip-python python python-stdlib 3.11 logging/__init__:
24
25 loggerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/logger. = loggingscip-python python python-stdlib 3.11 logging/__init__:.getLoggerscip-python python python-stdlib 3.11 logging/getLogger().(__name__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/)
26
27 from hdf_compass.compass_viewer.framescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/__init__: import NodeFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#
28 from hdf_compass.compass_viewer.geo_surface.plotscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/__init__: import LinePlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/LinePlotFrame#, ContourPlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/ContourPlotFrame#
29
30
31 # Indicates that the slicing selection may have changed.
32 # These events are emitted by the SlicerPanel.
33 ArraySlicedEventscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArraySlicedEvent., EVT_ARRAY_SLICEDscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/EVT_ARRAY_SLICED. = NewCommandEvent()
34
35 # Menu and button IDs
36 ID_VIS_MENU_PLOTscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ID_VIS_MENU_PLOT. = wx.NewIdscip-python python hdf_compass 0.7b15 `wx.core`/Panel#()
37
38
39 class GeoSurfaceFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#(NodeFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#):
40 """
41 Top-level frame displaying objects of type compass_model.Array.
42
43 From top to bottom, has:
44
45 1. Toolbar (see ArrayFrame.init_toolbar)
46 2. SlicerPanel, with controls for changing what's displayed.
47 3. An ArrayGrid, which displays the data in a spreadsheet-like view.
48 """
49
50 def __init__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self), nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(node), posscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(pos)=None):
51 """ Create a new array viewer to display the node. """
52 NodeFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#.__init__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#__init__().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self), nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(node), size=(800, 400), title=nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(node).display_name, pos=posscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(pos))
53
54 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node(). = nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(node)
55
56 # Update the menu
57 vis_menu = wx.Menuscip-python python hdf_compass 0.7b15 `wx.core`/Panel#()
58 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..is_plottable():
59 vis_menu.Append(ID_VIS_MENU_PLOTscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ID_VIS_MENU_PLOT., "Map Surface\tCtrl-D")
60 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).add_menuscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/BaseFrame#add_menu().(vis_menu, "Visualize")
61 # Initialize the toolbar
62 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).init_toolbarscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().()
63
64 # The Slicer is the panel with indexing controls
65 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer. = SlicerPanelscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self), nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(node).shape, nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(node).dtype.fields is not None)
66 # Create the grid array
67 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid. = ArrayGridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self), nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(node), selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer.)
68 # Sizer for slicer and grid
69 gridsizer = wx.BoxSizerscip-python python hdf_compass 0.7b15 `wx.core`/Panel#(wx.VERTICALscip-python python hdf_compass 0.7b15 `wx.core`/Panel#)
70 gridsizer.Add(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer., 0, wx.EXPANDscip-python python hdf_compass 0.7b15 `wx.core`/Panel#)
71 gridsizer.Add(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid., 1, wx.EXPANDscip-python python hdf_compass 0.7b15 `wx.core`/Panel#)
72 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).viewscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#view(). = gridsizer
73
74 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).Bind(EVT_ARRAY_SLICEDscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/EVT_ARRAY_SLICED., selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).on_slicedscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_sliced().)
75 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..is_plottable():
76 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).Bind(wx.EVT_MENUscip-python python hdf_compass 0.7b15 `wx.core`/Panel#, selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).on_plotscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot()., id=ID_VIS_MENU_PLOTscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ID_VIS_MENU_PLOT.)
77
78 # Workaround for wxPython bug (see SlicerPanel.enable_spinctrls)
79 ID_WORKAROUND_TIMER = wx.NewIdscip-python python hdf_compass 0.7b15 `wx.core`/Panel#()
80 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).Bind(wx.EVT_TIMERscip-python python hdf_compass 0.7b15 `wx.core`/Panel#, selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).on_workaround_timerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_workaround_timer()., id=ID_WORKAROUND_TIMER)
81 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).timerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#timer. = wx.Timerscip-python python hdf_compass 0.7b15 `wx.core`/Panel#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self), ID_WORKAROUND_TIMER)
82 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#__init__().(self).timerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#timer..Start(100)
83
84 def init_toolbarscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self)):
85 """ Set up the toolbar at the top of the window. """
86 t_size = (24, 24)
87 plot_bmp = wx.Bitmapscip-python python hdf_compass 0.7b15 `wx.core`/Panel#(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..joinscip-python python python-stdlib 3.11 posixpath/abspath().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).icon_folderscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/BaseFrame#icon_folder., "viz_plot_24.png"), wx.BITMAP_TYPE_ANYscip-python python hdf_compass 0.7b15 `wx.core`/Panel#)
88
89 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).toolbarscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#toolbar. = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).CreateToolBar(wx.TB_HORIZONTALscip-python python hdf_compass 0.7b15 `wx.core`/Panel# | wx.NO_BORDERscip-python python hdf_compass 0.7b15 `wx.core`/Panel# | wx.TB_FLATscip-python python hdf_compass 0.7b15 `wx.core`/Panel# | wx.TB_TEXTscip-python python hdf_compass 0.7b15 `wx.core`/Panel#)
90
91 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).toolbarscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#toolbar..SetToolBitmapSize(t_size)
92 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).toolbarscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#toolbar..AddStretchableSpace()
93 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..is_plottable():
94 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).toolbarscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#toolbar..AddTool(ID_VIS_MENU_PLOTscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ID_VIS_MENU_PLOT., "Map Surface", plot_bmp)
95 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#init_toolbar().(self).toolbarscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#toolbar..Realize()
96
97 def on_slicedscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_sliced().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_sliced().(self), evtscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_sliced().(evt)):
98 """ User has chosen to display a different part of the dataset. """
99 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_sliced().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid..Refresh()
100
101 def on_plotscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self), evtscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(evt)):
102 """ User has chosen to plot the current selection """
103 cols = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid..GetSelectedCols()
104 rows = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid..GetSelectedRows()
105
106 # Scalar data can't be line-plotted.
107 if len(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..shape) == 0:
108 return
109
110 # Columns in the view are selected
111 if len(cols) != 0:
112
113 # The data is compound
114 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..dtype.names is not None:
115 names = [selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid..GetColLabelValue(x) for x in cols]
116 data = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node().[selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer..indicesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices().] # -> 1D compound array
117 data = [data[n] for n in names]
118 f = LinePlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/LinePlotFrame#(data, names)
119 f.Show()
120
121 # Plot multiple columns independently
122 else:
123 if len(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..shape) == 1:
124 data = [selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node().[selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer..indicesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices().]]
125 else:
126 data = [selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node().[selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer..indicesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices(). + (c,)] for c in cols]
127
128 names = ["Col %d" % c for c in cols] if len(data) > 1 else None
129
130 f = LinePlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/LinePlotFrame#(data, names)
131 f.Show()
132
133
134 # Rows in view are selected
135 elif len(rows) != 0:
136
137 data = [selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node().[selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer..indicesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices(). + (slicescip-python python python-stdlib 3.11 builtins/slice#(None, None, None), r)] for r in rows]
138 names = ["Row %d" % r for r in rows] if len(data) > 1 else None
139
140 f = LinePlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/LinePlotFrame#(data, names)
141 f.Show()
142
143
144 # No row or column selection. Plot everything
145 else:
146
147 data = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node().[selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer..indicesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices().]
148
149 # The data is compound
150 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..dtype.names is not None:
151 names = [selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid..GetColLabelValue(x) for x in rangescip-python python python-stdlib 3.11 builtins/range#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).gridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#grid..GetNumberCols())]
152 data = [data[n] for n in names]
153 f = LinePlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/LinePlotFrame#(data, names)
154 f.Show()
155
156 # Plot 1D
157 elif len(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..shape) == 1:
158 f = LinePlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/LinePlotFrame#([data])
159 f.Show()
160
161 # Plot 2D
162 else:
163 f = ContourPlotFramescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/ContourPlotFrame#(data, extentscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.plot`/ContourPlotFrame#__init__().(extent)=selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_plot().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.frame`/NodeFrame#node()..extent)
164 f.Show()
165
166 def on_workaround_timerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_workaround_timer().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_workaround_timer().(self), evtscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_workaround_timer().(evt)):
167 """ See slicer.enable_spinctrls docs """
168 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_workaround_timer().(self).timerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#timer..Destroy()
169 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#on_workaround_timer().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/GeoSurfaceFrame#slicer..enable_spinctrlsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#enable_spinctrls().()
170
171
172 class SlicerPanelscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#(wx.Panelscip-python python hdf_compass 0.7b15 `wx.core`/Panel#):
173 """
174 Holds controls for data access.
175
176 Consult the "indices" property, which returns a tuple of indices that
177 prefix the array. This will be RANK-2 elements long, unless hasfields
178 is true, in which case it will be RANK-1 elements long.
179 """
180
181 @propertyscip-python python python-stdlib 3.11 builtins/property#
182 def indicesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices().(self)):
183 """ A tuple of integer indices appropriate for slicing.
184
185 Will be RANK-2 elements long, RANK-1 if compound data is in use
186 (hasfields == True).
187 """
188 return tuplescip-python python python-stdlib 3.11 builtins/tuple#([x.GetValue() for x in selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#indices().(self).spincontrolsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#spincontrols.])
189
190 def __init__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self), parentscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(parent), shapescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(shape), hasfieldsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(hasfields)):
191 """ Create a new slicer panel.
192
193 parent: The wxPython parent window
194 shape: Shape of the data to visualize
195 hasfields: If True, the data is compound and the grid can only
196 display one axis. So, we should display an extra spinbox.
197 """
198 wx.Panelscip-python python hdf_compass 0.7b15 `wx.core`/Panel#.__init__(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self), parentscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(parent))
199
200 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self).shapescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#shape. = shapescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(shape)
201 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self).hasfieldsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#hasfields. = hasfieldsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(hasfields)
202 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self).spincontrolsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#spincontrols. = []
203
204 # Rank of the underlying array
205 rank = len(shapescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(shape))
206
207 # Rank displayable in the grid. If fields are present, they occupy
208 # the columns, so the data displayed is actually 1-D.
209 visible_rank = 1 if hasfieldsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(hasfields) else 2
210
211 sizer = wx.BoxSizerscip-python python hdf_compass 0.7b15 `wx.core`/Panel#(wx.HORIZONTALscip-python python hdf_compass 0.7b15 `wx.core`/Panel#) # Will arrange the SpinCtrls
212
213 if rank > visible_rank:
214 infotext = wx.StaticTextscip-python python hdf_compass 0.7b15 `wx.core`/Panel#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self), wx.ID_ANYscip-python python hdf_compass 0.7b15 `wx.core`/Panel#, "Array Indexing: ")
215 sizer.Add(infotext, 0, flag=wx.EXPANDscip-python python hdf_compass 0.7b15 `wx.core`/Panel# | wx.ALLscip-python python hdf_compass 0.7b15 `wx.core`/Panel#, border=10)
216
217 for idx in rangescip-python python python-stdlib 3.11 builtins/range#(rank - visible_rank):
218 sc = wx.SpinCtrlscip-python python hdf_compass 0.7b15 `wx.core`/Panel#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self), max=shapescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(shape)[idx] - 1, value="0", min=0)
219 sizer.Add(sc, 0, flag=wx.EXPANDscip-python python hdf_compass 0.7b15 `wx.core`/Panel# | wx.ALLscip-python python hdf_compass 0.7b15 `wx.core`/Panel#, border=10)
220 sc.Disable()
221 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self).spincontrolsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#spincontrols..appendscip-python python python-stdlib 3.11 builtins/list#append().(sc)
222
223 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self).SetSizer(sizer)
224
225 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self).Bind(wx.EVT_SPINCTRLscip-python python hdf_compass 0.7b15 `wx.core`/Panel#, selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#__init__().(self).on_spinscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#on_spin().)
226
227 def enable_spinctrlsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#enable_spinctrls().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#enable_spinctrls().(self)):
228 """ Unlock the spin controls.
229
230 Because of a bug in wxPython on Mac, by default the first spin control
231 has bizarre contents (and control focus) when the panel starts up.
232 Call this after a short delay (e.g. 100 ms) to enable indexing.
233 """
234 for sc in selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#enable_spinctrls().(self).spincontrolsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#spincontrols.:
235 sc.Enable()
236
237 def on_spinscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#on_spin().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#on_spin().(self), evtscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#on_spin().(evt)):
238 """ Spinbox value changed; notify parent to refresh the grid. """
239 wx.PostEventscip-python python hdf_compass 0.7b15 `wx.core`/Panel#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#on_spin().(self), ArraySlicedEventscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArraySlicedEvent.(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/SlicerPanel#on_spin().(self).GetId()))
240
241
242 class ArrayGridscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#(wx.grid.Grid):
243 """
244 Grid class to display the Array.
245
246 Cell contents and appearance are handled by the table model in ArrayTable.
247 """
248
249 def __init__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(self), parentscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(parent), nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(node), slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(slicer)):
250 wx.grid.Grid.__init__(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(self), parentscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(parent))
251 table = ArrayTablescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#(nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(node), slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(slicer))
252 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(self).SetTable(table, True)
253
254 # Column selection is always allowed
255 selmode = 2 # wx.grid.Grid.SelectColumns
256
257 # Row selection is forbidden for compound types, and for
258 # scalar/1-D datasets
259 if nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(node).dtype.names is None and len(nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(node).shape) > 1:
260 selmode |= 1 # wx.grid.Grid.SelectRows
261
262 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayGrid#__init__().(self).SetSelectionMode(selmode)
263
264
265 class LRUTileCachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#(objectscip-python python python-stdlib 3.11 builtins/object#):
266 """
267 Simple tile-based LRU cache which goes between the Grid and
268 the Array object. Caches tiles along the last 1 or 2 dimensions
269 of a dataset.
270
271 Access is via __getitem__. Because this class exists specifically
272 to support point-based callbacks for the Grid, arguments may
273 only be indices, not slices.
274 """
275
276 TILESIZEscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#TILESIZE. = 100 # Tiles will have shape (100,) or (100, 100)
277 MAXTILESscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#MAXTILES. = 50 # Max number of tiles to retain in the cache
278
279 def __init__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__init__().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__init__().(self), arrscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__init__().(arr)):
280 """ *arr* is anything implementing compass_model.Array """
281 import collectionsscip-python python python-stdlib 3.11 collections/__init__:
282 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__init__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#cache. = collectionsscip-python python python-stdlib 3.11 collections/__init__:.OrderedDictscip-python python python-stdlib 3.11 collections/OrderedDict#()
283 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__init__().(self).arrscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#arr. = arrscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__init__().(arr)
284
285 def __getitem__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self), argsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(args)):
286 """ Restricted to an index or tuple of indices. """
287
288 if not isinstance(argsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(args), tuplescip-python python python-stdlib 3.11 builtins/tuple#):
289 argsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(args) = (argsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(args),)
290
291 # Split off the last 1 or 2 dimensions
292 coarse_position, fine_position = argsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(args)[0:-2], argsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(args)[-2:]
293
294 def clipscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#clip().(xscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#clip().(x)):
295 """ Round down to nearest TILESIZE; takes e.g. 181 -> 100 """
296 return (xscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#clip().(x) // selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).TILESIZEscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#TILESIZE.) * selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).TILESIZEscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#TILESIZE.
297
298 # Tuple with index of tile corner
299 tile_key = coarse_position + tuplescip-python python python-stdlib 3.11 builtins/tuple#(clipscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#clip().(x) for x in fine_position)
300
301 # Slice which will be applied to dataset to retrieve tile
302 tile_slice = coarse_position + tuplescip-python python python-stdlib 3.11 builtins/tuple#(slicescip-python python python-stdlib 3.11 builtins/slice#(clipscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#clip().(x), clipscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#clip().(x) + selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).TILESIZEscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#TILESIZE.) for x in fine_position)
303
304 # Index applied to tile to retrieve the desired data point
305 tile_data_index = tuplescip-python python python-stdlib 3.11 builtins/tuple#(x % selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).TILESIZEscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#TILESIZE. for x in fine_position)
306
307 # Case 1: Add tile to cache, ejecting oldest tile if needed
308 if not tile_key in selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#cache.:
309
310 if len(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#cache.) >= selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).MAXTILESscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#MAXTILES.:
311 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#cache..popitemscip-python python python-stdlib 3.11 collections/OrderedDict#popitem().(lastscip-python python python-stdlib 3.11 collections/OrderedDict#popitem().(last)=False)
312
313 tile = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).arrscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#arr.[tile_slice]
314 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#cache.[tile_key] = tile
315
316 # Case 2: Mark the tile as recently accessed
317 else:
318 tile = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#cache..popscip-python python python-stdlib 3.11 builtins/dict#pop().(tile_key)
319 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#__getitem__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#cache.[tile_key] = tile
320
321 return tile[tile_data_index]
322
323
324 class ArrayTablescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#(wx.grid.GridTableBase):
325 """
326 "Table" class which provides data and metadata for the grid to display.
327
328 The methods defined here define the contents of the table, as well as
329 the number of rows, columns and their values.
330 """
331
332 def __init__scip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self), nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(node), slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(slicer)):
333 """ Create a new Table instance for use with a grid control.
334
335 node: An compass_model.Array implementation instance.
336 slicer: An instance of SlicerPanel, so we can see what indices the
337 user has requested.
338 """
339 wx.grid.GridTableBase.__init__(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self))
340
341 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#node. = nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(node)
342 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#slicer. = slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(slicer)
343
344 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. = len(nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(node).shape)
345 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names. = nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(node).dtype.names
346
347 selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#cache. = LRUTileCachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/LRUTileCache#(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#__init__().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#node.)
348
349 def GetNumberRowsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberRows().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberRows().(self)):
350 """ Callback for number of rows displayed by the grid control """
351 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberRows().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. == 0:
352 return 1
353 return selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberRows().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#node..shape[-1]
354
355 def GetNumberColsscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberCols().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberCols().(self)):
356 """ Callback for number of columns displayed by the grid control.
357
358 Note that if compound data is in use, columns display the field names.
359 """
360 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberCols().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names. is not None:
361 return len(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberCols().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names.)
362 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberCols().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. < 2:
363 return 1
364 return selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetNumberCols().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#node..shape[-2]
365
366 def GetValuescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self), rowscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(row), colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(col)):
367 """ Callback which provides data to the Grid.
368
369 row, col: Integers giving row and column position (0-based).
370 """
371 # Scalar case
372 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. == 0:
373 data = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).nodescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#node.[()]
374 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names. is None:
375 return "%s" % data
376 return "%s" %data[colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(col)]
377
378 # 1D case
379 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. == 1:
380 data = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#cache.[rowscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(row)]
381 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names. is None:
382 return "%s" % data
383 return "%s" % data[selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names.[colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(col)]]
384
385 # ND case. Watch out for compound mode!
386 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names. is None:
387 args = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#slicer..indices + (colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(col), rowscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(row))
388 else:
389 args = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).slicerscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#slicer..indices + (rowscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(row),)
390
391 data = selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).cachescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#cache.[args]
392 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names. is None:
393 return "%s" % data
394 return "%s" % data[selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names.[colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetValue().(col)]]
395
396 def GetRowLabelValuescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetRowLabelValue().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetRowLabelValue().(self), rowscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetRowLabelValue().(row)):
397 """ Callback for row labels.
398
399 Row number is used unless the data is scalar.
400 """
401 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetRowLabelValue().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. == 0:
402 return "Value"
403 return strscip-python python python-stdlib 3.11 builtins/str#(rowscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetRowLabelValue().(row))
404
405 def GetColLabelValuescip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(self), colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(col)):
406 """ Callback for column labels.
407
408 Column number is used, except for scalar or 1D data, or if we're
409 displaying field names in the columns.
410 """
411 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names. is not None:
412 return selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(self).namesscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#names.[colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(col)]
413 if selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. == 0 or selfscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(self).rankscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#rank. == 1:
414 return "Value"
415 return strscip-python python python-stdlib 3.11 builtins/str#(colscip-python python hdf_compass 0.7b15 `hdf_compass.compass_viewer.geo_surface.frame`/ArrayTable#GetColLabelValue().(col))