Exemple #1
0
def tabular_figs02():
    fig=plt.figure()
    axes=[]
    for i in range(len(sigmas)):
        axes.append([])
        for j in range(len(nbins)):
            if sigmas[i]==0: iscatter=False
            else:            iscatter= True

            rst = main(
                ## main variables
                sigma=sigmas[i], psi_nbin=nbins[j],

                ## minor
                sin2psimx=0.5, iscatter=iscatter,
                iplot=False,dec_inv_frq=1,
                dec_interp=1)
            model_rs, flow_weight, flow_dsa = rst
            ax=fig.add_subplot(gs[i,j])
            ax.locator_params(nbins=4)
            axes[i].append(ax)

            # von mises
            lab1=r'$(\langle \sigma^c \rangle)^{VM}$'
            lab2=r'$(\sigma^\mathrm{RS})^{VM}$'
            ax.plot(flow_weight.epsilon_vm,
                    flow_weight.sigma_vm,'k-',label=lab1)
            ax.plot(flow_dsa.epsilon_vm,
                    flow_dsa.sigma_vm,'kx',label=lab2)

            if i==len(sigmas)-1 and j==0:
                #VM Deco
                axes_label.__vm__(ax=ax,ft=10)
            else:
                mpl_lib.rm_lab(ax,axis='x')
                mpl_lib.rm_lab(ax,axis='y')


    for iax in range(len(fig.axes)):
        fig.axes[iax].set_ylim(0,)
        fig.axes[iax].set_xlim(0,)
    tune_xy_lim(fig.axes)
    tune_x_lim(fig.axes,axis='y')



    ## annotations
    for j in range(len(nbins)):
        if j==0: s=r'$N^\psi$=%i'%nbins[j]
        else:
            s = '%i'%nbins[j]
        axes[0][j].annotate(
            s=s,horizontalalignment='center',
            size=14,xy=(0.5,1.2),
            xycoords='axes fraction')

    for i in range(len(sigmas)):
        if i==0:
            s=r'$s^\mathrm{CSE}$=%i'%(
                sigmas[i]*(10**6))
        elif i==len(sigmas)-1:
              s=r'%i $\mu$ strain'%(
                  sigmas[i]*(10**6))
        else: s='%i'%(sigmas[i]*(10**6))

        axes[i][-1].annotate(
            s=s,
            verticalalignment='center',
            horizontalalignment='center',
            rotation=270,
            size=14,xy=(1.20,0.5),
            xycoords='axes fraction')

    fancy_legend(
        fig.axes[0],size=11,nscat=1,ncol=1,
        bbox_to_anchor=(-0.4,1))

    # vm
    fig.axes[len(sigmas)*len(nbins)-len(nbins)].\
        set_xticks(np.arange(0.,1.01,0.5))
    fig.savefig('tab2.pdf')
    fig.savefig('tab2.png')
    fig.clf()
Exemple #2
0
def tabular_figs02():
    fig = plt.figure()
    axes = []
    for i in xrange(len(sigmas)):
        axes.append([])
        for j in xrange(len(nbins)):
            if sigmas[i] == 0: iscatter = False
            else: iscatter = True

            rst = main(
                ## main variables
                sigma=sigmas[i],
                psi_nbin=nbins[j],

                ## minor
                sin2psimx=0.5,
                iscatter=iscatter,
                iplot=False,
                dec_inv_frq=1,
                dec_interp=1)
            model_rs, flow_weight, flow_dsa = rst
            ax = fig.add_subplot(gs[i, j])
            ax.locator_params(nbins=4)
            axes[i].append(ax)

            # von mises
            lab1 = r'$(\langle \sigma^c \rangle)^{VM}$'
            lab2 = r'$(\sigma^\mathrm{RS})^{VM}$'
            ax.plot(flow_weight.epsilon_vm,
                    flow_weight.sigma_vm,
                    'k-',
                    label=lab1)
            ax.plot(flow_dsa.epsilon_vm, flow_dsa.sigma_vm, 'kx', label=lab2)

            if i == len(sigmas) - 1 and j == 0:
                #VM Deco
                axes_label.__vm__(ax=ax, ft=10)
            else:
                mpl_lib.rm_lab(ax, axis='x')
                mpl_lib.rm_lab(ax, axis='y')

    for iax in xrange(len(fig.axes)):
        fig.axes[iax].set_ylim(0, )
        fig.axes[iax].set_xlim(0, )
    tune_xy_lim(fig.axes)
    tune_x_lim(fig.axes, axis='y')

    ## annotations
    for j in xrange(len(nbins)):
        if j == 0: s = r'$N^\psi$=%i' % nbins[j]
        else:
            s = '%i' % nbins[j]
        axes[0][j].annotate(s=s,
                            horizontalalignment='center',
                            size=14,
                            xy=(0.5, 1.2),
                            xycoords='axes fraction')

    for i in xrange(len(sigmas)):
        if i == 0:
            s = r'$s^\mathrm{CSE}$=%i' % (sigmas[i] * (10**6))
        elif i == len(sigmas) - 1:
            s = r'%i $\mu$ strain' % (sigmas[i] * (10**6))
        else:
            s = '%i' % (sigmas[i] * (10**6))

        axes[i][-1].annotate(s=s,
                             verticalalignment='center',
                             horizontalalignment='center',
                             rotation=270,
                             size=14,
                             xy=(1.20, 0.5),
                             xycoords='axes fraction')

    fancy_legend(fig.axes[0],
                 size=11,
                 nscat=1,
                 ncol=1,
                 bbox_to_anchor=(-0.4, 1))

    # vm
    fig.axes[len(sigmas)*len(nbins)-len(nbins)].\
        set_xticks(np.arange(0.,1.01,0.5))
    fig.savefig('tab2.pdf')
    fig.savefig('tab2.png')
    fig.clf()
Exemple #3
0
def tabular_figs01():
    """
    Ehkl vs sin2psi plot

    y (sigmas)
    x (nbins)
    """
    fig=plt.figure()
    axes=[]
    for i in range(len(sigmas)):
        axes.append([])
        for j in range(len(nbins)):
            ax=fig.add_subplot(gs[i,j])
            axes[i].append(ax)
            ax.locator_params(nbins=4);
            if sigmas[i]==0: iscatter=False
            else:            iscatter= True
            rst = main(
                ## main variables
                sigma=sigmas[i], psi_nbin=nbins[j],

                ## minor
                sin2psimx=0.5, iscatter=iscatter,
                istep=2,iplot=False,dec_inv_frq=1,
                dec_interp=1)

            model_rs, sig11, sig22, dsa11,dsa22,\
                raw_psis,raw_vfs, raw_sfs,\
                full_Ei,dec_intp  = rst

            # raise IOError
            x = sin2psi_opt(model_rs.psis, 1)
            ax.plot(
                x, model_rs.tdat[0]*1e6,'k.',
                label=\
                r'$\tilde{ \langle\varepsilon^e \rangle}^G$')
            ax.plot(
                x, model_rs.Ei[0]*1e6,'kx',
                label=\
                r'$\mathbb{F}_{ij} \sigma^\mathrm{RS}_{ij}$')

            x = sin2psi_opt(raw_psis, 1)
            # ax.plot(x, full_Ei[0]*1e6,'k-') ## continuous Ei
            ## ax.plot(raw_psis, dec_intp[0][0]*1e6,'k--')

            ## True Ei? = F_ij * <sigma>^c_{ij}

            model_rs.psis = raw_psis.copy()
            model_rs.npsi = len(model_rs.psis)
            model_rs.cffs = raw_sfs.copy()
            ## plug the weight average stress
            model_rs.sigma=[sig11, sig22, 0, 0, 0, 0]
            model_rs.calc_Ei()
            ax.plot(
                x,model_rs.Ei[0]*1e6,'k-',
                label=r'$\mathbb{F}_{ij} \langle\sigma\rangle^c_{ij}$'
            )

            if i==len(sigmas)-1 and j==0:
                deco(ax=ax,iopt=0,hkl=None,ipsi_opt=1)
            else:
                mpl_lib.rm_lab(ax,axis='x')
                mpl_lib.rm_lab(ax,axis='y')

    for j in range(len(nbins)):
        if j==0: s=r'$N^\psi$=%i'%nbins[j]
        else:
            s = '%i'%nbins[j]
        axes[0][j].annotate(
            s=s,horizontalalignment='center',
            size=14,xy=(0.5,1.2),
            xycoords='axes fraction')

    for i in range(len(sigmas)):
        if i==0:
            s=r'$s^\mathrm{CSE}$=%i'%(
                sigmas[i]*(10**6))
        elif i==len(sigmas)-1:
              s=r'%i $\mu$ strain'%(
                  sigmas[i]*(10**6))
        else: s='%i'%(sigmas[i]*(10**6))

        axes[i][-1].annotate(
            s=s,
            verticalalignment='center',
            horizontalalignment='center',
            rotation=270,
            size=14,xy=(1.20,0.5),
            xycoords='axes fraction')

    for iax in range(len(fig.axes)):
        fig.axes[iax].set_ylim(-1500,)
    tune_xy_lim(fig.axes)
    tune_x_lim(fig.axes,axis='y')

    # plt.annotate(s=r'$\varepsilon^\mathrm{CSE}$ Counting Statistics Error',
    #              size=20,rotation=90,
    #              verticalalignment='center',
    #              horizontalalignment='center',
    #              xy=(1.01,0.5),
    #              xycoords='figure fraction')

    # plt.annotate(s=r'Number of $\psi$',size=20,
    #              horizontalalignment='center',
    #              xy=(0.6,0.93),
    #              xycoords='figure fraction')


    fig.axes[len(sigmas)*len(nbins)-len(nbins)].\
        set_xticks(np.arange(-0.5,0.501,0.5))

    fancy_legend(
        fig.axes[0],size=11,nscat=1,ncol=1,
        bbox_to_anchor=(-0.4,1))
    fig.savefig('tab.pdf')
    fig.savefig('tab.png')
    fig.clf()
Exemple #4
0
def tabular_figs01():
    """
    Ehkl vs sin2psi plot

    y (sigmas)
    x (nbins)
    """
    fig = plt.figure()
    axes = []
    for i in xrange(len(sigmas)):
        axes.append([])
        for j in xrange(len(nbins)):
            ax = fig.add_subplot(gs[i, j])
            axes[i].append(ax)
            ax.locator_params(nbins=4)
            if sigmas[i] == 0: iscatter = False
            else: iscatter = True
            rst = main(
                ## main variables
                sigma=sigmas[i],
                psi_nbin=nbins[j],

                ## minor
                sin2psimx=0.5,
                iscatter=iscatter,
                istep=2,
                iplot=False,
                dec_inv_frq=1,
                dec_interp=1)

            model_rs, sig11, sig22, dsa11,dsa22,\
                raw_psis,raw_vfs, raw_sfs,\
                full_Ei,dec_intp  = rst

            # raise IOError
            x = sin2psi_opt(model_rs.psis, 1)
            ax.plot(
                x, model_rs.tdat[0]*1e6,'k.',
                label=\
                r'$\tilde{ \langle\varepsilon^e \rangle}^G$')
            ax.plot(
                x, model_rs.Ei[0]*1e6,'kx',
                label=\
                r'$\mathbb{F}_{ij} \sigma^\mathrm{RS}_{ij}$')

            x = sin2psi_opt(raw_psis, 1)
            # ax.plot(x, full_Ei[0]*1e6,'k-') ## continuous Ei
            ## ax.plot(raw_psis, dec_intp[0][0]*1e6,'k--')

            ## True Ei? = F_ij * <sigma>^c_{ij}

            model_rs.psis = raw_psis.copy()
            model_rs.npsi = len(model_rs.psis)
            model_rs.cffs = raw_sfs.copy()
            ## plug the weight average stress
            model_rs.sigma = [sig11, sig22, 0, 0, 0, 0]
            model_rs.calc_Ei()
            ax.plot(x,
                    model_rs.Ei[0] * 1e6,
                    'k-',
                    label=r'$\mathbb{F}_{ij} \langle\sigma\rangle^c_{ij}$')

            if i == len(sigmas) - 1 and j == 0:
                deco(ax=ax, iopt=0, hkl=None, ipsi_opt=1)
            else:
                mpl_lib.rm_lab(ax, axis='x')
                mpl_lib.rm_lab(ax, axis='y')

    for j in xrange(len(nbins)):
        if j == 0: s = r'$N^\psi$=%i' % nbins[j]
        else:
            s = '%i' % nbins[j]
        axes[0][j].annotate(s=s,
                            horizontalalignment='center',
                            size=14,
                            xy=(0.5, 1.2),
                            xycoords='axes fraction')

    for i in xrange(len(sigmas)):
        if i == 0:
            s = r'$s^\mathrm{CSE}$=%i' % (sigmas[i] * (10**6))
        elif i == len(sigmas) - 1:
            s = r'%i $\mu$ strain' % (sigmas[i] * (10**6))
        else:
            s = '%i' % (sigmas[i] * (10**6))

        axes[i][-1].annotate(s=s,
                             verticalalignment='center',
                             horizontalalignment='center',
                             rotation=270,
                             size=14,
                             xy=(1.20, 0.5),
                             xycoords='axes fraction')

    for iax in xrange(len(fig.axes)):
        fig.axes[iax].set_ylim(-1500, )
    tune_xy_lim(fig.axes)
    tune_x_lim(fig.axes, axis='y')

    # plt.annotate(s=r'$\varepsilon^\mathrm{CSE}$ Counting Statistics Error',
    #              size=20,rotation=90,
    #              verticalalignment='center',
    #              horizontalalignment='center',
    #              xy=(1.01,0.5),
    #              xycoords='figure fraction')

    # plt.annotate(s=r'Number of $\psi$',size=20,
    #              horizontalalignment='center',
    #              xy=(0.6,0.93),
    #              xycoords='figure fraction')


    fig.axes[len(sigmas)*len(nbins)-len(nbins)].\
        set_xticks(np.arange(-0.5,0.501,0.5))

    fancy_legend(fig.axes[0],
                 size=11,
                 nscat=1,
                 ncol=1,
                 bbox_to_anchor=(-0.4, 1))
    fig.savefig('tab.pdf')
    fig.savefig('tab.png')
    fig.clf()