def plot(self, interp='nearest', normed=True, title='RevCorrWindow', scale=2.0): """Plots the RFs as bitmaps in a window. normed = 'global'|True|False""" rfs = [] # list of receptive fields to pass to ReceptiveFieldFrame object if normed == 'global': # normalize across all timepoints for all neurons vmin = min([ sta.rf.min() for sta in self.stas ]) # global min vmax = max([ sta.rf.max() for sta in self.stas ]) # global max for ni, sta in enumerate(self.stas): # create a copy to manipulate for display purposes, (nt, width, height): rf = sta.rf.copy() if normed: # either 'global' or True if normed == True: # normalize across the timepoints for this Neuron vmin, vmax = rf.min(), rf.max() norm = mpl.colors.normalize(vmin=vmin, vmax=vmax, clip=True) rf = norm(rf) # normalize the rf the same way across all timepoints else: # don't normalize across timepoints, leave each one to autoscale for ti in range(self.nt): norm = mpl.colors.normalize(vmin=None, vmax=None, clip=True) rf[ti] = norm(rf[ti]) # normalize the rf separately at each timepoint rf *= 255 # scale up to 8 bit values rf = rf.round().astype(np.uint8) # downcast from float to uint8 rfs.append(rf) nids = [ neuron.id for neuron in self.neurons ] win = RevCorrWindow(title=title, rfs=rfs, nids=nids, ts=self.ts, scale=scale) win.show() return win # necessary in IPython
def plot(self, interp='nearest', normed=True, title='RevCorrWindow', scale=2.0): """Plots the spatiotemporal RF as bitmaps in a wx.Frame""" # create a copy to manipulate for display purposes, (nt, width, height): rf = self.rf.copy() if normed: # normalize across the timepoints for this RevCorr norm = mpl.colors.normalize(vmin=rf.min(), vmax=rf.max(), clip=True) rf = norm(rf) # normalize the rf the same way across all timepoints else: # don't normalize across timepoints, leave each one to autoscale for ti in range(self.nt): norm = mpl.colors.normalize(vmin=None, vmax=None, clip=True) rf[ti] = norm(rf[ti]) # normalize the rf separately at each timepoint rf *= 255 # scale up to 8 bit values rf = rf.round().astype(np.uint8) # downcast from float to uint8 win = RevCorrWindow(title=title, rfs=[rf], nids=[self.neuron.id], ts=self.ts, scale=scale) win.show() return win # necessary in IPython
def plot(self, normed=True, title='RevCorrWindow', scale=2.0): """Plot the spatiotemporal RF as bitmaps in a custom (non MPL) Qt window""" # create a copy to manipulate for display purposes, (nt, width, height): rf = self.rf.copy() if normed: # normalize across the timepoints for this RevCorr norm = mpl.colors.normalize(vmin=rf.min(), vmax=rf.max(), clip=True) rf = norm( rf) # normalize the rf the same way across all timepoints else: # don't normalize across timepoints, leave each one to autoscale for ti in range(self.nt): norm = mpl.colors.normalize(vmin=None, vmax=None, clip=True) rf[ti] = norm( rf[ti]) # normalize the rf separately at each timepoint rf *= 255 # scale up to 8 bit values rf = rf.round().astype(np.uint8) # downcast from float to uint8 win = RevCorrWindow(title=title, rfs=[rf], nids=[self.neuron.id], ts=self.ts, scale=scale) win.show() return win # necessary in IPython
def plot(self, normed=True, title='RevCorrWindow', scale=2.0, MPL=False, margins=True): """Plots the RFs as bitmaps in a window. normed = True|False|'global' MPL = True|False|'axes'""" rfs = [ ] # list of receptive fields to pass to ReceptiveFieldFrame object if normed == 'global': # normalize across all timepoints for all neurons vmin = min([sta.rf.min() for sta in self.stas]) # global min vmax = max([sta.rf.max() for sta in self.stas]) # global max for sta in (self.stas): if sta is None: rf = None else: # create a copy to manipulate for display purposes, (nt, width, height): rf = sta.rf.copy() if normed: # either 'global' or True if normed == True: # normalize across the timepoints for this Neuron vmin, vmax = rf.min(), rf.max() norm = mpl.colors.Normalize(vmin=vmin, vmax=vmax, clip=True) rf = norm( rf ) # normalize the rf the same way across all timepoints else: # don't normalize across timepoints, leave each one to autoscale for ti in range(self.nt): norm = mpl.colors.Normalize(vmin=None, vmax=None, clip=True) rf[ti] = norm( rf[ti] ) # normalize the rf separately at each timepoint rf *= 255 # scale up to 8 bit values rf = rf.round().astype( np.uint8) # downcast from float to uint8 rfs.append(rf) if MPL == True: core.mplrevcorr(title=title, rfs=rfs, nids=self.nids, ts=self.ts, scale=scale, dpi=MPL, margins=margins) elif MPL == 'axes': core.mplrevcorraxes(title=title, rfs=rfs, nids=self.nids, ts=self.ts, scale=scale) else: win = RevCorrWindow(title=title, rfs=rfs, nids=self.nids, ts=self.ts, scale=scale) win.show() return win # necessary in IPython