本文整理汇总了Python中matplotlib.widgets.RectangleSelector.dims方法的典型用法代码示例。如果您正苦于以下问题:Python RectangleSelector.dims方法的具体用法?Python RectangleSelector.dims怎么用?Python RectangleSelector.dims使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.widgets.RectangleSelector
的用法示例。
在下文中一共展示了RectangleSelector.dims方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from matplotlib.widgets import RectangleSelector [as 别名]
# 或者: from matplotlib.widgets.RectangleSelector import dims [as 别名]
[nx, ny, nz, nt] = image4d.shape
if timepts == []:
timepts = range(0, nt) # set time points used for correlation
''' select area used as reference waveform '''
fig = pyplot.figure(2)
ax = pyplot.gca()
REFimg = ax.imshow(np.mean(image4d[:, :, 0, :], axis=2), interpolation='none')
RS = RectangleSelector(ax, onselect)
RS.coords = np.array([0, 0, ny-1, nx-1]) # image and plot reverse axes
pyplot.show()
RS.coords = RS.coords.astype(int)
RS.dims = np.array([RS.coords[2]-RS.coords[0], RS.coords[3]-RS.coords[1]])
# generate signal wave
Ipxtimeseries = np.reshape(image4d[:, :, 0, :], (nx*ny, nt))
I = Ipxtimeseries[:, timepts]
mI = np.mean(I, axis=1)
sI = np.std(I, axis=1)
# generate reference wave
REFimg = image4d[RS.coords[0]:RS.coords[2], RS.coords[1]:RS.coords[3], 0, :]
REFpxtimeseries = np.reshape(REFimg, (RS.dims[0]*RS.dims[1], nt))
# REF = np.percentile(REFpxtimeseries[:,timepts], 90, axis=0)
REF = np.mean(REFpxtimeseries[:, timepts], axis=0)
mREF = np.mean(REF, axis=0)
sREF = np.std(REF, axis=0)