train_response,
                    rec_t,
                    holding,
                    thresh=sweep_threshold,
                    rec_dict=recovery_grand,
                    offset_dict=pulse_offset_rec,
                    uid=(expt.uid, pre, post))
    for f, freq in enumerate(freqs):
        if freq not in induction_grand.keys():
            print("%d Hz not represented in data set for %s" % (freq, c_type))
            continue
        ind_offsets = pulse_offset_ind[freq]
        qc_plot.clear()
        ind_pass_qc = train_qc(induction_grand[freq],
                               ind_offsets,
                               amp=qc_params[1][c],
                               sign=qc_params[0],
                               plot=qc_plot)
        n_synapses = len(ind_pass_qc[0])
        if n_synapses > 0:
            induction_grand_trace = TraceList(ind_pass_qc[0]).mean()
            ind_rec_grand_trace = TraceList(ind_pass_qc[1]).mean()
            ind_amp = train_amp(ind_pass_qc, ind_offsets, '+')
            ind_amp_grand = np.nanmean(ind_amp, 0)

            if f == 0:
                ind_plot[f, c].setTitle(connection_types[c])
                type = pg.LabelItem('%s -> %s' % connection_types[c])
                type.setParentItem(summary_plot[c, 0])
                type.setPos(50, 0)
            if c == 0:
Exemple #2
0
                                rec_dict=grand_recovery,
                                offset_dict=offset_rec)

        if len(grand_pulse_response) > 0:
            grand_pulse_trace = TSeriesList(grand_pulse_response).mean()
            p2 = trace_plot(grand_pulse_trace,
                            color=avg_color,
                            plot=p2,
                            x_range=[0, 27e-3],
                            name=('n = %d' % len(grand_pulse_response)))
            if len(grand_induction) > 0:
                for f, freq in enumerate(freqs):
                    if freq in grand_induction:
                        offset = offset_ind[freq]
                        ind_pass_qc = train_qc(grand_induction[freq],
                                               offset,
                                               amp=amp_thresh,
                                               sign=sign)
                        n = len(ind_pass_qc[0])
                        if n > 0:
                            ind_amp = train_amp(ind_pass_qc, offset, sign)
                            grand_ind_amp = np.nanmean(ind_amp, 0)
                            ind_amp_sem = stats.sem(ind_amp)
                            if freq not in ind_index.keys():
                                ind_index[freq] = {}
                            if key not in ind_index[freq].keys():
                                ind_index[freq][key] = []
                            for n in range(ind_amp.shape[0]):
                                ind_index[freq][key].append(ind_amp[n, 7] /
                                                            ind_amp[n, 0])
                            if freq == 50:
                                grand_ind_trace = TSeriesList(
                train_response, artifact = get_response(expt, pre, post, type='train')
                if threshold[c] is not None and artifact > threshold[c]:
                    continue
                induction_grand, pulse_offset_ind = induction_summary(train_response, freqs, holding, thresh=sweep_threshold,
                                                                ind_dict=induction_grand, offset_dict=pulse_offset_ind,
                                                                      uid=(expt.uid, pre, post))
                recovery_grand, pulse_offset_rec = recovery_summary(train_response, rec_t, holding, thresh=sweep_threshold,
                                                                rec_dict=recovery_grand, offset_dict=pulse_offset_rec,
                                                                    uid=(expt.uid, pre, post))
    for f, freq in enumerate(freqs):
        if freq not in induction_grand.keys():
            print ("%d Hz not represented in data set for %s" % (freq, c_type))
            continue
        ind_offsets = pulse_offset_ind[freq]
        qc_plot.clear()
        ind_pass_qc = train_qc(induction_grand[freq], ind_offsets, amp=qc_params[1][c], sign=qc_params[0], plot=qc_plot)
        n_synapses = len(ind_pass_qc[0])
        if n_synapses > 0:
            induction_grand_trace = TraceList(ind_pass_qc[0]).mean()
            ind_rec_grand_trace = TraceList(ind_pass_qc[1]).mean()
            ind_amp = train_amp(ind_pass_qc, ind_offsets, '+')
            ind_amp_grand = np.nanmean(ind_amp, 0)

            if f == 0:
                ind_plot[f, c].setTitle(connection_types[c])
                type = pg.LabelItem('%s -> %s' % connection_types[c])
                type.setParentItem(summary_plot[c, 0])
                type.setPos(50, 0)
            if c == 0:
                label = pg.LabelItem('%d Hz Induction' % freq)
                label.setParentItem(ind_plot[f, c].vb)