print str(dirname) + '\n' #get neuralynx main clock start time MAIN_NLX_CLOCK_START = rateMapUtils.getNeuralynxStartTime(CHEETAH_LOG_FILE_NAME) MAIN_NLX_CLOCK_START = datetime.strptime(MAIN_NLX_CLOCK_START,'%H:%M:%S.%f').time() #convert the main clock start time to timedelta object MAIN_NLX_CLOCK_START = timedelta(hours=MAIN_NLX_CLOCK_START .hour, minutes=MAIN_NLX_CLOCK_START .minute, seconds=MAIN_NLX_CLOCK_START .second, microseconds=MAIN_NLX_CLOCK_START .microsecond) print 'Neuralynx Start Time: ' + str(MAIN_NLX_CLOCK_START) + '\n' #get start acquisition time for cheetah log file START_ACQ_NTP_TIME, START_ACQ_SXBOX_TIME = rateMapUtils.getNeuralynxStartAcqTime(CHEETAH_LOG_FILE_NAME) print 'Neuralynx Start Acquisition Time acc to NTP Server: ' + str(START_ACQ_NTP_TIME) print 'Neuralynx Start Acquisition Time acc to SX Box: ' + str(START_ACQ_SXBOX_TIME) + '\n' #check if already processed data exists in directory processedDataExists = rateMapUtils.checkIfProcessedDataExists(os.getcwd(), NlxFlag=True) #if processed data exists, use that for rate map generation if processedDataExists: for filename in os.listdir(os.getcwd()): if filename.startswith('Day') and 'ProcessedData' in filename and 'nlx' in filename and filename.endswith('.mat'): currentDir = os.getcwd() #load the picamera posx, posxy, timestamps, spiketime, spikeposx, spikeposy processedData = sio.loadmat(filename) #get the picamera data in one dictionary nlxData = {} nlxData['pos_x'] = list(processedData['nlx_posX'][0]) nlxData['pos_y'] = list(processedData['nlx_posY'][0]) nlxData['pos_t'] = list(processedData['nlx_time'][0])
MAIN_NLX_CLOCK_START = datetime.strptime(MAIN_NLX_CLOCK_START,'%H:%M:%S.%f').time() #convert the main clock start time to timedelta object MAIN_NLX_CLOCK_START = timedelta(hours=MAIN_NLX_CLOCK_START .hour, minutes=MAIN_NLX_CLOCK_START .minute, seconds=MAIN_NLX_CLOCK_START .second, microseconds=MAIN_NLX_CLOCK_START .microsecond) print 'Neuralynx Start Time: ' + str(MAIN_NLX_CLOCK_START) + '\n' #get start acquisition time for cheetah log file START_ACQ_NTP_TIME, START_ACQ_SXBOX_TIME = rateMapUtils.getNeuralynxStartAcqTime(CHEETAH_LOG_FILE_NAME) print 'Neuralynx Start Acquisition Time acc to NTP Server: ' + str(START_ACQ_NTP_TIME) print 'Neuralynx Start Acquisition Time acc to SX Box: ' + str(START_ACQ_SXBOX_TIME) + '\n' #load nlx time drifts slope, nlx sx times, ntp time, picamera clock drift, picamera clock time, picamera ntp time nlxDriftSlope, nlxNTPTime, nlxLynxSXTime, picamDriftSlope, picamNTPDateTime, picamClockTime = nlxandpicamTimestampDriftCalculation.calculateDriftSlopes(CHEETAH_LOG_FILE_NAME, START_ACQ_SXBOX_TIME, os.getcwd()) sio.savemat(dirname + '_nlxandpicamtimestamps.mat', mdict={'nlxDriftSlope': nlxDriftSlope, 'nlxNTPTime': nlxNTPTime, 'nlxLynxSXTime': nlxLynxSXTime, 'picamDriftSlope': picamDriftSlope, 'picamNTPDateTime': picamNTPDateTime, 'picamClockTime': picamClockTime}) #check if already processed data exists in directory processedDataExists = rateMapUtils.checkIfProcessedDataExists(os.getcwd(), False) #if processed data exists, use that for rate map generation if processedDataExists: for filename in os.listdir(os.getcwd()): if filename.startswith('Day') and 'ProcessedData' in filename and filename.endswith('.mat') and 'nlx' not in filename: currentDir = os.getcwd() #load the picamera posx, posxy, timestamps, spiketime, spikeposx, spikeposy processedData = sio.loadmat(filename) #get the picamera data in one dictionary piCameraData = {} piCameraData['pos_x'] = list(processedData['picam_posX'][0]) piCameraData['pos_y'] = list(processedData['picam_posY'][0]) piCameraData['pos_t'] = list(processedData['picam_time'][0])