def getPulseStats(self): """ Returns a dictionary with combinations of pulse parameters, formatted as (<Pulse Duration>, <Pulse Interval>), as keys and corresponding lists of trial names as values. Trial names are formatted as "TrialX" where X is the trial number of the associated pulse parameter combination. :return: dict """ tempDF = pd.DataFrame() if 'PulseStimulii' in self.nixFile.sections[ 'VibrationStimulii-Processed'].sections: pulseParSecNames = {} for sec in self.nixFile.sections[ 'VibrationStimulii-Processed'].sections[ 'PulseStimulii'].sections: pulsePars = getSecPulsePars(sec) for s in sec.sections: tempS = pd.Series() tempS['Pulse Duration (ms)'] = pulsePars[0] tempS['Pulse Interval (ms)'] = pulsePars[1] tempS['Trial Label'] = s.name tempS['Frequency (Hz)'] = pulsePars[2] tempS['Number of Pulse Repetitions'] = \ float(property2qu(s.props['NumberOfPulseRepetitions']).magnitude) tStart = property2qu(s.props["StimulusStart"])[0] tStart.unit = qu.s tempS['Time of Start of Pulse train (s)'] = simpleFloat( tStart) tempDF = tempDF.append(tempS, ignore_index=True) return tempDF
sinInput = blk.data_arrays["Input Vibration Signal"] joSpikesMT = blk.multi_tags["JO Spikes"] dlint1MemVAS = dataArray2AnalogSignal(dlint1MemV) isynEASDLInt1 = dataArray2AnalogSignal(isynEDLInt1) isynIASDLInt1 = dataArray2AnalogSignal(isynIDLInt1) dlint2MemVAS = dataArray2AnalogSignal(dlint2MemV) isynEASDLInt2 = dataArray2AnalogSignal(isynEDLInt2) isynIASDLInt2 = dataArray2AnalogSignal(isynIDLInt2) sinInputAS = dataArray2AnalogSignal(sinInput) dlint1SpikesST = multiTag2SpikeTrain(dlint1SpikesMT, sinInputAS.t_start, sinInputAS.t_stop) dlint2SpikesST = multiTag2SpikeTrain(dlint2SpikesMT, sinInputAS.t_start, sinInputAS.t_stop) joSpikesST = multiTag2SpikeTrain(joSpikesMT, sinInputAS.t_start, sinInputAS.t_stop) fig1, ax1 = plt.subplots(nrows=2, ncols=2, figsize=(14, 11.2), sharex='col') ax1[0, 0].plot(simpleFloat(dlint1MemVAS.times / qu.ms), simpleFloat(dlint1MemVAS / qu.mV), 'b-') markerline, stemlines, baseline \ = ax1[0, 0].stem(simpleFloat(joSpikesST.times / qu.ms), [dlint1MemVAS.magnitude.min()] * joSpikesST.shape[0], linefmt='r-.', markerfmt='None', basefmt='None', bottom=-52.5) plt.setp(stemlines, color=(0.5, 0.5, 0.5), lw=2) markerline, stemlines, baseline \ = ax1[0, 0].stem(simpleFloat(joSpikesST.times / qu.ms), [10] * joSpikesST.shape[0], linefmt='r-.', markerfmt='None', basefmt='None', bottom=dlint1MemVAS.magnitude.max()) plt.setp(stemlines, color=(0.5, 0.5, 0.5), lw=2) ax1[0, 0].plot(simpleFloat(sinInputAS.times / qu.ms),
dlint2SpikesST = multiTag2SpikeTrain(dlint2SpikesMT, sinInputAS.t_start, sinInputAS.t_stop) joSpikesST = multiTag2SpikeTrain(joSpikesMT, sinInputAS.t_start, sinInputAS.t_stop) nixFileWithout = nixio.File.open(OPNixFileWithout, nixio.FileMode.ReadOnly) blkWithout = nixFileWithout.blocks["Simulation Traces"] dlint2MemVWithout = blkWithout.data_arrays["DLInt2 MemV"] dlint2SpikesMTWithout = blkWithout.multi_tags["DLInt2 Spikes"] dlint2MemVASWithout = dataArray2AnalogSignal(dlint2MemVWithout) dlint2SpikesSTWithout = multiTag2SpikeTrain(dlint2SpikesMTWithout, sinInputAS.t_start, sinInputAS.t_stop) rowInd = pulseDurs.index(pulseDur) colInd = pulseInts.index(pulseInt) axs1[rowInd, colInd].plot(simpleFloat(dlint1MemVAS.times / qu.ms), simpleFloat(dlint1MemVAS / qu.mV), 'b-', lw=1) # mew needs setting for seaborn. https://github.com/mwaskom/seaborn/issues/644 axs1[rowInd, colInd].plot(simpleFloat(dlint1SpikesST.times / qu.ms), [4] * dlint1SpikesST.shape[0], 'b|', ms=8, mew=1) axs1[rowInd, colInd].plot(simpleFloat(sinInputAS.times / qu.ms), simpleFloat(-50 + (sinInputAS * 5) / qu.um) , 'k-', lw=1) axs1[rowInd, colInd].set_xlim([(simSettleTime - showBefore) / units.ms, (totalSimDur + showAfter) / units.ms]) axs2[rowInd, colInd].plot(simpleFloat(dlint2MemVAS.times / qu.ms), simpleFloat(dlint2MemVAS / qu.mV), 'b-', lw=1) axs2[rowInd, colInd].plot(simpleFloat(dlint2MemVASWithout.times / qu.ms),
dlint1SpikesST = multiTag2SpikeTrain(dlint1SpikesMT, sinInputAS.t_start, sinInputAS.t_stop) dlint2SpikesST = multiTag2SpikeTrain(dlint2SpikesMT, sinInputAS.t_start, sinInputAS.t_stop) joSpikesST = multiTag2SpikeTrain(joSpikesMT, sinInputAS.t_start, sinInputAS.t_stop) # fig0, ax0 = plt.subplots(figsize=(2.5, 1.5)) # fig1, ax1 = plt.subplots(figsize=(2.5, 1.5)) # fig2, ax2 = plt.subplots(figsize=(2.5, 1.75)) # fig0, ax0 = plt.subplots(figsize=(2.85, 1.5)) fig1, ax1 = plt.subplots(figsize=(2.85, 1.5)) fig2, ax2 = plt.subplots(figsize=(2.85, 1.75)) ax0.plot(simpleFloat((dlint1MemVAS.times - simSettleTimeQu) / qu.ms), simpleFloat(dlint1MemVAS / qu.mV), 'k-', lw=0.4) ax1.plot(simpleFloat((dlint2MemVAS.times - simSettleTimeQu) / qu.ms), simpleFloat(dlint2MemVAS / qu.mV), 'k-', lw=0.4) ax2.plot(simpleFloat((sinInputAS.times - simSettleTimeQu) / qu.ms), simpleFloat(sinInputAS / qu.um), 'k-', lw=0.4) for ax in [ax0, ax1, ax2]: ax.set_xlim([(-showBefore) / units.ms, (simDuration + showAfter) / units.ms])
dlint2MemV = blk.data_arrays["DLInt2 MemV"] dlint2SpikesMT = blk.multi_tags["DLInt2 Spikes"] sinInput = blk.data_arrays["Input Vibration Signal"] joSpikesMT = blk.multi_tags["JO Spikes"] dlint1MemVAS = dataArray2AnalogSignal(dlint1MemV) dlint2MemVAS = dataArray2AnalogSignal(dlint2MemV) sinInputAS = dataArray2AnalogSignal(sinInput) dlint1SpikesST = multiTag2SpikeTrain(dlint1SpikesMT, sinInputAS.t_start, sinInputAS.t_stop) dlint2SpikesST = multiTag2SpikeTrain(dlint2SpikesMT, sinInputAS.t_start, sinInputAS.t_stop) joSpikesST = multiTag2SpikeTrain(joSpikesMT, sinInputAS.t_start, sinInputAS.t_stop) axs[0, ipInd].plot(simpleFloat(dlint1MemVAS.times / qu.ms), simpleFloat(dlint1MemVAS / qu.mV), 'b-') # mew needs setting for seaborn. https://github.com/mwaskom/seaborn/issues/644 axs[0, ipInd].plot(simpleFloat(dlint1SpikesST.times / qu.ms), [4] * dlint1SpikesST.shape[0], 'b|', ms=8, mew=1) markerline, stemlines, baseline \ = axs[0, ipInd].stem(simpleFloat(joSpikesST.times / qu.ms), [-40] * joSpikesST.shape[0], linefmt='r-.', markerfmt='None', basefmt='None', bottom=-60) plt.setp(stemlines, color=(0.5, 0.5, 0.5), lw=2) axs[0, ipInd].plot( simpleFloat(sinInputAS.times / qu.ms),