''' List of all isolated units from adap015, with cluster quality added. Lan Guo 2016-03-25 ''' #using CellDatabase that contains laserSession for evaluating laser responsiveness from jaratoolbox.test.lan.Ephys import celldatabase_quality_vlan as celldatabase reload(celldatabase) eSession = celldatabase.EphysSessionInfo # Shorter name to simplify code cellDB = celldatabase.CellDatabase() oneES = eSession(animalName='adap015', ephysSession='2016-02-04_15-41-31', clustersEachTetrode={ 1: range(1, 13), 2: range(1, 13), 3: range(1, 13), 4: range(1, 13), 5: range(1, 13), 6: range(1, 13), 7: range(1, 13), 8: range(1, 13) }, behavSession='20160204a', clusterQuality={ 1: [3, 4, 2, 4, 4, 3, 3, 2, 1, 4, 4, 4], 2: [3, 1, 3, 2, 1, 2, 6, 2, 6, 6, 2, 0], 3: [3, 1, 1, 1, 4, 1, 1, 1, 3, 0, 0, 0], 4: [3, 2, 2, 1, 1, 2, 4, 4, 1, 1, 1, 0],
countTimeRange = [float(sys.argv[2]),float(sys.argv[3])] #second and third argument are numbers specify the start and end of countTimeRange in seconds, e.g. 0 0.1 subjectList = sys.argv[4:] #the fourth argument onwards are the mouse names to tell the script which allcells file to use for subject in subjectList: allcellsFileName = 'allcells_'+subject sys.path.append(settings.ALLCELLS_PATH) allcells = importlib.import_module(allcellsFileName) numOfCells = len(allcells.cellDB) #number of cells that were clustered on all sessions clustered outputDir = '/home/languo/data/ephys/'+subject+'/' CellInfo = celldatabase.CellInfo #This is for creating subdatabase for responsive and modulated cells responsiveCellDB = celldatabase.CellDatabase() modulatedCellDB = celldatabase.CellDatabase() allCellDB= celldatabase.CellDatabase() ###################Choose alignment and time window to plot mod Index histogram####################### processedDir = os.path.join(outputDir,subject+'_stats') #alignment = 'side-in'#put here alignment choice!!choices are 'sound', 'center-out', 'side-in'. #countTimeRange = [-0.1,0] window = str(countTimeRange[0])+'to'+str(countTimeRange[1])+'sec_window_' nameOfmodSFile = 'modSig_'+alignment+'_'+window+subject+'.txt' nameOfmodIFile = 'modIndex_'+alignment+'_'+window+subject+'.txt' modIFilename = os.path.join(processedDir,nameOfmodIFile) modSFilename = os.path.join(processedDir,nameOfmodSFile) #############################################################################
checkLaserResponse = 0 ####################################################################### for subject in subjectList: allcellsFileName = 'allcells_' + subject sys.path.append(settings.ALLCELLS_PATH) allcells = importlib.import_module(allcellsFileName) numOfCells = len( allcells.cellDB ) #number of cells that were clustered on all sessions clustered print numOfCells fullOutputDir = '/home/languo/data/ephys/' + subject + '/' + subject + '_stats' allCellDB = allcells.cellDB modulatedCellDB = celldatabase.CellDatabase() if checkLaserResponse: sigModFilename = 'sigMod_' + alignment + '_' + window + 'ISIchecked_laserResponsive' else: sigModFilename = 'sigMod_' + alignment + '_' + window + 'ISIchecked' try: sigModI_file = open('%s/%s.txt' % (fullOutputDir, sigModFilename), 'r') for line in sigModI_file: cellID = int(line.split(':')[1].split()[0]) modulatedCellDB.append(allCellDB[cellID]) sigModI_file.close() except: print sigModFilename + ' does not exist.' continue
countTimeRange = [float(sys.argv[2]),int(sys.argv[3])] else: countTimeRange = [float(sys.argv[2]),float(sys.argv[3])] for subject in subjectList: allcellsFileName = 'allcells_'+subject sys.path.append(settings.ALLCELLS_PATH) allcells = importlib.import_module(allcellsFileName) numOfCells = len(allcells.cellDB) #number of cells that were clustered on all sessions clustered outputDir = '/home/languo/data/ephys/'+subject+'/' CellInfo = celldatabase.CellInfo #This is for creating subdatabase for responsive and modulated cells responsiveCellDB = celldatabase.CellDatabase() soundnlaserResponsiveCellDB = celldatabase.CellDatabase() modulatedCellDB = celldatabase.CellDatabase() laserResponsiveCellDB = celldatabase.CellDatabase() allCellDB= celldatabase.CellDatabase() ###################Choose alignment and time window to plot mod Index histogram.Also decide whether to check laser response########### processedDir = os.path.join(outputDir,subject+'_stats') #lignment = 'sound' #put here alignment choice!!choices are 'sound', 'center-out', 'side-in'. #ountTimeRange = [0,0.15] window = str(countTimeRange[0])+'to'+str(countTimeRange[1])+'sec_window_' checkLaserResponse=1 ####Whether to check laser response ########################################################################
sys.path.append(settings.ALLCELLS_PATH) allcells = importlib.import_module(allcellsFileName) numOfCells = len( allcells.cellDB ) #number of cells that were clustered on all sessions clustered outputDir = '/home/languo/data/ephys/' + subject + '/' #binWidth = 0.020 # Size of each bin in histogram in seconds clusNum = 12 #Number of clusters that Klustakwik speparated into numTetrodes = 8 #Number of tetrodes #CellInfo = celldatabase.CellInfo LaserResponsiveCellDB = celldatabase.CellDatabase() ################################################################################################ ##############################-----Minimum Requirements------################################### ################################################################################################ qualityList = [1, 6] minZVal = 2.0 #maxISIviolation = 0.02 minPValue = 0.05 ################################################################################################ ################################################################################################ subject = allcells.cellDB[0].animalName behavSession = '' processedDir = os.path.join(outputDir, subject + '_stats') maxZLaserFilename = os.path.join(processedDir,
sys.path.append(settings.ALLCELLS_PATH) allcells = importlib.import_module(allcellsFileName) numOfCells = len( allcells.cellDB ) #number of cells that were clustered on all sessions clustered outputDir = '/home/languo/data/ephys/' + subject + '/' binWidth = 0.020 # Size of each bin in histogram in seconds clusNum = 12 #Number of clusters that Klustakwik speparated into numTetrodes = 8 #Number of tetrodes CellInfo = celldatabase.CellInfo #This is for creating subdatabase for responsive and modulated cells soundResponsiveCellDB = celldatabase.CellDatabase() laserResponsiveCellDB = celldatabase.CellDatabase() modulatedCellDB = celldatabase.CellDatabase() modulatedCellDB_laser = celldatabase.CellDatabase() ################################################################################################ ##############################-----Minimum Requirements------################################### ################################################################################################ qualityList = [1, 6] #[1,4,5,6,7]#range(1,10) minZVal = 3.0 #maxISIviolation = 0.02 minPValue = 0.05 ################################################################################################ ################################################################################################ subject = allcells.cellDB[0].animalName behavSession = ''