コード例 #1
0
def curvelinear_test1(fig):
    """
    grid for custom transform.
    """

    def tr(x, y):
        x, y = np.asarray(x), np.asarray(y)
        return x, y-x

    def inv_tr(x,y):
        x, y = np.asarray(x), np.asarray(y)
        return x, y+x


    grid_helper = GridHelperCurveLinear((tr, inv_tr))

    ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper)
    # ax1 will have a ticks and gridlines defined by the given
    # transform (+ transData of the Axes). Note that the transform of
    # the Axes itself (i.e., transData) is not affected by the given
    # transform.

    fig.add_subplot(ax1)

    xx, yy = tr([3, 6], [5.0, 10.])
    ax1.plot(xx, yy)

    ax1.set_aspect(1.)
    ax1.set_xlim(0, 10.)
    ax1.set_ylim(0, 10.)

    ax1.axis["t"]=ax1.new_floating_axis(0, 3.)
    ax1.axis["t2"]=ax1.new_floating_axis(1, 7.)
    ax1.grid(True)
コード例 #2
0
def curvelinear_test1(fig):
    """
    grid for custom transform.
    """
    def tr(x, y):
        x, y = np.asarray(x), np.asarray(y)
        return x, y - x

    def inv_tr(x, y):
        x, y = np.asarray(x), np.asarray(y)
        return x, y + x

    grid_helper = GridHelperCurveLinear((tr, inv_tr))

    ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper)
    # ax1 will have a ticks and gridlines defined by the given
    # transform (+ transData of the Axes). Note that the transform of
    # the Axes itself (i.e., transData) is not affected by the given
    # transform.

    fig.add_subplot(ax1)

    xx, yy = tr([3, 6], [5.0, 10.])
    ax1.plot(xx, yy)

    ax1.set_aspect(1.)
    ax1.set_xlim(0, 10.)
    ax1.set_ylim(0, 10.)

    ax1.grid(True)
コード例 #3
0
def curvelinear_test1(fig):
    """
    grid for custom transform.
    """
    def tr(x, y):
        x, y = np.asarray(x), np.asarray(y)
        return x, y-x
    def inv_tr(x,y):
        x, y = np.asarray(x), np.asarray(y)
        return x, y+x
    grid_helper = GridHelperCurveLinear((tr, inv_tr))
    ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper)
    fig.add_subplot(ax1)
    xx, yy = tr([3, 6], [5.0, 10.])
    ax1.plot(xx, yy)
    ax1.set_aspect(1.)
    ax1.set_xlim(0, 10.)
    ax1.set_ylim(0, 10.)
    ax1.grid(True)
コード例 #4
0
def plot_df_f0s():
    fig = plt.figure(1, (3, 3))

    ax = Subplot(fig, 111)
    fig.add_subplot(ax)

    ax.axis["right"].set_visible(False)
    ax.axis["top"].set_visible(False)

    x = np.linspace(-333.3, 1498.5, num=55)
    # x = range(1, 56)
    for true_means, list_sems in zip(all_true_means, all_list_sems):
        ax.errorbar(x, true_means, yerr=list_sems, elinewidth=3, linewidth=4)
    ax.axvspan(0, 400, color="y", alpha=0.5, lw=0)
    ax.set_xticks([-200, 0, 200, 400, 600, 800, 1000, 1200, 1400])
    ax.set_xlabel("Time (ms)")
    ax.set_ylabel(r"$\Delta F/F_0$(%)")
    ax.xaxis.set_tick_params(width=2, length=7)
    ax.yaxis.set_tick_params(width=2, length=7)

    # x_axis = np.linspace(3.333, 26.6667, num=800)
    # for df_df0 in list_df_f0:
    # plt.plot(df_df0)
    ax.set_ylim([-1.5, 2.5])
    ax.set_xlim([-340, 1500])

    # axes color.... jeff didn't like it :(
    # plt.axhline(linewidth=3, color='k')
    # plt.axvline(linewidth=3, color='k')

    # plt.xlim([3.333,26.6667])

    # plt.plot([83, 83], [-0.015, 0.025], 'k-', lw=2)
    # plt.plot([203, 203], [-0.015, 0.025], 'k-', lw=2)
    # plt.plot([505, 505], [-0.015, 0.025], 'k-', lw=2)
    # plt.axvspan(5, 17, color='y', alpha=0.5, lw=0)
    # plt.axvspan(505, 517, color='y', alpha=0.5, lw=0)

    # for i in range(1, len(timings)):
    # plt.plot([timings[i], timings[i]], [-0.015, 0.025], 'k-', lw=2)
    plt.show()
コード例 #5
0
    def PlotVollmer(self, event): 

        #initialize the plot areas
        self.dataFigure.clf()
        axes = Subplot(self.dataFigure, 111, clip_on='True',xlim=(-0.1,1.05), ylim=(-0.1,1.05),autoscale_on='True',label='vollmer',aspect='equal', adjustable='box',anchor='SW')
        self.dataFigure.add_subplot(axes)
        axes.axis["right"].set_visible(False)
        axes.axis["top"].set_visible(False)
        axes.axis["bottom"].set_visible(False)
        axes.axis["left"].set_visible(False)



        try:
            sqrt3_2 = 0.866025  #m_sqrt(3)/2

            tr1 = Line2D((0,1),(0,0),c='black')
            axes.add_line(tr1)
            tr2 = Line2D((0,0.5),(0,sqrt3_2),c='black')
            axes.add_line(tr2)
            tr3 = Line2D((1,0.5),(0,sqrt3_2),c='black')
            axes.add_line(tr3)



            for i in [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]:
                diag = Line2D((i/2,1.0-i/2),(sqrt3_2*i,sqrt3_2*i),c='grey',lw=0.5)
                axes.add_line(diag)
                diag2 = Line2D((i/2,i),(sqrt3_2*i,0),c='grey',lw=0.5)
                axes.add_line(diag2)
                diag3 = Line2D((i,i+(1-i)/2),(0,sqrt3_2-sqrt3_2*i),c='grey',lw=0.5)
                axes.add_line(diag3)


            axes.text(-0.08,-0.05,'Point',family='sans-serif',size=self.fontSize,horizontalalignment='left' )
            axes.text(0.97,-0.05,'Girdle',family='sans-serif',size=self.fontSize,horizontalalignment='left' )
            axes.text(0.5,0.88,'Random',family='sans-serif',size=self.fontSize,horizontalalignment='center' )

            # label axes values
            for i in [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]:
                axes.text((1-i)/2, sqrt3_2*(1-i)-0.01, '%d' % (i*100), family='sans-serif', size=self.fontSize, horizontalalignment='right', color='grey', rotation='60')
                axes.text(i, -0.02,'%d' % (i*100), family='sans-serif', size=self.fontSize, horizontalalignment='center', verticalalignment='top', color='grey')
                axes.text(1.0-i/2, sqrt3_2*i-0.01,'%d' % (i*100) , family='sans-serif', size=self.fontSize, horizontalalignment='left', color='grey', rotation='-60')


            # ternary plot (from wikipedia)
            # P = (0,0)
            # G = (1,0)
            # R = (1/2, sqrt(3)/2)
            # given (P,G,R):
            # x = G + R/2
            # y = (sqrt(3)/2) * R

            if len(self.idxPlan) == 0 and len(self.idxLin) == 0: # in case we have only one one opened file but it is not checked
                raise AttributeError
            else:
                for i in range(len(self.idxPlan)):
                    x = self.PeigenList[i]["G"] + (self.PeigenList[i]["R"] / 2)
                    y = self.PeigenList[i]["R"] * sqrt3_2
                    axes.plot(x,y, self.PProps[i]["PoleSymb"], c=self.PProps[i]["PolColor"], ms=self.PProps[i]["polespin"],label='%s n=%d' % (self.Pname[i],self.Pndata[i]))

                for j in range(len(self.idxLin)):
                    x = self.LeigenList[j]["G"] + (self.LeigenList[j]["R"] / 2)
                    y = self.LeigenList[j]["R"] * sqrt3_2
                    axes.plot(x,y, self.LProps[j]["LineSymb"], c=self.LProps[j]["LinColor"], ms=self.LProps[j]["linespin"],label='%s n=%d' % (self.Lname[j],self.Lndata[j]))


            axes.legend(bbox_to_anchor=(0.97, 0.8), loc=2, prop=FontProperties(size=self.fontSize),numpoints=1)

            axes.set_xlim(-0.1,1.05)
            axes.set_ylim(-0.1,1.05)
            self.dataCanvas.draw()

        except AttributeError:
            self.dataFigure.clf()
            dlg = wx.MessageDialog(None, _('No file(s) selected (checked).\n\n'), _('Oooops!'), wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            pass
コード例 #6
0
    def PlotFlinn(self, event): 

        #initialize the plot areas
        self.dataFigure.clf()
        axes = Subplot(self.dataFigure, 111, clip_on='True',xlim=(-0.2,7.2), ylim=(-0.2,7.2),autoscale_on='True',xlabel='ln(S2/S3)',ylabel='ln(S1/S2)',label='flinn',aspect='equal', adjustable='box',anchor='W')
        self.dataFigure.add_subplot(axes)
        axes.axis["right"].set_visible(False)
        axes.axis["top"].set_visible(False)

        try:
            # plot lines of K
            for i in [0.2, 0.5, 1.0, 2.0, 5.0]:
                if i <= 1.0:
                    diag = Line2D((0,7.0),(0,(i*7.0)),c='grey',lw=0.5)
                    axes.add_line(diag)
                else:
                    diag = Line2D((0,(7.0/i)),(0,7.0),c='grey',lw=0.5)
                    axes.add_line(diag)

            # plot lines of C
            for j in [2,4,6]:
                diag2 = Line2D((0,j),(j,0),c='grey',lw=0.5)
                axes.add_line(diag2)

            # texts
            axes.text(6.25,0.05,'K = 0',family='sans-serif',size=self.fontSize,horizontalalignment='left',color='grey')
            axes.text(0.15,6.1,'K = inf.',family='sans-serif',size=self.fontSize,horizontalalignment='left',color='grey',rotation='vertical')
            axes.text(6.45,6.4,'K = 1',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='45')
            axes.text(3.2,6.4,'K = 2',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='63.5')
            axes.text(1.2,6.4,'K = 5',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='78.7')
            axes.text(6.4,3.1,'K = 0.5',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='26.6')
            axes.text(6.5,1.3,'K = 0.2',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='11.3')
            axes.text(2.6,3.35,'C = 6',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='-45')
            axes.text(1.75,2.2,'C = 4',family='sans-serif',size=self.fontSize,horizontalalignment='center',color='grey',rotation='-45')

            axes.text(3.5,3.75,'Girdle/Cluster Transition',family='sans-serif',size=self.fontSize,horizontalalignment='left',verticalalignment='bottom',color='grey',rotation='45')
            axes.text(6.5,7.2,'CLUSTERS',family='sans-serif',size=self.fontSize,horizontalalignment='right',verticalalignment='bottom',color='grey')
            axes.text(7.2,6.5,'GIRDLES',family='sans-serif',size=self.fontSize,horizontalalignment='left',verticalalignment='top',color='grey',rotation='-90')


            # plot the selected (checked) files
            # propsPList = [pdata, itemName, PolColor, symbPoles, polespin,...
            # propsLList = [pdata, itemName, LinColor, LineSymb, linespin,...

            if len(self.idxPlan) == 0 and len(self.idxLin) == 0: # in case we have only one one opened file but it is not checked
                raise AttributeError
            else:
                for i in range(len(self.idxPlan)):
                    axes.plot(self.PeigenList[i]["K_x"],self.PeigenList[i]["K_y"], self.PProps[i]["PoleSymb"], c=self.PProps[i]["PolColor"], ms=self.PProps[i]["polespin"], label='%s n=%d' % (self.Pname[i],self.Pndata[i]))

                for j in range(len(self.idxLin)):
                    axes.plot(self.LeigenList[j]["K_x"],self.LeigenList[j]["K_y"], self.LProps[j]["LineSymb"], c=self.LProps[j]["LinColor"], ms=self.LProps[j]["linespin"], label='%s n=%d' % (self.Lname[j],self.Lndata[j]))

            axes.legend(bbox_to_anchor=(1.1, 1), loc=2, prop=FontProperties(size='small'),numpoints=1)

            #set the axes limits and draws the stuff
            axes.set_xlim(0.0,7.2)
            axes.set_ylim(0.0,7.2)
            self.dataCanvas.draw()

        except AttributeError:
            self.dataFigure.clf()
            dlg = wx.MessageDialog(None, 'No file(s) selected (checked).\n\n', 'Oooops!', wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            pass