def load_single_traces_experiments_from_list(cells, verbose=True): """ Load experiments where traces have been added separately. Params: - cells: List with cell names or dictionairy where the keys are the cell names. See also: load_merged_traces_experiments_from_list() """ if type(cells) is dict: cell_names = list(cells.keys()) else: cell_names = cells expms = [] for i in range(len(cell_names)): current_expm_name = 'Experiment_Cell_' + cell_names[i] + '_single_traces.pkl' current_expm_path = os.path.join(EXPM_PATH, current_expm_name) try: current_expm = Experiment.load(current_expm_path, verbose=verbose) expms.append(current_expm) except: pass if not len(expms) == 0: return expms else: return None
def load_merged_traces_experiments_from_list(cells, verbose=True): """ Load experiments where IDRest traces have been merged. This function will try to load an experiment with merged IDRest traces for all cells in the list and just skip the ones for which it is not found. If no experiments were found, None is returned. Params: - cells: List with cell names or dictionairy where the keys are the cell names. See also: load_single_traces_experiments_from_list() """ if type(cells) is dict: cell_names = list(cells.keys()) else: cell_names = cells expms = [] for i in range(len(cell_names)): current_expm_name = 'Experiment_Cell_' + cell_names[i] + '_merged_idrest_traces.pkl' current_expm_path = os.path.join(EXPM_PATH, current_expm_name) try: current_expm = Experiment.load(current_expm_path, verbose=verbose) expms.append(current_expm) except: pass if not len(expms) == 0: return expms else: return None
from LIF import LIF def open_filterd_list(filtername): with open('/home/andrej/Dropbox/Arbeit/MKP/gif_fitting/BlueBrain/' + filtername + '_infos.pkl', 'rb') as f: filtered_list = pickle.load(f) return filtered_list soms = open_filterd_list('som_animals') vips = open_filterd_list('vip_animals') pvs = open_filterd_list('pv_animals') cell_names = list(vips.keys()) expms = [] for i in range(len(vips)): current_expm_name = 'Experiment_Cell_' + cell_names[i] + '_merged_idrest_traces.pkl' current_expm_path = os.path.join(expm_path,current_expm_name) try: current_expm = Experiment.load(current_expm_path) expms.append(current_expm) except: pass my_expm = expms[0] mylif = LIF(my_expm.dt) mylif.Tref = 4.0 my_expm.detectSpikes_cython() mylif.fitVoltageReset(my_expm,4.0) tr = my_expm.trainingset_traces[0]