manifest['Type'].append(cre_type) manifest['Connection'].append((expt.uid, pre, post)) manifest['amp'].append(avg_amp) manifest['latency'].append(psp_fits.best_values['xoffset'] - 10e-3) manifest['nrmse'].append(psp_fits.nrmse()) manifest['CV'].append(cv) manifest['decay'].append(psp_fits.best_values['decay_tau']) synapse_plot[c, 0].setTitle('First Pulse Response') if [expt.uid, pre, post] == all_connections[type]: trace_color = color + (30,) elif hold > -65: trace_color = (255, 0, 255, 30) else: trace_color = (0, 0, 0, 30) trace_plot(avg_trace, trace_color, plot=synapse_plot[c, 0], x_range=[0, 27e-3]) app.processEvents() # decay_response = response_filter(pulse_response, freq_range=[0, 20], holding_range=holding) # qc_list = pulse_qc(response_subset, baseline=2, pulse=None, plot=qc_plot) # if len(qc_list) >= sweep_threshold: # avg_trace, avg_amp, amp_sign, peak_t = get_amplitude(qc_list) # if amp_sign is '-': # continue # psp_fits = fit_psp(avg_trace, sign=amp_sign, yoffset=0, amp=avg_amp, method='leastsq', stacked = False, fit_kws={}) # grand_response[type[0]]['decay'].append(psp_fits.best_values['decay_tau']) if len(grand_response[type[0]]['trace']) == 0: continue if len(grand_response[type[0]]['trace']) > 1: grand_trace = TraceList(grand_response[type[0]]['trace']).mean() grand_trace.t0 = 0 else:
avg_trace, amp, amp_sign, _ = get_amplitude( pass_qc) if pre_type in EXCITATORY_CRE_TYPES and amp_sign is '-': continue elif pre_type in INHIBITORY_CRE_TYPES and amp_sign is '+': continue if key not in pulse_amp.keys(): pulse_amp[key] = [] pulse_amp[key].append(amp) avg_trace.t0 = 0 grand_pulse_response.append(avg_trace) if [expt.uid, pre, post] == connections[pre_type, post_type]: for sweep in pass_qc: p1 = trace_plot(sweep, color=trace_color, plot=p1, x_range=[0, 27e-3]) p1 = trace_plot(avg_trace, color=(255, 0, 255), plot=p1, x_range=[0, 27e-3], name=('%s -> %s' % (pre_type, post_type))) p2 = trace_plot(avg_trace, color=trace_color2, plot=p2, x_range=[0, 27e-3]) else: p2 = trace_plot(avg_trace, color=trace_color, plot=p2,
n_sweeps = len(sweep_list) if n_sweeps > sweep_threshold: qc_list = pulse_qc(sweep_list, baseline=2.5, pulse=None, plot=grid[row, 1]) qc_sweeps = len(qc_list) if qc_sweeps > sweep_threshold: avg_first_pulse = trace_avg(qc_list) avg_first_pulse.t0 = 0 if plot_sweeps is True: for current_sweep in qc_list: current_sweep.t0 = 0 bsub_trace = bsub(current_sweep) trace_plot(bsub_trace, sweep_color, plot=grid[row, 0], x_range=[-2e-3, 27e-3]) trace_plot(avg_first_pulse, avg_color, plot=grid[row, 0], x_range=[-2e-3, 27e-3]) label = pg.LabelItem('%s, n = %d' % (connection_type, qc_sweeps)) label.setParentItem(grid[row, 0].vb) label.setPos(50, 0) maxYpulse.append((row, grid[row, 0].getAxis('left').range[1])) grid[row, 0].hideAxis('bottom') _, _, _, peak_t = get_amplitude(qc_list) all_amps = np.asarray(fail_rate(qc_list, sign=sign, peak_t=peak_t)) # y = pg.pseudoScatter(all_amps, spacing=0.15) # test[row, 0].plot(all_amps, y, pen=None, symbol='o', symbolSize=8, symbolPen=(255, 255, 255, 200), symbolBrush=(0, 0, 255, 150))
holding = holding_i sign = '-' pulse_response, artifact = get_response(expt, pre_cell, post_cell, analysis_type='pulse') sweep_list = response_filter(pulse_response, freq_range=[0, 50], holding_range=holding, pulse=True) n_sweeps = len(sweep_list[0]) if n_sweeps > sweep_threshold: qc_list = pulse_qc(sweep_list, baseline=2, pulse=None, plot=pg.plot()) qc_sweeps = len(qc_list) if qc_sweeps > sweep_threshold: avg_first_pulse = trace_avg(qc_list) avg_first_pulse.t0 = 0 if plot_sweeps is True: for current_sweep in qc_list: current_sweep.t0 = 0 bsub_trace = bsub(current_sweep) trace_plot(bsub_trace, sweep_color, plot=grid[row, 0], x_range=[-2e-3, 27e-3]) trace_plot(avg_first_pulse, avg_color, plot=grid[row, 0], x_range=[-2e-3, 27e-3]) label = pg.LabelItem('%s, n = %d' % (connection_type, qc_sweeps)) label.setParentItem(grid[row, 0].vb) label.setPos(50, 0) maxYpulse.append((row, grid[row,0].getAxis('left').range[1])) grid[row, 0].hideAxis('bottom') _, _, _, peak_t = get_amplitude(qc_list) all_amps = np.asarray(fail_rate(qc_list, sign=sign, peak_t=peak_t)) # y = pg.pseudoScatter(all_amps, spacing=0.15) # test[row, 0].plot(all_amps, y, pen=None, symbol='o', symbolSize=8, symbolPen=(255, 255, 255, 200), symbolBrush=(0, 0, 255, 150)) y,x = np.histogram(all_amps, bins=np.linspace(0, 2e-3, 40)) test[row, 0].plot(x, y, stepMode=True, fillLevel=0, brush='k') test[row, 0].setLabels(bottom=('Vm', 'V')) test[row, 0].setXRange(0, 2e-3)