コード例 #1
0
                                                  dist_plot=None,
                                                  color=color[0])
            avg_est_age2, summary_plots = first_pulse_plot(
                expts,
                name=legend,
                summary_plot=summary_plots,
                color=color[1],
                scatter=1,
                features=True)
            if args.trains is True:
                summary_train, summary_dec, summary_amps = train_response_plot(
                    expts,
                    name=(legend + ' 50 Hz induction'),
                    summary_plots=[summary_train, summary_dec],
                    color=color[1])
                write_cache(summary_amps, 'age_train_amps.pkl')

            ks = stats.ks_2samp(avg_est_age1['amp'], avg_est_age2['amp'])
            print('p = %f (KS test, Amplitude)' % ks.pvalue)
            ks = stats.ks_2samp(avg_est_age1['latency'],
                                avg_est_age2['latency'])
            print('p = %f (KS test, Latency)' % ks.pvalue)
            ks = stats.ks_2samp(avg_est_age1['rise'], avg_est_age2['rise'])
            print('p = %f (KS test, Rise time)' % ks.pvalue)
        elif args.cre_type is None and (args.calcium is not None
                                        or args.age is not None):
            print(
                'Error: in order to compare across conditions a single cre-type connection must be specified'
            )
        else:
            dist_plots = None
コード例 #2
0
                                rec_index[delta] = {}
                            if key not in rec_index[delta].keys():
                                rec_index[delta][key] = []
                            for n in range(rec_amp.shape[0]):
                                rec_index[delta][key].append(rec_amp[n, 8] /
                                                             rec_amp[n, 0])
                            t_color = pg.hsvColor(hue,
                                                  sat=float(t + 0.5) /
                                                  len(t_rec),
                                                  val=1)
                            p5.plot(grand_rec_amp / grand_rec_amp[0],
                                    name=('  %d ms, n = %d' % (delta, n)),
                                    pen=t_color,
                                    symbol='t',
                                    symbolBrush=t_color,
                                    symbolPen=None)
                            # rec_err = pg.ErrorBarItem(x=np.arange(12),y=np.array(grand_rec_amp / grand_rec_amp[0]),
                            #                           height=np.array(rec_amp_sem), beam=0.3)
                            # p5.addItem(rec_err)
        row += 1
    # if sum(pulse_cache_change) > 0:
    #     write_cache(pulse_response_cache, pulse_cache_file)
    # if sum(train_cache_change) > 0:
    #     write_cache(train_response_cache, train_cache_file)

feature_cache = {}
feature_cache['Amplitudes'] = pulse_amp
feature_cache['Induction'] = ind_index
feature_cache['Recovery'] = rec_index
write_cache(feature_cache, 'feature_cache_file.pkl')
コード例 #3
0
                rec_deconv = deconv_train(rec_pass_qc[:2])
                rec_deconv_grand = TraceList(rec_deconv[0]).mean()
                rec_ind_deconv_grand = TraceList(rec_deconv[1]).mean()
                #log_rec_plt.plot(rec_deconv_grand.time_values, rec_deconv_grand.data,
                #                    pen={'color': color, 'width': 2})
                rec_deconv_ind_grand2 = rec_ind_deconv_grand.copy(t0=delta + 0.2)
                #log_rec_plt.plot(rec_deconv_ind_grand2.time_values, rec_deconv_ind_grand2.data,
                #                    pen={'color': color, 'width': 2})
                [deconv_rec_plot[t, c].plot(ind.time_values, ind.data, pen=trace_color) for ind in rec_deconv[0]]
                [deconv_rec_plot[t, c].plot(rec.time_values, rec.data, pen=trace_color) for rec in rec_deconv[1]]
                deconv_rec_plot[t, c].plot(rec_ind_deconv_grand.time_values, rec_ind_deconv_grand.data,
                                    pen={'color': color, 'width': 2}, name=("n = %d" % n_synapses))
                deconv_rec_plot[t, c].plot(rec_deconv_grand.time_values, rec_deconv_grand.data,
                                    pen={'color': color, 'width': 2})
            summary_plot[c, 1].setLabels(left=('Norm Amp', ''))
            summary_plot[c, 1].setLabels(bottom=('Pulse Number', ''))
            f_color = pg.hsvColor(hue=hue, sat=float(t+0.5) / len(rec_t), val=1)
            summary_plot[c, 1].plot(rec_amp_grand/rec_amp_grand[0], name=('  %d ms' % delta), pen=f_color, symbol=symbols[t],
                                symbolBrush=f_color, symbolPen=None)
            if connection_types[c] not in rec_amp_summary.keys():
                rec_amp_summary[connection_types[c]] = []
                rec_uid[connection_types[c]] = []
            rec_amp_summary[connection_types[c]].append([delta, rec_amp])
            rec_uid[connection_types[c]].append([delta, rec_pass_qc[2]])

    # if sum(cache_change) > 0:
    #     write_cache(response_cache, cache_file)

print ('Exporting train pulse amplitudes and experiment IDs for further analysis')
write_cache([ind_amp_summary, rec_amp_summary], "train_amps_human.pkl")
write_cache([ind_uid, rec_uid], "expt_ids_human.pkl")
コード例 #4
0
                                           name=("n = %d" % n_synapses))
                deconv_rec_plot[t, c].plot(rec_deconv_grand.time_values,
                                           rec_deconv_grand.data,
                                           pen={
                                               'color': color,
                                               'width': 2
                                           })
            summary_plot[c, 1].setLabels(left=('Norm Amp', ''))
            summary_plot[c, 1].setLabels(bottom=('Pulse Number', ''))
            f_color = pg.hsvColor(hue=hue,
                                  sat=float(t + 0.5) / len(rec_t),
                                  val=1)
            summary_plot[c, 1].plot(rec_amp_grand / rec_amp_grand[0],
                                    name=('  %d ms' % delta),
                                    pen=f_color,
                                    symbol=symbols[t],
                                    symbolBrush=f_color,
                                    symbolPen=None)
            if connection_types[c] not in rec_amp_summary.keys():
                rec_amp_summary[connection_types[c]] = []
                rec_uid[connection_types[c]] = []
            rec_amp_summary[connection_types[c]].append([delta, rec_amp])
            rec_uid[connection_types[c]].append([delta, rec_pass_qc[2]])

    # if sum(cache_change) > 0:
    #     write_cache(response_cache, cache_file)

print(
    'Exporting train pulse amplitudes and experiment IDs for further analysis')
write_cache([ind_amp_summary, rec_amp_summary], "train_amps3.pkl")
write_cache([ind_uid, rec_uid], "expt_ids3.pkl")
コード例 #5
0
            ages = args.age.split(',')
            expts, legend, dist_plots = get_expts(all_expts, cre_type, calcium='high', age=ages[0], start=args.start,
                                                  stop=args.stop, dist_plot=None, color=color[0])
            avg_est_age1, summary_plots = first_pulse_plot(expts, name=legend, summary_plot=None, color=color[0], scatter=0,
                                                           features=True)
            if args.trains is True:
                summary_train, summary_dec = train_response_plot(expts, name=(legend + ' 50 Hz induction'), summary_plots=[None,None],
                                                                 color=color[0])
            expts, legend, dist_plots = get_expts(all_expts, cre_type, calcium='high', age=ages[1], start=args.start,
                                                  stop=args.stop, dist_plot=None, color=color[0])
            avg_est_age2, summary_plots = first_pulse_plot(expts, name=legend, summary_plot=summary_plots, color=color[1],
                                                           scatter=1, features=True)
            if args.trains is True:
                summary_train, summary_dec, summary_amps = train_response_plot(expts, name=(legend + ' 50 Hz induction'),
                                                                summary_plots=[summary_train, summary_dec], color=color[1])
                write_cache(summary_amps, 'age_train_amps.pkl')

            ks = stats.ks_2samp(avg_est_age1['amp'], avg_est_age2['amp'])
            print('p = %f (KS test, Amplitude)' % ks.pvalue)
            ks = stats.ks_2samp(avg_est_age1['latency'], avg_est_age2['latency'])
            print('p = %f (KS test, Latency)' % ks.pvalue)
            ks = stats.ks_2samp(avg_est_age1['rise'], avg_est_age2['rise'])
            print('p = %f (KS test, Rise time)' % ks.pvalue)
        elif args.cre_type is None and (args.calcium is not None or args.age is not None):
            print('Error: in order to compare across conditions a single cre-type connection must be specified')
        else:
            dist_plots = None
            summary_plot = None
            train_plots = None
            train_plots2 = None
            for i, type in enumerate(cre_types):