fig, AX = ge.figure(axes=(3, 1))
    for i, color in enumerate(['blue', 'green', 'red']):

        array = calib[correc][color]
        array = (array - np.min(array)) / (np.max(array) - np.min(array))

        def to_minimize(coefs):
            return np.sum(np.abs(array - func(lum, coefs))**2)

        residual = minimize(to_minimize, [1, 1], bounds=[(0.5, 2), (0.1, 3.)])

        print('For %s and %s, gamma=' % (correc, color), residual.x[1])

        # ge.title(AX[i], "a=%.2f, k=%.2f, $\gamma$=%.2f" % (residual.x[0], residual.x[1], residual.x[2]), color=getattr(ge, color), size='small')
        ge.title(AX[i],
                 "k=%.2f, $\gamma$=%.2f" % (residual.x[0], residual.x[1]),
                 color=getattr(ge, color),
                 size='small')
        ge.scatter(lum,
                   array,
                   ax=AX[i],
                   color=getattr(ge, color),
                   label='data',
                   ms=3)
        ge.plot(lum,
                func(lum, residual.x),
                ax=AX[i],
                lw=3,
                alpha=.5,
                color=getattr(ge, color),
                label='fit')
        ge.annotate(AX[i],
示例#2
0
    if sys.argv[-1] == 'syn-demo':

        from datavyz import nrnvyz, ges as ge

        _, neuron, SEGMENTS = initialize_sim(Model)
        vis = nrnvyz(SEGMENTS, ge=ge)

        fig, AX = ge.figure(axes=(len(NSYNs), 1),
                            figsize=(.8, 1.2),
                            wspace=0,
                            left=0,
                            top=0.3,
                            bottom=0,
                            right=0)
        for nsyn, ax in zip(NSYNs, AX):
            ge.title(ax, '$N_{syn}$=%i' % nsyn, size='xx-small')
            vis.plot_segments(SEGMENTS['comp_type'] != 'axon',
                              bar_scale_args=dict(Ybar=50,
                                                  Xbar_label='50um',
                                                  Xbar=50,
                                                  Ybar_label='',
                                                  loc='top-right',
                                                  xyLoc=(-110, 90),
                                                  size='xx-small'),
                              ax=ax)
            vis.add_dots(ax, loc_syn0 + np.arange(nsyn), 10, ge.orange)
        ge.show()

    elif sys.argv[-1] == 'run-demo':

        syn_loc0 = 9
示例#3
0
        ]

        fig, AX = ge.figure(figsize=(.6, .6),
                            axes=(int(len(file_list) / 8) + 1, 8))

        n = 0
        for fn, ax in zip(file_list, ge.flat(AX)):
            morpho = ntwk.Morphology.from_swc_file(
                os.path.join(args.directory, fn))
            SEGMENTS = ntwk.morpho_analysis.compute_segments(morpho)
            colors = [
                ge.green if comp_type == 'axon' else ge.red
                for comp_type in SEGMENTS['comp_type']
            ]
            plot_nrn_shape(ge, SEGMENTS, colors=colors, ax=ax)
            ge.title(ax, fn.split('-')[0], bold=True, style='italic', size='')
            n += 1
        while n < len(ge.flat(AX)):
            ge.flat(AX)[n].axis('off')
            n += 1
    else:

        if args.movie_demo:
            t = np.arange(100) * 1e-3
            Quant = np.array([.5*(1-np.cos(20*np.pi*t))*i/len(SEGMENT_LIST['xcoords']) \
                              for i in np.arange(len(SEGMENT_LIST['xcoords']))])*20-70
            ani = show_animated_time_varying_trace(
                1e3 * t,
                Quant,
                SEGMENT_LIST,
                fig,
示例#4
0
        vis.add_dots(ax, DIST, 50, ge.orange)
        ge.show()

    elif args.protocol == 'syn-number':

        tstop, t0_stim = 300, 20
        if args.plot:
            data = load_dict(
                os.path.join('data', 'branco-syn-number-%s.npz' % suffix))

            fig, AX = ge.figure(axes=(1, 2),
                                figsize=(.7, 1),
                                right=4.,
                                hspace=0.1,
                                bottom=0.1)
            ge.title(AX[0],
                     '%i to %i synapses (by 2)' % (N_PULSES[0], N_PULSES[-1]))
            for synapses_loc, label, ax in zip([PROX, DIST], ['prox', 'dist'],
                                               AX):
                for i in range(len(data['v-%s' % label])):
                    ax.plot(data['t'],
                            data['v-%s' % label][i],
                            label=label,
                            color='k',
                            lw=1)

                ge.set_plot(ax, [], ylim=[-76, -45], xlim=[0, tstop])
                ge.draw_bar_scales(ax,
                                   Xbar=50.,
                                   Xbar_label='50ms',
                                   Ybar=5.,
                                   Ybar_label='5mV',