def load_params(simID, path): """ Load saved simulation parameters Parameters ---------- simID : string simulation ID path : string the base directory Returns -------- all information about the given simulation: class instance """ from utils.utils import update_path params = pickle.load(open(path + '/Log/metadata_' + simID + '.pkl', "rb")) params.data_dir = update_path(path, params.data_dir) params.data_dir = "/".join(params.data_dir.split(os.sep)[:9]) + '/' params.path = update_path(path, params.path) return params
def __init__(self, simID, nn=0, effect=None, cond='30'): self.simID = simID self.params = pickle.load( open(path + '/Log/metadata_' + simID + '.pkl', "rb")) self.params.data_dir = update_path(path, self.params.data_dir) self.params.path = update_path(path, self.params.path) self.nn = nn self.cond = cond if effect: self.params.effect = effect
#fig=[plt.subplots(1,1) for i in range(len(params.noise))] IDs = ['10-13_15:40:44', '10-13_15:40:51'] #IDs=['10-13_18:13:22','10-13_18:13:14','10-13_18:41:30','10-13_19:23:53'] #labels=['Related lures','Unrelated lures'] labels = ['1', '2', '3', '4'] colors = ['r', 'g', 'b', 'orange'] markers = ['-', '-', '-', '-'] #fits=['Rn:0','Rn:0','Rn:0','Rn:0'] fits = ['Full', 'Rn:0', 'Full', 'Full'] fig, ax = plt.subplots(1, 1) m = -1 o = 0 nn = 0 for index, simID in enumerate(IDs): params = pickle.load(open(path1 + '/Log/metadata_' + simID + '.pkl', "rb")) params.data_dir = update_path(path1, params.data_dir) params.data_dir = "/".join(params.data_dir.split(os.sep)[:9]) + '/' params.path = update_path(path1, params.path) mat = matlab(params) data, conds = mat.load_dpsd(fit=fits[index]) ax.plot(data[o][m]['fa'][0][nn], data[o][m]['hits'][0][nn], 'o', color=colors[index], alpha=0.6) # ax.plot(data[o][0]['fa'][nn][0],data[o][0]['hits'][nn][0],'ro') ax.plot(data[o][m]['roc_fa'][m][:, nn], data[o][m]['roc_hit'][0][:, nn], 'b', color=colors[index], linestyle=markers[index],
import numpy as np import matplotlib.pyplot as plt #path=os.path.abspath(os.path.join(os.getcwd(), os.pardir)) #sys.path.insert(0,path) path = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) os.chdir(path) path1 = os.path.abspath(os.path.join(path, os.pardir)) m = -1 # which hippocampal system to access from utils import utils from utils.utils import update_path from analysis.plot_utils import set_aspect simID = '07-05_17:39:39' params = pickle.load(open(path1 + '/Log/metadata_' + simID + '.pkl', "rb")) params.data_dir = update_path(path1, params.data_dir, separator='Data') params.data_dir = "/".join(params.data_dir.split(os.sep)[:9]) + '/' params.path = update_path(path1, params.path) # don't change these o = params.offset[-1] # offset level to access n = params.noise[0] # noise level to access data_weak = [ pd.read_pickle(params.data_dir + 'weak/' + str(params.N_t) + '-' + str(params.pat_sep[ii]) + '.pkl') for ii in [0, m] ] data_strong = [ pd.read_pickle(params.data_dir + 'strong/' + str(params.N_t) + '-' + str(params.pat_sep[ii]) + '.pkl') for ii in [0, m] ]