def print_model(self, topographies=False):
     print('ERP Model Parameters')
     print('====================')
     print('Number of generators: ' + str(self.n_gen) + '\n')
     print('Variability')
     print('-----------')
     if self.sigma_e == 0:
         print('* No electrode variance.')
     else:
         print('* Electrode variance: ' + str(self.sigma_e))
     print('* Generator covariance matrix:')
     print(self.cov_gen)
     #if self.n_gen > 1 and isinstance(self.sigma_g, list):
     #    print('* Individual generator variance.')
     #elif self.n_gen > 1:
     #    print('* Generator variance: ' + str(self.sigma_g))
     #if self.n_gen > 1 and isinstance(self.sigma_c, list):
     #    print('* Individual generator covariance.')
     #elif self.n_gen > 1:
     #    print('* Generator variance: ' + str(self.sigma_g))
     for gen in range(self.n_gen):
         print('Generator ' + str(gen+1))
         print('-------------------')
         print('LOCATION, Depth: ' + str(self.gen_conf[gen]['depth']))
         print('LOCATION, Theta: ' + str(self.gen_conf[gen]['theta']))
         print('LOCATION, Phi: ' + str(self.gen_conf[gen]['phi']))
         print('ORIENTATION: ' + str(self.gen_conf[gen]['orientation']))
         print('ORIENTATION, Phi: ' + str(self.gen_conf[gen]['orientation_phi']))
         print('MAGNITUDE: ' + str(self.gen_conf[gen]['magnitude']))
         if topographies:
             pyplot.figure()
             plot_topographic_map((self.gen_conf[gen]['magnitude'] *
                                   self.lf.calculate(
                                   [self.gen_conf[gen]]))[:,0])
Exemplo n.º 2
0
    def plot_model(self, to_plot):
        for one_plot in to_plot:
            if one_plot == "mean":
                plot_topographic_map(self.mean)
                pyplot.title("Topographic map of mean")

                # Individual generator means
                pyplot.figure()
                for i in range(self.n_gen):
                    pyplot.subplot(1, self.n_gen, i)
                    plot_topographic_map(self.mean)
                pyplot.figtext(0.5, 0.75, "Topographic maps of means of each generator", ha="center")

            if one_plot == "variance":
                pyplot.figure()
                plot_topographic_map(self.cov.diagonal())
                pyplot.title("Topographic map of variance")

                # Individual generator variances
                pyplot.figure()
                for i in range(self.n_gen):
                    pyplot.subplot(1, self.n_gen, i)
                    single_cov = dot(transpose(self.lead_field[:, i][newaxis]), self.lead_field[:, i][newaxis])
                    if self.variability_generators == "constant":
                        single_cov = self.sigma_g * single_cov
                    elif self.variability_generators == "individual":
                        single_cov = self.sigma_g[i] * single_cov
                    plot_topographic_map(single_cov.diagonal())
                pyplot.figtext(0.5, 0.75, "Topographic maps of variance of each generator", ha="center")

            if one_plot == "covariance matrix":
                pyplot.figure()
                plot_covariance_matrix(self.data, self.cov)
                pyplot.title("Covariance matrix")
Exemplo n.º 3
0
def plot_variability_visualization(data, to_plot='all'):
    if to_plot == 'all':
        to_plot = ['topography', 'variance topography', 'covariance matrix', 
                'variogram', 'unnormalized variogram', 'mean and variance']
    for next_plot in to_plot:
        pyplot.figure()
        if next_plot == 'topography':
            topographicmap.plot_topographic_map(mean(data,0))
            pyplot.title('Mean')
        elif next_plot == 'variance topography':
            topographicmap.plot_topographic_map(var(data,0))
            pyplot.title('Variance')
        elif next_plot == 'covariance matrix':
            plot_covariance_matrix(data)
        elif next_plot == 'variogram':
            plot_variogram(data, norm='normalized')
        elif next_plot == 'unnormalized variogram':
            plot_variogram(data, norm='unnormalized')
        elif next_plot == 'mean and variance':
            plot_mean_and_variance(data)
Exemplo n.º 4
0
 def print_model(self, topographies=False):
     print ("ERP Model Parameters")
     print ("====================")
     print ("Number of generators: " + str(self.n_gen) + "\n")
     print ("Variability")
     print ("-----------")
     print ("* Electrodes (self.sigma_e)")
     print self.sigma_e
     print ("* Generators (self.cov_gen)")
     print self.cov_gen
     print ("* Final covariance matrix (self.cov)")
     print self.cov
     for gen in range(self.n_gen):
         print ("\nGenerator " + str(gen + 1))
         print ("-------------------")
         print ("LOCATION, Depth: " + str(self.gen_conf[gen]["depth"]))
         print ("LOCATION, Theta: " + str(self.gen_conf[gen]["theta"]))
         print ("LOCATION, Phi: " + str(self.gen_conf[gen]["phi"]))
         print ("ORIENTATION: " + str(self.gen_conf[gen]["orientation"]))
         print ("ORIENTATION, Phi: " + str(self.gen_conf[gen]["orientation_phi"]))
         print ("MAGNITUDE: " + str(self.gen_conf[gen]["magnitude"]))
         if topographies:
             pyplot.figure()
             plot_topographic_map((self.gen_conf[gen]["magnitude"] * self.lf.calculate([self.gen_conf[gen]]))[:, 0])
Exemplo n.º 5
0
if parameters["todo_plot_grand_averages"]:
    print("Drawing grand averages for all imported data")
    figure()
    plot_ERP(ERP_avg["old"][0])


if parameters["todo_plot_simulated_noise"]:
    print("Running simulation to show topographic properties of noise")
    gen_conf = random_generator_configuration()
    [simulated_data, gen_conf, electrodes] = gen_simulation(
        gen_conf,
        num_sim=parameters["number_of_subjects"],
        gen_magnitude_stddev=parameters["generator_magnitude_stddev"],
    )
    figure()
    plot_topographic_map(mean(simulated_data, 0))
    # savefig('Results/' + timestamp + '/simulated_noise')
    savefig("Results/" + label + "/simulated_noise")


# Here we will be running the scaling experiments
# se <-- holds all simulation experiments, for all parameter combinations
se = {}

# All simulation experiment parameters we will be looping through
experiments = [1, 2, 3, 4]
configurations = ["random", "uandk"]
variabilities = ["scaling", "gen_amplitude", "gen_location"]
noise_types = ["normal_only", "constant_and_normal", "topographic_and_normal"]
references = ["none", "left_mastoid", "average_mastoid", "average"]
factors = ["hsl", "electrodes"]