예제 #1
0
    def visualize_test_between_class(self, test, human, non_human):
        fig = plt.figure("Trajectories for Test, Human, and Non-Human")
        ax = SubplotZero(fig, 111)
        fig.add_subplot(ax)
        line_style = ['r.-', 'gx-', 'bo-']

        # plotting test data
        x = [i.pose.position.x for i in test]
        y = [i.pose.position.y for i in test]
        ax.plot(x, y, line_style[0], label="Test")
        # plotting human data
        x = [i.pose.position.x for i in human]
        y = [i.pose.position.y for i in human]
        ax.plot(x, y, line_style[1], label="Human")
        # plotting non-human data
        x = [i.pose.position.x for i in non_human]
        y = [i.pose.position.y for i in non_human]
        ax.plot(x, y, line_style[2], label="Non-human")

        ax.margins(0.05)
        ax.legend(loc="lower right", fontsize=10)
        plt.title("Chunks of Trajectories")
        plt.xlabel("Axis")
        plt.ylabel("Ordinate")

        for direction in ["xzero", "yzero"]:
            ax.axis[direction].set_axisline_style("-|>")
            ax.axis[direction].set_visible(True)

        for direction in ["left", "right", "bottom", "top"]:
            ax.axis[direction].set_visible(False)

        pylab.grid()
        plt.show()
예제 #2
0
def visualize_test_between_class(test, human, non_human):
    fig = plt.figure("Trajectories for Test, Human, and Non-Human")
    ax = SubplotZero(fig, 111)
    fig.add_subplot(ax)
    line_style = ['r.-', 'gx-', 'bo-']

    # plotting test data
    x = [i.pose.position.x for i in test]
    y = [i.pose.position.y for i in test]
    ax.plot(x, y, line_style[0], label="Test")
    # plotting human data
    x = [i.pose.position.x for i in human]
    y = [i.pose.position.y for i in human]
    ax.plot(x, y, line_style[1], label="Human")
    # plotting non-human data
    x = [i.pose.position.x for i in non_human]
    y = [i.pose.position.y for i in non_human]
    ax.plot(x, y, line_style[2], label="Non-human")

    ax.margins(0.05)
    ax.legend(loc="lower right", fontsize=10)
    plt.title("Chunks of Trajectories")
    plt.xlabel("Axis")
    plt.ylabel("Ordinate")

    for direction in ["xzero", "yzero"]:
        ax.axis[direction].set_axisline_style("-|>")
        ax.axis[direction].set_visible(True)

    for direction in ["left", "right", "bottom", "top"]:
        ax.axis[direction].set_visible(False)

    pylab.grid()
    plt.show()
예제 #3
0
    def run(self, results):
        par1 = self.getValueOfParameter("parameter 1")
        par2 = self.getValueOfParameter("parameter 2")
        i = int(self.getValueOfParameter("iteration number"))
        title = self.getValueOfParameter("title")
        
        if(par1==""):
            return False
        
        if(par2==""):
            return False
        
        if(i >= results.__len__()):
            return False
        
        
        dialogform = Dialog(QApplication.activeWindow())
        fig = Figure((5.0, 4.0), dpi=100)
        ax = SubplotZero(fig, 1, 1, 1)
        fig.add_subplot(ax)

        for n in ["top", "right"]:
            ax.axis[n].set_visible(False)
            
        for n in ["bottom", "left"]:
            ax.axis[n].set_visible(True)
        
        y1 = results[i].getResults(par1)
        y2 = results[i].getResults(par2)    
        
        if(not(y1.__len__())):
            return False
        
        if(not(y2.__len__())):
            return False
        
        ax.plot(range(0,y1.__len__()),y1,color='r')
        ax.plot(range(0,y2.__len__()),y2,color='b')
        ax.set_title(title)
        
        leg = ax.legend((par1, par2),
           'upper center', shadow=True)
        
        frame  = leg.get_frame()
        frame.set_facecolor('0.80')    # set the frame face color to light gray
        
        # matplotlib.text.Text instances
        for t in leg.get_texts():
            t.set_fontsize('small')    # the legend text fontsize
        
        # matplotlib.lines.Line2D instances
        for l in leg.get_lines():
            l.set_linewidth(1.5)  # the legend line width
        
        dialogform.showFigure(fig)
        return True
예제 #4
0
         label='EEG/MEG sites')
for i, (x, y, z) in enumerate(foursphereParams['r']):
    # theta = np.arcsin(x / foursphereParams['radii'][-1])
    # if x >= 0:
    #     ax3.text(x, z+5000, r'${}\pi$'.format(theta / np.pi))
    # else:
    #     ax3.text(x, z+5000, r'${}\pi$'.format(theta / np.pi), ha='right')
    ax3.text(x, z + 2500, r'{}'.format(i + 1), ha='center')

# dipole location
ax3.plot([0], [dipole_position[-1]], 'k.', label='dipole site')
ax3.axis('equal')
ax3.set_xticks(np.r_[-np.array(foursphereParams['radii']), 0,
                     foursphereParams['radii']])
ax3.set_xticklabels([])
ax3.legend(loc=(0.25, 0.15), frameon=False)

# four-sphere volume conductor
sphere = LFPy.FourSphereVolumeConductor(**foursphereParams)
phi_p = sphere.calc_potential(cell.current_dipole_moment, rz=dipole_position)

# import example_parallel_network_plotting as plotting
vlimround = draw_lineplot(
    ax=ax4,
    data=phi_p * 1E9,
    unit=r'pV',  #mV -> pV unit conversion
    dt=cell.dt,
    ztransform=False,
    T=(0, cell.tstop),
    color='k',
    scalebarbasis='log10')
예제 #5
0
파일: figure_5.py 프로젝트: torbjone/LFPy
    # draw measurement points
    ax.plot(PSET.foursphereParams['r'][:, 0], PSET.foursphereParams['r'][:, 2], 'ko', label='EEG/MEG sites')
    
    for i, (x, y, z) in enumerate(PSET.foursphereParams['r']):
        ax.text(x, z+2500, r'{}'.format(i+1), ha='center')
        
    # dipole location
    ax.plot([0], [PSET.foursphereParams['radii'][0] + PSET.layer_data['center'][3]], 'k.', label='dipole site')
    
    ax.axis('equal')
    ax.set_ylim(top=max(PSET.foursphereParams['radii']) + 5000)

    ax.set_xticks(np.r_[-np.array(PSET.foursphereParams['radii']), 0, PSET.foursphereParams['radii']])
    ax.set_xticklabels([])                       
    
    ax.legend(loc=(0.25, 0.05), frameon=False)
    
    ax.text(-0.1, 1.05, alphabet[5],
        horizontalalignment='center',
        verticalalignment='center',
        fontsize=16, fontweight='demibold',
        transform=ax.transAxes)




    # PANEL G. EEG signal
    ax = fig.add_subplot(gs[2, 2])
    ax.set_title(r'surface potential $\phi_\mathbf{p}(\mathbf{r})$ ')

    f = h5py.File(os.path.join(PSET.OUTPUTPATH,
예제 #6
0
                        units='x',
                        label=r'$\sigma_{nt}$',
                        color=(1.0, 0.25, 0.75))
line_proj, = ax1.plot([], [], '--')

facette, = ax1.plot([], [], '--g', lw=2)
vec_n = ax1.quiver(0,
                   0,
                   0,
                   0,
                   width=4,
                   scale=4 / Sig_max,
                   units='x',
                   label=r'$n$',
                   color='g')
ax1.legend()

# Espace Snn,Snt
ax2 = SubplotZero(fig, 122)
fig.add_subplot(ax2)
#
for direction in ["xzero", "yzero"]:
    ax2.axis[direction].set_axisline_style("-|>")
    ax2.axis[direction].set_visible(True)
#
for direction in ["left", "right", "bottom", "top"]:
    ax2.axis[direction].set_visible(False)

ax2.set_aspect('equal')

ax2.set_xlim(-Sig_max, Sig_max)
예제 #7
0
from mpl_toolkits.axes_grid.axislines import SubplotZero

x = linspace(-5 * pi, 5 * pi, 500)
y = (sin(x) / x)**2
fig = plt.figure(figsize=(8, 4))
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)
ax.grid(True)
ax.set_xticks([
    -5 * pi, -4 * pi, -3 * pi, -2 * pi, -pi, 0, pi, 2 * pi, 3 * pi, 4 * pi,
    5 * pi
])
ax.set_xticklabels([
    "$-5 \pi$", "$-4 \pi$", "$-3 \pi$", "$-2 \pi$", "$- \pi$", "0", "$\pi$",
    "$2 \pi$", "$3 \pi$", "$4 \pi$", "$5 \pi$"
])
ax.set_ylim((-.3, 1.2))
ax.set_yticklabels([])
for direction in ["xzero", "yzero"]:
    ax.axis[direction].set_axisline_style("->")
    ax.axis[direction].set_visible(True)
for direction in ["left", "right", "bottom", "top"]:
    ax.axis[direction].set_visible(False)
ax.plot(x, y, label=r"$sinc^{2} \ x$", color="k", linewidth=3, alpha=0.8)
ax.text(5.5 * pi, 0., "x")
ax.text(0.1, 1, "1")
ax.legend()
plt.tight_layout()
plt.savefig("sinc.png")
plt.show()
예제 #8
0
파일: figure_2.py 프로젝트: torbjone/LFPy
# draw measurement points
ax3.plot(foursphereParams['r'][:, 0], foursphereParams['r'][:, 2], 'ko', label='EEG/MEG sites')
for i, (x, y, z) in enumerate(foursphereParams['r']):
    # theta = np.arcsin(x / foursphereParams['radii'][-1])
    # if x >= 0:
    #     ax3.text(x, z+5000, r'${}\pi$'.format(theta / np.pi))
    # else:
    #     ax3.text(x, z+5000, r'${}\pi$'.format(theta / np.pi), ha='right')
    ax3.text(x, z+2500, r'{}'.format(i + 1), ha='center')
    
# dipole location
ax3.plot([0], [dipole_position[-1]], 'k.', label='dipole site')
ax3.axis('equal')
ax3.set_xticks(np.r_[-np.array(foursphereParams['radii']), 0, foursphereParams['radii']])
ax3.set_xticklabels([])                       
ax3.legend(loc=(0.25, 0.15), frameon=False)



# four-sphere volume conductor
sphere = LFPy.FourSphereVolumeConductor(
    **foursphereParams
)
phi_p = sphere.calc_potential(cell.current_dipole_moment, rz=dipole_position)

# import example_parallel_network_plotting as plotting
vlimround = draw_lineplot(ax=ax4, data=phi_p*1E9, unit=r'pV', #mV -> pV unit conversion
                          dt=cell.dt, ztransform=False,
                          T=(0, cell.tstop), color='k', scalebarbasis='log10')      
# ax4.set_xticklabels([])
ax4.set_yticklabels([r'{}'.format(i + 1) for i in range(phi_p.shape[0])])
예제 #9
0
파일: figure_5.py 프로젝트: tfiers/LFPy
        ax.text(x, z + 2500, r'{}'.format(i + 1), ha='center')

    # dipole location
    ax.plot([0],
            [PSET.foursphereParams['radii'][0] + PSET.layer_data['center'][3]],
            'k.',
            label='dipole site')

    ax.axis('equal')
    ax.set_ylim(top=max(PSET.foursphereParams['radii']) + 5000)

    ax.set_xticks(np.r_[-np.array(PSET.foursphereParams['radii']), 0,
                        PSET.foursphereParams['radii']])
    ax.set_xticklabels([])

    ax.legend(loc=(0.25, 0.05), frameon=False)

    ax.text(-0.1,
            1.05,
            alphabet[5],
            horizontalalignment='center',
            verticalalignment='center',
            fontsize=16,
            fontweight='demibold',
            transform=ax.transAxes)

    # PANEL G. EEG signal
    ax = fig.add_subplot(gs[2, 2])
    ax.set_title(r'surface potential $\phi_\mathbf{p}(\mathbf{r})$ ')

    f = h5py.File(
예제 #10
0
colors = [colormap(i) for i in np.linspace(0, 1, 6)]

plt.title("Six sigmoid functions", fontsize=18, y=1.08)

leg_list = [
    r"$\mathrm{erf}\left(\frac{\sqrt{\pi}}{2}x \right)$", r"$\tanh(x)$",
    r"$\frac{2}{\pi}\mathrm{gd}\left( \frac{\pi}{2}x \right)$",
    r"$x\left(1+x^2\right)^{-\frac{1}{2}}$",
    r"$\frac{2}{\pi}\mathrm{arctan}\left( \frac{\pi}{2}x \right)$",
    r"$x\left(1+|x|\right)^{-1}$"
]

for i in range(1, 7):
    s = "ax.plot(x,y%s(x),color=colors[i-1])" % (str(i))
    eval(s)
ax.legend(leg_list, loc="best", ncol=2,
          fancybox=True)  # title="Legend", fontsize=12
# ax.grid(True, which='both')
ax.set_aspect('equal')
ax.set_xlim([-3.1, 3.1])
ax.set_ylim([-1.1, 1.1])

ax.annotate('1', xy=(0.08, 1 - 0.02))
ax.annotate('0', xy=(0.08, -0.2))
ax.annotate('-1', xy=(0.08, -1 - 0.03))

for i in [-3, -2, -1, 1, 2, 3]:
    ax.annotate('%s' % str(i), xy=(i - 0.03, -0.2))

maybe = raw_input(
    "\nUpdate figure directly in master thesis?\nEnter 'YES' (anything else = ONLY show to screen) "
)