Exemplo n.º 1
0
        'depth': 1275,
        'tetrode': 4,
        'cluster': 2
    }
]  #another AC cell

args = sys.argv[1:]
if len(args):
    cellsToGenerate = [int(x) for x in args]
else:
    cellsToGenerate = range(len(cellList))
print cellsToGenerate

for indCell in cellsToGenerate:
    # -- find the cell we want based on dictionary --
    cellInd, dbRow = celldatabase.find_cell(dbase, **cellList[indCell])
    cell = ephyscore.Cell(dbRow, useModifiedClusters=True)

    # --- loads spike and event data for frequency tuning ephys sessions ---
    tuningEphysData, tuningBData = cell.load('tuningCurve')
    tuningEventOnsetTimes = tuningEphysData['events']['soundDetectorOn']
    if len(tuningEventOnsetTimes
           ) == 0:  #some cells recorded before sound detector installed
        tuningEventOnsetTimes = tuningEphysData['events'][
            'stimOn'] + 0.0095  #correction for bandwidth trials, determined by comparing sound detector onset to stim event onset
    tuningEventOnsetTimes = spikesanalysis.minimum_event_onset_diff(
        tuningEventOnsetTimes, minEventOnsetDiff=0.2)
    tuningSpikeTimestamps = tuningEphysData['spikeTimes']

    freqEachTrial = tuningBData['currentFreq']
    numFreqs = np.unique(freqEachTrial)
Exemplo n.º 2
0
        'cluster': 5
    },  #suppressed cell in PV-ArchT mouse
    {
        'subject': 'band073',
        'date': '2018-09-14',
        'depth': 1300,
        'tetrode': 4,
        'cluster': 4
    }  #suppressed cell in SOM-ArchT mouse
]

cellTypes = ['PV', 'SOM']

for indCell, oneCell in enumerate(cellList):
    # -- find the cell we want based on dictionary --
    cellInd, dbRow = celldatabase.find_cell(db, **oneCell)
    cell = ephyscore.Cell(dbRow)

    bandEphysData, bandBData = cell.load_by_index(int(
        dbRow['bestBandSession']))
    bandEventOnsetTimes = bandEphysData['events']['soundDetectorOn']
    bandEventOnsetTimes = spikesanalysis.minimum_event_onset_diff(
        bandEventOnsetTimes, minEventOnsetDiff=0.2)
    bandSpikeTimestamps = bandEphysData['spikeTimes']

    bandEachTrial = bandBData['currentBand']
    numBands = np.unique(bandEachTrial)
    LaserEachTrial = bandBData['laserTrial']
    numLaser = np.unique(LaserEachTrial)

    bandTrialsEachCond = behavioranalysis.find_trials_each_combination(
Exemplo n.º 3
0
acExample = {
    'cluster': 5,
    'date': '2017-02-02',
    'depth': 1275.0,
    'subject': 'pinp015',
    'tetrode': 1
}

#This example is noisey and not as good
# acExample = {'cluster': 6,
#              'date': '2017-03-09',
#              'depth': 1904.0,
#              'subject': 'pinp016',
#              'tetrode': 6}

indRowThal, rowThal = celldatabase.find_cell(db, **thalExample)
indRowAC, rowAC = celldatabase.find_cell(db, **acExample)

## -- Plot colors -- ##
colorNoise = figparams.colp['sound']
colorLaser = figparams.colp['blueLaser']
colorPSTH = 'k'
colorRaster = 'k'
stimLineWidth = 4
psthLineWidth = 2
rasterMS = figparams.rasterMS

## -- Raster/PSTH parameters --##
stimLineOffsetFrac = 0.2
alignmentRange = [-0.2, 0.6]
displayRange = [-0.1, 0.3]
        'subject': 'band060',
        'date': '2018-04-04',
        'depth': 1225,
        'tetrode': 3,
        'cluster': 4
    }
]  #SOM cell

cellTypes = [
    'AC', 'AC', 'AC', 'AC', 'AC', 'PV', 'PV', 'PV', 'PV', 'SOM', 'SOM', 'SOM',
    'SOM'
]

for indCell, thisCell in enumerate(cellList):
    # -- find the cell we want based on dictionary --
    cellInd, dbRow = celldatabase.find_cell(db, **thisCell)
    cell = ephyscore.Cell(dbRow, useModifiedClusters=True)

    # --- loads spike and event data for laser pulse sessions ---
    laserEphysData, noBehav = cell.load('laserPulse')
    laserEventOnsetTimes = laserEphysData['events']['laserOn']
    laserSpikeTimestamps = laserEphysData['spikeTimes']
    timeRange = [-0.1, 0.3]

    laserSpikeTimesFromEventOnset, trialIndexForEachSpike, laserIndexLimitsEachTrial = spikesanalysis.eventlocked_spiketimes(
        laserSpikeTimestamps, laserEventOnsetTimes, timeRange)

    # --- loads waveform for this specific cell ---
    peaks = dbRow['spikePeakAmplitudes']
    normSpikeShape = np.array(dbRow['spikeShape'] / np.abs(peaks[1]))
cellsToTest = [
    'pinp017_2017-03-22_1338.0_TT3c4',
    'pinp017_2017-03-23_1604.0_TT2c6',
    'pinp017_2017-03-23_1518.0_TT8c2',
    'pinp016_2017-03-16_3707.0_TT2c6',
    'pinp015_2017-02-15_2902.0_TT8c4',
    'pinp016_2017-03-15_3797.0_TT1c3',
    'pinp026_2017-11-16_3256.0_TT6c3'
]

for cellName in cellsToTest:
    (subject, date, depth, tetrodeCluster) = cellName.split('_')
    depth = float(depth)
    tetrode = int(tetrodeCluster[2])
    cluster = int(tetrodeCluster[4:])
    indRow, dbRow = celldatabase.find_cell(db, subject, date, depth, tetrode, cluster)

    # indRow, dbRow = celldatabase.find_cell(db, **cellDict)
    cell = ephyscore.Cell(dbRow)

    ephysData, bdata = cell.load('tc')

    # eventOnsetTimes = ephysData['events']['soundDetectorOn']
    eventOnsetTimes = ephysData['events']['stimOn']

    eventOnsetTimes = spikesanalysis.minimum_event_onset_diff(eventOnsetTimes, minEventOnsetDiff=0.2)
    spikeTimes = ephysData['spikeTimes']
    freqEachTrial = bdata['currentFreq']
    possibleFreq = np.unique(freqEachTrial)
    intensityEachTrial = bdata['currentIntensity']
    possibleIntensity = np.unique(intensityEachTrial)
Exemplo n.º 6
0
                color=color)


labelPosX = [0.01, 0.23, 0.5, 0.775]  # Horiz position for panel labels
labelPosY = [0.94]  # Vert position for panel labels

plt.clf()

# Criterion 1: Responds to laser pulse

labelHeightFactor = 0.8

indCriterion = 0
for indExample in range(nExamples):

    indRow, dbRow = celldatabase.find_cell(database, **examples[indExample])
    cell = ephyscore.Cell(dbRow)

    ### -- Pre -- ###
    sessiontype = 'laserpulse_pre'
    axPSTH = plt.subplot(examplesAllCriteria[indCriterion][indExample][0])

    ephysData, bdata = cell.load(sessiontype)
    eventOnsetTimes = ephysData['events']['stimOn']
    eventOnsetTimes = spikesanalysis.minimum_event_onset_diff(
        eventOnsetTimes, minEventOnsetDiff=0.5)

    if not indCriterion == 2:
        timeRange = [-0.3, 1.0]
    else:
        timeRange = [-0.01, 0.05]
Exemplo n.º 7
0
dataframe = goodFitToUse

### -- Example plot -- ###

threshold = 0.2

cellDict = {
    'subject': 'pinp017',
    'date': '2017-03-22',
    'depth': 1143,
    'tetrode': 2,
    'cluster': 4
}

cellInd, dbRow = celldatabase.find_cell(dbase, **cellDict)
cell = ephyscore.Cell(dbRow)

try:
    ephysData, bdata = cell.load('tc')
except (IndexError, ValueError
        ):  #The cell does not have a tc or the tc session has no spikes
    print "No tc for cell {}".format(indRow)
    sys.exit()

eventOnsetTimes = ephysData['events']['soundDetectorOn']
eventOnsetTimes = spikesanalysis.minimum_event_onset_diff(
    eventOnsetTimes, minEventOnsetDiff=0.2)
spikeTimes = ephysData['spikeTimes']
freqEachTrial = bdata['currentFreq']
possibleFreq = np.unique(freqEachTrial)