def plot_scalp(densities, sensors, sensor_locs=None, plot_sensors=True, plot_contour=True, cmap=None, clim=None, smark='k.', linewidth=2, fontsize=8): if sensor_locs is None: sensor_locs = positions.POS_10_5 if cmap is None: cmap = plt.get_cmap('RdBu_r') # add densities if clim is None: cmax = np.max(np.abs(densities)) clim = [-cmax, cmax] locs = [positions.project_scalp(*sensor_locs[lab]) for lab in sensors] add_density(densities, locs, cmap=cmap, clim=clim, plot_contour=plot_contour) # setup plot MARGIN = 1.2 plt.xlim(-MARGIN, MARGIN) plt.ylim(-MARGIN, MARGIN) plt.box(False) ax = plt.gca() ax.set_aspect(1.2) ax.yaxis.set_ticks([],[]) ax.xaxis.set_ticks([],[]) # add details add_head(linewidth) if plot_sensors: add_sensors(sensors, locs, smark, fontsize)
def generate_erp(time, channels, time_loc, time_scale, space_loc, space_scale, amp_scale): ''' Generate an ERP ''' data = np.empty((len(channels), len(time))) time_pdf = norm(loc=time_loc, scale=time_scale).pdf space_x_pdf = norm(loc=space_loc[0], scale=space_scale).pdf space_y_pdf = norm(loc=space_loc[1], scale=space_scale).pdf locs = np.array([positions.project_scalp(*positions.POS_10_5[lab]) for lab in channels]) data = (space_x_pdf(locs[:,0]) * space_y_pdf(locs[:,1]))[:, np.newaxis].dot(time_pdf(time)[np.newaxis,:]) data /= np.max(data) * amp_scale return data
def plot_scalp(densities, sensors, sensor_locs=positions.POS_10_5, plot_sensors=True, cmap=plt.cm.jet, clim=None): # add densities if clim == None: clim = [np.min(densities), np.max(densities)] locs = [positions.project_scalp(*sensor_locs[lab]) for lab in sensors] add_density(densities, locs, cmap=cmap, clim=clim) # setup plot MARGIN = 1.2 plt.xlim(-MARGIN, MARGIN) plt.ylim(-MARGIN, MARGIN) plt.box(False) ax = plt.gca() ax.set_aspect(1.2) ax.yaxis.set_ticks([],[]) ax.xaxis.set_ticks([],[]) # add details add_head() if plot_sensors: add_sensors(sensors, locs)