import importlib import os import matplotlib.pyplot as plt import numpy as np import modules.classifier as classifier import aux from helpers import data_management as dm from analytics import analytics1 importlib.reload(classifier) importlib.reload(dm) importlib.reload(analytics1) aux.config_logging() params = aux.load_config() features_fname = params.file_handling.datafile_path + '/train_trials.pkl' # name of features array # fids = np.arange(51,63) # 22.5.19-24.5.19 ids of sessions, NOTE: this will change if sessions from the past are added # fids = np.arange(51,56) # 22.5.19 fids = np.array([60, 61, 62, 64, 65]) # 24.5.19 # fids = np.append(fids,[64,65]) psth_tot1 = np.empty((0,140, 128)) psth_tot2 = np.empty((0,140, 128)) for ii in range(fids.size): # stack psth from different sessions data_tot, tt, triggers, ch_rec_list, file_names = dm.get_raw(n_triggers=params.classifier.n_classes, fids=[fids[ii]]) clf = classifier.Classifier(params) clf.get_trials_kiap(data_tot[:, :], triggers, features_fname=features_fname) psth_tot1 = np.vstack((psth_tot1, clf.psth[0])) psth_tot2 = np.vstack((psth_tot2, clf.psth[1])) clf.psth[0] = psth_tot1 clf.psth[1] = psth_tot2 fig_name0 = os.path.basename(os.path.splitext(file_names[0])[0]) fig_name = params.file_handling.results+fig_name0 + '/' if not os.path.exists(fig_name): os.mkdir(fig_name) fig_name = fig_name + fig_name0 plt.close('all') plt.figure(1, figsize=[10 , 7]) for ii in range(128): analytics1.plot_psth2(clf,[ii],fig_name)