Esempio n. 1
0
def plotComponentStress(r, sigmaR, sigmaTheta, sigmaZ,
                        sigmaEq, filename, i, loc):
    a = r[0,0]; b = r[0,-1]
    trX = Q_(1, 'inch').to('mm').magnitude
    trY = Q_(1, 'ksi').to('MPa').magnitude
    trans = mtransforms.Affine2D().scale(trX,trY)
    fig = plt.figure(figsize=(4, 3.5))
    ax = SubplotHost(fig, 1, 1, 1)
    axa = ax.twin(trans)
    axa.set_viewlim_mode("transform")
    axa.axis["top"].set_label(r'\textsc{radius}, $r$ (in.)')
    axa.axis["top"].label.set_visible(True)
    axa.axis["right"].set_label(r'\textsc{stress component}, $\sigma$ (ksi)')
    axa.axis["right"].label.set_visible(True)
    ax = fig.add_subplot(ax)
    ax.plot(r[i,:]*1e3, sigmaR[i,:]*1e-6, '^-',
            label='$\sigma_r$')
    ax.plot(r[i,:]*1e3, sigmaTheta[i,:]*1e-6, 'o-',
            label=r'$\sigma_\theta$')
    ax.plot(r[i,:]*1e3, sigmaZ[i,:]*1e-6, 'v-',
            label='$\sigma_z$')
    ax.plot(r[i,:]*1e3, sigmaEq[i,:]*1e-6, 's-',
            label='$\sigma_\mathrm{eq}$')
    ax.set_xlabel(r'\textsc{radius}, $r$ (mm)')
    ax.set_xlim((a*1e3)-0.1,(b*1e3)+0.1)
    ax.set_ylabel(r'\textsc{stress component}, $\sigma$ (MPa)')
    ax.legend(loc=loc)
    #labels = ax.get_xticklabels()
    #plt.setp(labels, rotation=30)
    fig.tight_layout()
    fig.savefig(filename, transparent=True)
    plt.close(fig)
Esempio n. 2
0
def diffusion1D(length_microns, log10D_m2s, time_seconds, init=1., fin=0.,
                erf_or_sum='erf', show_plot=True, 
                style=styles.style_blue, infinity=100, points=100, 
                centered=True, axes=None, symmetric=True,
                maximum_value=1.):
    """
    Simplest implementation for 1D diffusion.
    
    Takes required inputs length, diffusivity, and time 
    and plots diffusion curve on new or specified figure. 
    Optional inputs are unit initial value and final values. 
    Defaults assume diffusion out, so init=1. and fin=0. 
    Reverse these for diffusion in.
    
    Change scale of y-values with maximum_value keyword.
    
    Returns figure, axis, x vector in microns, and model y data.
    """    
    if symmetric is True:
        params = params_setup1D(length_microns, log10D_m2s, time_seconds,
                                init=init, fin=fin)
        x_diffusion, y_diffusion = diffusion1D_params(params, points=points)
        if centered is False:
            a_length = (max(x_diffusion) - min(x_diffusion)) / 2
            x_diffusion = x_diffusion + a_length
    else:
        # multiply length by two
        params = params_setup1D(length_microns*2, log10D_m2s, time_seconds,
                                init=init, fin=fin)
        x_diffusion, y_diffusion = diffusion1D_params(params, points=points)        

        # divide elongated profile in half
        x_diffusion = x_diffusion[int(points/2):]
        y_diffusion = y_diffusion[int(points/2):]
        if centered is True:
            a_length = (max(x_diffusion) - min(x_diffusion)) / 2
            x_diffusion = x_diffusion - a_length 

    if show_plot is True:
        if axes is None:
            fig = plt.figure()          
            ax  = SubplotHost(fig, 1,1,1)
            ax.grid()
            ax.set_ylim(0, maximum_value)
            ax.set_xlabel('position ($\mu$m)')
            ax.set_xlim(min(x_diffusion), max(x_diffusion))
            ax.plot(x_diffusion, y_diffusion*maximum_value, **style)
            ax.set_ylabel('Unit concentration or final/initial')
            fig.add_subplot(ax)
        else:
            axes.plot(x_diffusion, y_diffusion*maximum_value, **style)
            fig = None
            ax = None            
    else:
        fig = None
        ax = None
    
    return fig, ax, x_diffusion, y_diffusion
Esempio n. 3
0
def plotNACA(r, sigma, fea, i, filename, loc, ylabel):
    a = r[0,0]; b = r[0,-1]
    trX = Q_(1, 'inch').to('mm').magnitude
    trY = Q_(1, 'ksi').to('MPa').magnitude
    trans = mtransforms.Affine2D().scale(trX,trY)
    fig = plt.figure(figsize=(4, 3.5))
    ax = SubplotHost(fig, 1, 1, 1)
    axa = ax.twin(trans)
    axa.set_viewlim_mode("transform")
    axa.axis["top"].set_label(r'\textsc{radius}, $r$ (in.)')
    axa.axis["top"].label.set_visible(True)
    axa.axis["right"].set_label(ylabel+' (ksi)')
    axa.axis["right"].label.set_visible(True)
    ax = fig.add_subplot(ax)
    ax.plot(r[0,:]*1e3, sigma[0,:]*1e-6, '-',
            color='C0',label=r'$\theta=0^\circ$')
    ax.plot((a+fea[0][:,0])*1e3, fea[0][:,i]*1e-6, 'o',
            color='C0', markevery=1)
    ax.plot(r[0,:]*1e3, sigma[20,:]*1e-6, '-',
            color='C1', label=r'$\theta=60^\circ$')
    ax.plot((a+fea[1][:,0])*1e3, fea[1][:,i]*1e-6, '^',
            color='C1', markevery=1)
    ax.plot(r[0,:]*1e3, sigma[40,:]*1e-6, '-',
            color='C2', label=r'$\theta=120^\circ$')
    ax.plot((a+fea[2][:,0])*1e3, fea[2][:,i]*1e-6, 'v',
            color='C2', markevery=1)
    ax.plot(r[0,:]*1e3, sigma[60,:]*1e-6, '-',
            color='C3', label=r'$\theta=180^\circ$')
    ax.plot((a+fea[3][:,0])*1e3, fea[3][:,i]*1e-6, 's',
            color='C3', markevery=1)
    ax.set_xlabel(r'\textsc{radius}, $r$ (mm)')
    ax.set_xlim((a*1e3)-10,(b*1e3)+10)
    ax.set_ylabel(ylabel+' (MPa)')
    #ax.set_ylim(-400, 400)
    c0line = Line2D([], [], color='C0', marker='o',
                   label=r'$\theta=0^\circ$')
    c1line = Line2D([], [], color='C1', marker='^',
                   label=r'$\theta=60^\circ$')
    c2line = Line2D([], [], color='C2', marker='v',
                   label=r'$\theta=120^\circ$')
    c3line = Line2D([], [], color='C3', marker='s',
                   label=r'$\theta=180^\circ$')
    handles=[c0line, c1line, c2line, c3line]
    labels = [h.get_label() for h in handles]
    ax.legend([handle for i,handle in enumerate(handles)],
              [label for i,label in enumerate(labels)], loc=loc)
    fig.tight_layout()
    fig.savefig(filename, transparent=True)
    plt.close(fig)
Esempio n. 4
0
def Arrhenius_outline(xlow=6., xhigh=11., ybottom=-18., ytop=-8.,
                      celsius_labels = np.arange(0, 2000, 100),
                      shrink_axes_to_fit_legend_by = 0.3, make_legend=False,
                      lower_legend_by=-2., ncol=2):
    """
    Make Arrhenius diagram outline. 
    
    Returns figure, axis, legend handle.
    
    low, high, top, and bottom set the x and y axis limits. 

    celsius_labels sets where to make the temperature tick marks.
    
    If you have issues with the legend position or overlap with main diagram,
    play with the numbers for shrink_legend_by and lower_legend_by
    
    ncol sets the number of columns in the legend.
    """
    fig = plt.figure()
    ax = SubplotHost(fig, 1,1,1)
    ax_celsius = ax.twin()
    parasite_tick_locations = 1e4/(celsius_labels + 273.15)
    ax_celsius.set_xticks(parasite_tick_locations)
    ax_celsius.set_xticklabels(celsius_labels)
    fig.add_subplot(ax)
    ax.axis["bottom"].set_label("10$^4$/Temperature (K$^{-1}$)")
    ax.axis["left"].set_label("log$_{10}$diffusivity (m$^{2}$/s)")
    ax_celsius.axis["top"].set_label("Temperature ($\degree$C)")
    ax_celsius.axis["top"].label.set_visible(True)
    ax_celsius.axis["right"].major_ticklabels.set_visible(False)
    ax.set_xlim(xlow, xhigh)
    ax.set_ylim(ybottom, ytop)
    ax.grid()
    
    # main legend below
    if make_legend is True:
        legend_handles_main = []
        box = ax.get_position()
        ax.set_position([box.x0, box.y0 + box.height*shrink_axes_to_fit_legend_by, 
                         box.width, box.height*(1.0-shrink_axes_to_fit_legend_by)])
        main_legend = plt.legend(handles=legend_handles_main, numpoints=1, 
                                 ncol=ncol, 
                                 bbox_to_anchor=(xlow, ybottom, xhigh-xlow, 
                                                 lower_legend_by),
                                 bbox_transform=ax.transData, mode='expand')
        plt.gca().add_artist(main_legend)
    else:
        legend_handles_main = None
    return fig, ax, legend_handles_main
Esempio n. 5
0
def plot_diffusion1D(x_microns,
                     model,
                     initial_value=None,
                     fighandle=None,
                     axishandle=None,
                     top=1.2,
                     style=None,
                     fitting=False,
                     show_km_scale=False,
                     show_initial=True):
    """Takes x and y diffusion data and plots 1D diffusion profile input"""
    a_microns = (max(x_microns) - min(x_microns)) / 2.
    a_meters = a_microns / 1e3

    if fighandle is None and axishandle is not None:
        print 'Remember to pass in handles for both figure and axis'
    if fighandle is None or axishandle is None:
        fig = plt.figure()
        ax = SubplotHost(fig, 1, 1, 1)
        ax.grid()
        ax.set_ylim(0, top)
    else:
        fig = fighandle
        ax = axishandle

    if style is None:
        if fitting is True:
            style = {'linestyle': 'none', 'marker': 'o'}
        else:
            style = styles.style_lightgreen

    if show_km_scale is True:
        ax.set_xlabel('Distance (km)')
        ax.set_xlim(0., 2. * a_meters / 1e3)
        x_km = x_microns / 1e6
        ax.plot((x_km) + a_meters / 1e3, model, **style)
    else:
        ax.set_xlabel('position ($\mu$m)')
        ax.set_xlim(-a_microns, a_microns)
        ax.plot(x_microns, model, **style)

    if initial_value is not None and show_initial is True:
        ax.plot(ax.get_xlim(), [initial_value, initial_value], '--k')

    ax.set_ylabel('Unit concentration or final/initial')
    fig.add_subplot(ax)

    return fig, ax
def plotTIMO(r, s, feaCmp, feaEq, filename):
    a = r[0,0]; b = r[0,-1]
    trX = Q_(1, 'inch').to('mm').magnitude
    trY = Q_(1, 'ksi').to('MPa').magnitude
    trans = mtransforms.Affine2D().scale(trX,trY)
    fig = plt.figure(figsize=(4, 3.5))
    ax = SubplotHost(fig, 1, 1, 1)
    axa = ax.twin(trans)
    axa.set_viewlim_mode("transform")
    axa.axis["top"].set_label(r'\textsc{radius}, $r$ (in.)')
    axa.axis["top"].label.set_visible(True)
    axa.axis["right"].set_label(r'\textsc{stress component}, $\sigma$ (ksi)')
    axa.axis["right"].label.set_visible(True)
    ax = fig.add_subplot(ax)
    ax.plot(r[0,:]*1e3, s.sigmaTheta[0,:]*1e-6, '-', color='C0')
    ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,4]*1e-6, 'o', color='C0')
    ax.plot(r[0,:]*1e3, s.sigmaR[0,:]*1e-6, '-', color='C1')
    ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,5]*1e-6, '^', color='C1')
    ax.plot(r[0,:]*1e3, s.sigmaZ[0,:]*1e-6, '-', color='C2')
    ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,6]*1e-6, 'v', color='C2')
    ax.plot(r[0,:]*1e3, s.sigmaEq[0,:]*1e-6, '-', color='C3')
    ax.plot((a+feaEq[:,0])*1e3, feaEq[:,1]*1e-6, 's', color='C3')
    ax.plot(r[0,:]*1e3, s.sigmaRTheta[0,:]*1e-6, '-', color='C4')
    ax.plot((a+feaCmp[:,0])*1e3, feaCmp[:,7]*1e-6, '+', color='C4')
    ax.set_xlabel(r'\textsc{radius}, $r$ (mm)')
    ax.set_xlim((a*1e3)-10,(b*1e3)+10)
    ax.set_ylabel(r'\textsc{stress component}, $\sigma$ (MPa)')
    #ax.set_ylim(-400, 400)
    c0line = Line2D([], [], color='C0', marker='o',
                    label=r'$\sigma_\theta$')
    c1line = Line2D([], [], color='C1', marker='^',
                    label=r'$\sigma_r$')
    c2line = Line2D([], [], color='C2', marker='v',
                    label=r'$\sigma_z$')
    c3line = Line2D([], [], color='C3', marker='s',
                    label=r'$\sigma_\mathrm{eq}$')
    c4line = Line2D([], [], color='C4', marker='+',
                    label=r'$\tau_{r\theta}$')
    handles=[c0line, c1line, c2line, c4line, c3line]
    labels = [h.get_label() for h in handles]
    ax.legend([handle for i,handle in enumerate(handles)],
              [label for i,label in enumerate(labels)], loc='best')
    fig.tight_layout()
    fig.savefig(filename, transparent=True)
    plt.close(fig)
Esempio n. 7
0
def Arrhenius_outline(low=6.,
                      high=11.,
                      bottom=-18.,
                      top=-8.,
                      celsius_labels=np.arange(0, 2000, 100),
                      figsize_inches=(6, 4),
                      shrinker_for_legend=0.3,
                      generic_legend=True,
                      sunk=-2.,
                      ncol=2):
    """Make Arrhenius diagram outline. Returns figure, axis, legend handle"""
    fig = plt.figure(figsize=figsize_inches)
    ax = SubplotHost(fig, 1, 1, 1)
    ax_celsius = ax.twin()
    parasite_tick_locations = 1e4 / (celsius_labels + 273.15)
    ax_celsius.set_xticks(parasite_tick_locations)
    ax_celsius.set_xticklabels(celsius_labels)
    fig.add_subplot(ax)
    ax.axis["bottom"].set_label("10$^4$/Temperature (K$^{-1}$)")
    ax.axis["left"].set_label("log$_{10}$diffusivity (m$^{2}$/s)")
    ax_celsius.axis["top"].set_label("Temperature ($\degree$C)")
    ax_celsius.axis["top"].label.set_visible(True)
    ax_celsius.axis["right"].major_ticklabels.set_visible(False)
    ax.set_xlim(low, high)
    ax.set_ylim(bottom, top)
    ax.grid()

    # main legend below
    legend_handles_main = []
    box = ax.get_position()
    ax.set_position([
        box.x0, box.y0 + box.height * shrinker_for_legend, box.width,
        box.height * (1.0 - shrinker_for_legend)
    ])
    main_legend = plt.legend(handles=legend_handles_main,
                             numpoints=1,
                             ncol=ncol,
                             bbox_to_anchor=(low, bottom, high - low, sunk),
                             bbox_transform=ax.transData,
                             mode='expand')
    plt.gca().add_artist(main_legend)
    return fig, ax, legend_handles_main
Esempio n. 8
0
ax_kms = SubplotHost(fig, 1, 1, 1, aspect=1.)

# angular proper motion("/yr) to linear velocity(km/s) at distance=2.3kpc
pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5

aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.)
ax_pm = ax_kms.twin(aux_trans)
ax_pm.set_viewlim_mode("transform")

fig.add_subplot(ax_kms)

for n, ds, dse, w, we in obs:
    time = ((2007 + (10. + 4/30.)/12) - 1988.5)
    v = ds / time * pm_to_kms
    ve = dse / time * pm_to_kms
    ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k")


ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]")
ax_kms.axis["left"].set_label("FWHM [km/s]")
ax_pm.axis["top"].set_label(r"Proper Motion [$''$/yr]")
ax_pm.axis["top"].label.set_visible(True)
ax_pm.axis["right"].major_ticklabels.set_visible(False)

ax_kms.set_xlim(950, 3700)
ax_kms.set_ylim(950, 3100)
# xlim and ylim of ax_pms will be automatically adjusted.

plt.show()
ax.set_ylim(-12.5, -10.5)
ax_Al = ax.twin()

#Al_labels = list(np.arange(0.0, 0.1, 0.02)) + list(np.arange(0.1, 0.9, 0.1))
Al_labels = [0.01, 0.02, 0.05, 0.1, 0.2]
parasite_tick_locations = np.log10(Al_labels)
ax_Al.set_xticks(parasite_tick_locations)
ax_Al.set_xticklabels(Al_labels)

ax_Al.axis["top"].set_label("IV-Al (a.p.f.u.)")
ax_Al.axis["top"].label.set_visible(True)
ax_Al.axis["right"].major_ticklabels.set_visible(False)
ax.set_ylabel('log$_{10}$ diffusivity$_{H}$ $(m^{-2}/s)$ at 800 $\degree$C')
ax.set_xlabel('log$_{10}$ IV-Al (a.p.f.u.)')
#ax.set_xlim(-2.0, -0.4) 
ax.set_xlim(-1.7, -0.5) 

Names = ['Jaipur diopside\n(|| a, c*)',
         unicode('N\374shan cpx', 'latin-1'),
         'augite PMR-53',
         'Fuego\nphenocryst',
         'Jaipur diopside\n(|| b)',
         ]

# original convention from normalization spreadsheet from SERC website
# http://serc.carleton.edu/research_education/equilibria/mineralformulaerecalculation.html
Al = np.array([
               0.016, # Jaipur
               0.204, # Nushan
               0.026, # PMR-53
               0.133, # Fuego
Esempio n. 10
0
def make_3DWB_water_profile(final_profile,
                            water_ppmH2O_initial=None,
                            initial_profile=None,
                            initial_area_list=None,
                            initial_area_positions_microns=None,
                            show_plot=True,
                            top=1.2,
                            fig_ax=None):
    """Take a profile and initial water content.
    Returns the whole-block water concentration profile based on
    the profile's attribute wb_areas. If wb_areas have not been made, 
    some initial profile information and various options are passed
    to make_3DWB_area_profile().
    Default makes a plot showing A/Ao and water on parasite y-axis
    """
    fin = final_profile
    init = initial_profile

    # Set initial water
    if water_ppmH2O_initial is not None:
        w0 = water_ppmH2O_initial
    else:
        if fin.sample is not None:
            if fin.sample.initial_water is not None:
                w0 = fin.sample.initial_water
        elif init is not None:
            if init.sample is not None:
                if init.sample.initial_water is not None:
                    w0 = init.sample.initial_water
        else:
            print 'Need initial water content.'
            return False

    # Set whole-block areas
    if (fin.wb_areas is not None) and (len(fin.wb_areas) > 0):
        wb_areas = fin.wb_areas
    else:
        wb_areas = make_3DWB_area_profile(fin, initial_profile,
                                          initial_area_list,
                                          initial_area_positions_microns)
    water = wb_areas * w0
    if show_plot is True:
        # Use a parasite y-axis to show water content
        fig = plt.figure()
        ax_areas = SubplotHost(fig, 1, 1, 1)
        fig.add_subplot(ax_areas)
        area_tick_marks = np.arange(0, 100, 0.2)
        ax_areas.set_yticks(area_tick_marks)
        ax_water = ax_areas.twin()
        ax_water.set_yticks(area_tick_marks)
        if isinstance(w0, uncertainties.Variable):
            ax_water.set_yticklabels(area_tick_marks * w0.n)
        else:
            ax_water.set_yticklabels(area_tick_marks * w0)
        ax_areas.axis["bottom"].set_label('Position ($\mu$m)')
        ax_areas.axis["left"].set_label('Final area / Initial area')
        ax_water.axis["right"].set_label('ppm H$_2$O')
        ax_water.axis["top"].major_ticklabels.set_visible(False)
        ax_water.axis["right"].major_ticklabels.set_visible(True)
        ax_areas.grid()
        ax_areas.set_ylim(0, 1.2)
        if fin.len_microns is not None:
            leng = fin.len_microns
        else:
            leng = fin.set_len()
        ax_areas.set_xlim(-leng / 2.0, leng / 2.0)

        style = fin.choose_marker_style()
        ax_areas.plot([-leng / 2.0, leng / 2.0], [1, 1], **style_1)
        ax_areas.plot(fin.positions_microns - leng / 2.0, wb_areas, **style)
        return water, fig, ax_areas
    else:
        return water
Esempio n. 11
0
        if (dts[index2] <= 0.005):
           continue
        ax2_eV.plot(base_potentials, NumericalHeating[:, index1, index2],
                    colors_and_symbols.symb_col(c),
                    label = r"" + str(dts[index2]) + " as")
                    #label = r"$\Delta t$ = " + str(dts[index2]) + " as (" + potential_shapes[j] + ")")
        # When the NumericalHeating is negative, we have cooling, which would not appear on the log scale plot.
        cooling_indices = np.where(NumericalHeating[:, index1, index2] <= 0.0)
        if (len(cooling_indices[0]) >= 1):
            ax2_eV.plot(base_potentials[cooling_indices], abs(NumericalHeating[:, index1, index2][cooling_indices]),
                        '.' + colors_and_symbols.symb_col(c))
        c += 1


ax1_eV.set_xlabel(r"$\Delta t$ [as]")
ax1_eV.set_xlim((dts[0], dts[-1]))
plt.setp(ax1_Eh.get_xticklabels(), visible=False)

ax2_eV.set_xlabel("Potential depth [Hartree]")
ax2_eV.set_xlim((base_potentials[0], base_potentials[-1]))

for ax in [ax1_eV, ax2_eV]:
    leg = ax.legend(loc = "best")
    leg.get_frame().set_alpha(0.75)
    ax.grid(True)
    ax.set_ylabel("Energy change [eV]")
    ax.set_xscale('log')
    ax.set_yscale('log')

for ax in [ax1_Eh, ax2_Eh]:
    ax.set_xscale('log')
Esempio n. 12
0
        ax1.annotate('${0:g}$'.format(youngs[i]*1e-9), \
                     xy=(stressSod[i], 36), \
                     xycoords='data', horizontalalignment=alignRev[i],
                     fontsize=fs)

    #ax1.set_title('\\textbf{(b)} Molten salt')
    ax1.set_ylim(0, 40)
    ax1.set_yticks([5, 15, 25, 35])
    ax1.set_yticklabels(
        ['$\\mathrm{DN}$\n\small{(-)}',
         '$\\lambda$\n\small{(\si{\watt\per\meter\per\kelvin})}',
         '$\\alpha$\n\small{(\SI{e-6}{\per\kelvin})}',
         '$E$\n\small{(GPa)}'], fontsize='large'
    )

    ax1.set_xlim(150, 450)
    ax1.set_xlabel(r'\textsc{max. equiv. stress}, '+\
                   '$\max\sigma_\mathrm{Eq}$ (MPa)')
    fig1.tight_layout()
    #plt.show()
    fig1.savefig('S31609_sensitivityTubeProperties.pdf',
                 transparent=True)
    plt.close(fig1)

    headerprint(' Fluid flow parameter variation ')

    fig2 = plt.figure(figsize=(5, 2.5))
    ax2 = SubplotHost(fig2, 1, 1, 1)
    ax2a = ax2.twin(trans)
    ax2a.set_viewlim_mode("transform")
    ax2a.axis["top"].set_label(r'\textsc{max. equiv. stress}, '+\
Esempio n. 13
0
    def inverted(self):
        return WN2MicronTransform()


aux_trans = mtransforms.BlendedGenericTransform(
    WN2MicronTransform(), mtransforms.IdentityTransform())

fig = plt.figure(1)

name = ['Tetracene', 'Chrysene', 'Pyrene']

for n in range(1, 4, 1):
    ax_wn = SubplotHost(fig, 1, 3, n)

    fig.add_subplot(ax_wn)
    ax_wn.set_xlim(700, 1700)
    x_wn = np.array([800, 1000, 1200, 1400, 1600])
    ax_wn.tick_params(axis='x',
                      direction='in',
                      labelsize=11,
                      labelbottom=False,
                      labeltop=True,
                      top=True,
                      bottom=False)
    ax_wn.tick_params(axis='y', left=False, labelleft=False)
    ax_wn.set_xticks(x_wn)

    ax_mn = ax_wn.twin(aux_trans)
    ax_mn.set_viewlim_mode("transform")
    #	x_micron=np.array([12, 10, 8, 6])
    #	ax_mn.set_xticks(x_micron)
Esempio n. 14
0
    arrow_Kii = arrow(name="K_ino_inf", start=start, length=impe_K_inf_ion, is_energy=True)
    arrow_Kii.Plot(ax3_Eh, x=-2.0 * Ip_dr, color="b", label="$K_{e,ion\ \infty}$", horizontalalignment="left")
    ax3_Eh.axhline(arrow_Kii.stop, linestyle="--", color="b", label="K w.r.t. parent ion at infinity")

    # K_threshold
    arrow_Kt = arrow(name="K_threshold", start=start, length=K_thres, is_energy=True)
    arrow_Kt.Plot(ax3_Eh, x=-3.0 * Ip_dr, color="r", label="$K_{threshold}$", horizontalalignment="left")
    ax3_Eh.axhline(arrow_Kt.stop, linestyle="--", color="r", label="K w.r.t. threshold ($V_b$)")

    # Can it ionize?
    ax3_Eh.set_title(r"Can ionize: " + can_ionize_yes_no)

    ax3_Eh.set_ylabel("Hartree")
    ax3_eV.set_ylabel("eV")

    ax3_Eh.set_xlim((-0.2, 0.4))
    ax3_Eh.set_ylim((-0.5, 1.1 * max(arrow_Ip.stop, arrow_K.stop)))
    leg = ax3_Eh.legend(loc="best")
    leg.get_frame().set_alpha(0.4)

# ******************************************************************************
# Set plot properties
# ******************************************************************************

# Default the xlim be r[0] and r[-1]
if plot_V:
    ax_V_Eh.set_xlim((r[0], r[-1]))
if plot_U:
    ax_U_Eh.set_xlim((r[0], r[-1]))

# Make sure the ions' label are visible
Esempio n. 15
0
fig.add_subplot(ax)
ax.set_ylim(-12.5, -10.5)
ax_Al = ax.twin()

#Al_labels = list(np.arange(0.0, 0.1, 0.02)) + list(np.arange(0.1, 0.9, 0.1))
Al_labels = [0.01, 0.02, 0.05, 0.1, 0.2]
parasite_tick_locations = np.log10(Al_labels)
ax_Al.set_xticks(parasite_tick_locations)
ax_Al.set_xticklabels(Al_labels)

ax_Al.axis["top"].set_label("IV-Al (a.p.f.u.)")
ax_Al.axis["top"].label.set_visible(True)
ax_Al.axis["right"].major_ticklabels.set_visible(False)
ax.set_ylabel('log$_{10}$ diffusivity$_{H}$ $(m^2/s)$ at 800 $\degree$C')
ax.set_xlabel('log$_{10}$ IV-Al (a.p.f.u.)')
ax.set_xlim(-2.0, -0.4) 

Names = ['Jaipur diopside\n(|| a, c*)',
         unicode('N\374shan cpx', 'latin-1'),
         'augite PMR-53',
         'Fuego\nphenocryst',
         'Jaipur diopside\n(|| b)',
         ]

# original convention from normalization spreadsheet from SERC website
# http://serc.carleton.edu/research_education/equilibria/mineralformulaerecalculation.html
Al = np.array([
               0.016, # Jaipur
               0.204, # Nushan
               0.026, # PMR-53
               0.133, # Fuego
Esempio n. 16
0
ax_kms = SubplotHost(fig, 1,1,1, aspect=1.)

# angular proper motion("/yr) to linear velocity(km/s) at distance=2.3kpc
pm_to_kms = 1./206265.*2300*3.085e18/3.15e7/1.e5

aux_trans = mtransforms.Affine2D().scale(pm_to_kms, 1.)
ax_pm = ax_kms.twin(aux_trans)
ax_pm.set_viewlim_mode("transform")

fig.add_subplot(ax_kms)

for n, ds, dse, w, we in obs:
    time = ((2007+(10. + 4/30.)/12)-1988.5)
    v = ds / time * pm_to_kms
    ve = dse / time * pm_to_kms
    ax_kms.errorbar([v], [w], xerr=[ve], yerr=[we], color="k")


ax_kms.axis["bottom"].set_label("Linear velocity at 2.3 kpc [km/s]")
ax_kms.axis["left"].set_label("FWHM [km/s]")
ax_pm.axis["top"].set_label("Proper Motion [$^{''}$/yr]")
ax_pm.axis["top"].label.set_visible(True)
ax_pm.axis["right"].major_ticklabels.set_visible(False)

ax_kms.set_xlim(950, 3700)
ax_kms.set_ylim(950, 3100)
# xlim and ylim of ax_pms will be automatically adjusted.

plt.draw()
plt.show()
Esempio n. 17
0
        alpha=0.6)
ax.plot(x,
        Peak3450,
        '3',
        label='~3450 cm$^{-1}$',
        markersize=12,
        mew=2,
        color='blue',
        clip_on=False)
ax.plot(x,
        Peak3330,
        'd',
        label='~3330 cm$^{-1}$',
        markersize=8,
        mew=1,
        color='violet',
        clip_on=False,
        alpha=0.5)

ax.set_xlim(-1.8, -0.2)
ax.legend(loc=4, ncol=1, fontsize=10, fancybox=True)

##fig.autofmt_xdate()
plt.tight_layout()
plt.savefig('Fig10_Fe.eps', format='eps', dpi=1000)
fig.savefig('Fig10_Fe.tif', format='tif', dpi=300)
fig.savefig('CpxDiffusivities.svg', format='svg')

plt.show(fig)
print 'Finished'
Esempio n. 18
0
ax.add_patch(fbox)
ax.text(-1.07, xenoDmin + 0.5*xenoDrange, 
        'peridotite\nmantle\ncpx?', ha='left', va='center')
        
#
#### Diopside
#
#
########### plot all peak-specific together #################
ax.plot(x, Peak3645, label='~3645 cm$^{-1}$', markersize=12, mew=2,
        color='r', marker='x', linestyle='none', clip_on=False)
ax.plot(x, Peak3540, label='~3540 cm$^{-1}$', markersize=7, mew=1,
        color='teal', marker='s', linestyle='none', clip_on=False, alpha=0.6)
ax.plot(x, Peak3450, '3', label='~3450 cm$^{-1}$', markersize=12, mew=2,
        color='blue', clip_on=False)
ax.plot(x, Peak3330, 'd', label='~3330 cm$^{-1}$', markersize=8, mew=1,
        color='violet', clip_on=False, alpha=0.5)

ax.set_xlim(-1.8, -0.2) 
ax.legend(loc=4, ncol=1, fontsize=10, fancybox=True)


##fig.autofmt_xdate()
plt.tight_layout()
plt.savefig('Fig10_Fe.eps', format='eps', dpi=1000)
fig.savefig('Fig10_Fe.tif', format='tif', dpi=300)
fig.savefig('CpxDiffusivities.svg', format='svg')

plt.show(fig)
print 'Finished'