from os import path from session_directory import load_session_list import scipy.io as sio import numpy as np session_list = load_session_list() class seqNMF: def __init__(self, session_index, var_names=('H', 'W', 'XC', 'thres'), mat_file='seqNMF_results.mat'): self.session_index = session_index self.mouse = session_list[session_index]["Animal"] self.directory = session_list[session_index]["Location"] self.filename = path.join(self.directory, mat_file) self.data = self.load_data(var_names) self.count_sequences() self.sequence_cells = self.get_sequential_cells() self.order = self.get_sequence_order() def load_data(self, var_names): data = sio.loadmat(self.filename, variable_names=var_names) return data def count_sequences(self): try: self.n_sequences = np.sum(self.data['H'].any(axis=1))
n = np.empty n1 = 0 for row in pos2: print(row) pos3.append(row) n[n1,:] = row test = pd.read_csv(posfile,header=None) ax = test.T.plot(0,1,xlim = [20,130], ylim = [20,130]) ax.axis = 'off' fig, axes = plt.subplots(2,2) test.T.plot(0,1,xlim = [20,130], ylim = [20,130], ax = axes[0,1]) fig import skvideo.io vid = skvideo.io.vread(vidfile) fig, ax = plt.subplots(2,2) ax[0,0].imshow(vid[1]) ax[0,0].axis('off') test.T.plot(0,1,xlim = [20,130], ylim = [20,130], ax = ax[0,0],legend = False) fig import sys sys.path.append('C:\\Users\\Nat\\Documents\\BU\\Imaging\\Python\\FearReinstatement') sys.path.append('C:\\Users\\Nat\\Documents\\BU\\Imaging\\Python\\FearReinstatement\\Helpers') from session_directory import load_session_list from mouse_sessions import make_session_list as msl sd = msl('C:\\Users\\Nat\\Documents\\BU\\Imaging\\Working\\Eraser\\SessionDirectories') x = [1,2,3,4,5] x == 1 load_session_list('C:\\Users\\Nat\\Documents\\BU\\Imaging\\Working\\Eraser\\SessionDirectories')