# -*- coding: utf-8 -*- """ Created on Mon Sep 17 12:43:05 2018 @author: svc_ccg """ import fileIO import pandas as pd import cv2 import os import numpy as np imageDictPickleFile = fileIO.getFile() imageDict = pd.read_pickle(imageDictPickleFile) saveDir = fileIO.getDir() downSampleFactor = 9 for image in imageDict: im = imageDict[image][image] im_thumb = cv2.resize(im, tuple(np.array(im.shape)[::-1] / downSampleFactor), interpolation=cv2.INTER_AREA) cv2.imwrite(os.path.join(saveDir, image + ".jpg"), im) cv2.imwrite(os.path.join(saveDir, image + "_thumbnail.jpg"), im_thumb)
# -*- coding: utf-8 -*- """ Created on Mon Aug 12 12:36:41 2019 @author: svc_ccg """ """ Script that plots the performance of individual mice over time. For the position task, Produces 2 separate plots: 1 includes percent correct by side and no-gos. The other has no response trials and the direction turned for no-go trials. For the orientation task, returns a single plot with all information (no no-go trials) """ import h5py import fileIO import numpy as np from performanceData import performance_data f = fileIO.getFile(rootDir=r'\\allen\programs\braintv\workgroups\nc-ophys\corbettb\Masking') d = h5py.File(f) performance_data(mouse='477210', ignoreRepeats=True)
#ymin = rawData[channelsToPlot,samplesToPlot].min() #ymax = rawData[channelsToPlot,samplesToPlot].max() #for i,ch in enumerate(channelsToPlot): # ax = fig.add_subplot(len(channelsToPlot),1,i+1) # ax.plot(rawData[ch,samplesToPlot],'k') # for side in ('right','top'): # ax.spines[side].set_visible(False) # ax.set_ylim([ymin,ymax]) # ax.set_ylabel('uV') # if i==len(channelsToPlot)-1: # ax.set_xlabel('Sample') # ax.set_title('ch '+str(ch)) #plt.tight_layout() # sync data syncFile = fileIO.getFile('select sync file') syncDataset = sync.Dataset(syncFile) probeEventsDir = os.path.join( os.path.join(probeDataDir, 'events', 'Neuropix-PXI-' + pxiDict[probeLabel]), 'TTL_1') # get barcodes from sync file bRising, bFalling = get_sync_line_data(syncDataset, 'barcode') bs_t, bs = ecephys.extract_barcodes_from_times(bRising, bFalling) # get barcodes from ephys data channel_states = np.load(os.path.join(probeEventsDir, 'channel_states.npy')) event_times = np.load(os.path.join(probeEventsDir, 'event_timestamps.npy')) beRising = event_times[channel_states > 0] / 30000.