Switch to numpy (scipy_version>1.0) changes

This commit is contained in:
2006-08-31 10:04:19 +00:00
parent a0786d521a
commit 0b58c5ea28
3 changed files with 22 additions and 27 deletions

View File

@@ -418,7 +418,7 @@ class LineViewPlot(Plot):
self.line_collection = {}
x_axis = scipy.arrayrange(self._data.shape[minor_axis])
for i in range(self._data.shape[major_axis]):
yi = scipy.take(self._data,[i],axis=major_axis)
yi = self._data.take([i],major_axis)
if self.use_blit:
l,=self.ax.plot(x_axis,yi,'k',alpha=.05,animated=True)
else:
@@ -513,16 +513,15 @@ has no color and size options."""
y1, y2 = y2, y1
assert x1<=x2
assert y1<=y2
index = scipy.nonzero((xdata>x1) & (xdata<x2) & (ydata>y1) & (ydata<y2))
index = scipy.nonzero((xdata>x1) & (xdata<x2) & (ydata>y1) & (ydata<y2))[0]
ids = self.dataset_1.get_identifiers(self.current_dim, index)
self.selection_listener(self.current_dim, ids)
def set_current_selection(self, selection):
ids = selection[self.current_dim] # current identifiers
index = self.dataset_1.get_indices(self.current_dim, ids)
xdata_new = scipy.take(self.xaxis_data, index) #take data
ydata_new = scipy.take(self.yaxis_data, index)
xdata_new = self.xaxis_data.take(index) #take data
ydata_new = self.yaxis_data.take(index)
#remove old selection
if self._selection_line:
self.ax.lines.remove(self._selection_line)
@@ -545,11 +544,11 @@ has no color and size options."""
y_index = dataset_2[sel_dim][id_2]
self.xaxis_data = dataset_1._array[:,x_index]
self.yaxis_data = dataset_2._array[:,y_index]
lw = scipy.zeros(self.xaxis_data.shape,'f')
lw = scipy.zeros(self.xaxis_data.shape)
self.ax.scatter(self.xaxis_data,self.yaxis_data,s=s,c=c,linewidth=lw,edgecolor='k',alpha=.6,cmap = cm.Set1)
self.ax.set_title(self.get_title())
# collection
self.coll = ax.collections[0]
self.coll = self.ax.collections[0]
# add canvas to widget
self.add(self.canvas)
@@ -575,22 +574,19 @@ has no color and size options."""
assert x1<=x2
assert y1<=y2
index = scipy.nonzero((xdata>x1) & (xdata<x2) & (ydata>y1) & (ydata<y2))
index = scipy.nonzero((xdata>x1) & (xdata<x2) & (ydata>y1) & (ydata<y2))[0]
ids = self.dataset_1.get_identifiers(self.current_dim, index)
self.selection_listener(self.current_dim, ids)
def set_current_selection(self, selection):
ids = selection[self.current_dim] # current identifiers
index = self.dataset_1.get_indices(self.current_dim, ids)
lw = scipy.zeros(self.xaxis_data.shape,'f')
lw = scipy.zeros(self.xaxis_data.shape)
scipy.put(lw,index,2.)
zo = lw.copy() + 1 #z-order, selected on top
self.coll.set_linewidth(lw)
self.coll.set_zorder(zo)
self._toolbar.forward() #update data lims before draw
self.canvas.draw()
class NetworkPlot(Plot):
def __init__(self, dataset, **kw):