def compute_stability(subj, fix_vertex=True, reg=0): data_len = np.hstack((np.r_[220:70:-20], 70)) # first, the complete pli pli, labels, bands, selected_voxels = ve.compute_all_labels_pli(subj, reg=reg) plis = [pli] # then compute it for the chopped data if not fix_vertex: selected_voxels = None for l in data_len: pli, labels, bands, junk = ve.compute_all_labels_pli(subj, tmax=l, reg=reg, selected_voxels=selected_voxels) plis.append(pli) return plis, labels
def compute_stability(subj, fix_vertex=True, reg=0): data_len = np.hstack((np.r_[220:70:-20], 70)) # first, the complete pli pli, labels, bands, selected_voxels = ve.compute_all_labels_pli(subj, reg=reg) plis = [pli] # then compute it for the chopped data if not fix_vertex: selected_voxels = None for l in data_len: pli, labels, bands, junk = ve.compute_all_labels_pli( subj, tmax=l, reg=reg, selected_voxels=selected_voxels) plis.append(pli) return plis, labels
ax.grid(False) ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) if cbar: cbar = fig.colorbar(mappable, ax=ax) # def plot_many_pli(): data_len = [.0001, .001, .01, .1, 1, 10, 100, 1000, 10000] band_names = ['delta', 'theta', 'alpha', 'beta', 'gamma'] subplot_inds = [2, 3, 4, 6, 7, 8, 10, 11, 12] subj = 'CVKRVURL' # first, the complete pli pli, labels, bands = ve.compute_all_labels_pli(subj) plis = [pli] # then compute it for the chopped data for l in data_len: pli, labels, bands = ve.compute_all_labels_pli(subj, reg=l) plis.append(pli) # now that we're done with the heavy computation, let's plot every band for plot_band, band_name in enumerate(band_names): fig = pl.figure() # figure out the color axis vmin = np.inf vmax = -np.inf
import virtual_electrode as ve import numpy as np import multiprocessing import env job_num = 6 #int(multiprocessing.cpu_count()) num_perms = 2 # Note that the voxels selected should stay the same because the pemrutation doesn't change the power, only the phase, but if we load it now we can speed it up later by forcing the voxels being chosen, and not having to do the power transform all the time res = np.load(env.results + 'selected_voxels_NV.npz') subj_voxels = res['subj_voxels'][()] for subj, voxels in subj_voxels.iteritems(): print '===================================' print '======= Subject ' + subj + ' =========' print '===================================' pli, labels, bands, junk = ve.compute_all_labels_pli(subj, rand_phase=num_perms, selected_voxels=voxels, job_num=job_num)