def AllMaxesTriax(constit='vm', savedata=False):
    '''
    Plots the vm eeq at failure for every passing column max
    '''
    ex = n.genfromtxt('../ExptSummary.dat', delimiter=',')
    ex = ex[(ex[:, 1] == 0) & (ex[:, 3] != 0)][:, 0].astype(int)
    failz = n.genfromtxt('./failstns.dat', delimiter='\t')
    col = {'vm': 15, 'h8': 16, 'anis': 17}
    p.style.use('mysty')
    fig, ax = p.subplots()
    for k, x in enumerate(ex):
        lines = []
        triax = failz[failz[:, 0] == x, col[constit] - 13]
        proj = 'TTGM-{}_FS19SS6'.format(x)
        d = n.load(
            '../{}/IncrementalAnalysis/NewFilterPassingPoints_3med.npy'.format(
                proj))[-1, :, col[constit]]
        if x == 10:
            d = d[d != d.min()]
        p.plot(n.ones_like(d) * triax, d, '.', linestyle='none', color='C0')
        p.plot(triax, d.mean(), 'o', color='C1')
    ax.axis(xmin=0)
    ax.set_xlabel('$\\sigma_{\\mathsf{m}}/\\sigma_{\\mathsf{e}}$')
    ax.set_ylabel('$\\mathsf{e}^{\\mathsf{p}}_{\\mathsf{e}}$')
    f.eztext(ax, 'Incremental\nAl-6061-T6', 'bl')
    f.myax(ax)
    p.show()
    return fig, ax
def CornerFailure(max=False, mean=True, constit='vm'):
    key = n.genfromtxt('../ExptSummary.dat', delimiter=',')
    key = key[(key[:, 3] != 0)]
    key = key[key[:, 3].argsort()]
    corneralphas = n.unique(key[n.in1d(key[:, 1], [1, 2])][:, 3])
    ex, extype = key[:, :2].astype(int).T
    failz = n.genfromtxt('./failstns.dat', delimiter='\t')

    columnmapper = {'vm': [0, 6], 'h8': [1, 7], 'anis': [2, 8]}
    triaxmapper = {'vm': 2, 'h8': 3, 'anis': 4}
    marker = ['C0s', 'C1o', 'C2^']
    label = [
        '$\\Sigma=\\alpha\\mathcal{T}$', '$\\Sigma\\rightarrow\\mathcal{{T}}$',
        '$\\mathcal{{T}}\\rightarrow\\Sigma$'
    ]
    do = False

    p.style.use('mysty')
    fig, ax = p.subplots()
    lines = []
    for k, (x, xt, a) in enumerate(zip(ex, extype, key[:, 3])):
        triax = failz[failz[:, 0] == x, triaxmapper[constit]]
        proj = 'TTGM-{}_FS19SS6'.format(x)
        # [0-5]Mean VM-H8-Anis-de00-01-00, [6-11]Max VM-H8-Anis-de00-01-00, [12-13]Mean, max Classic LEp
        e = n.genfromtxt(
            '../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
            delimiter=',')[-1]
        c1, c2 = columnmapper[constit.lower()]
        if a not in corneralphas:
            if mean: ax.plot(triax, e[c1], 'C0s', alpha=0.35)
            if max: ax.plot(triax, e[c2], 'C0s', alpha=0.35)
        else:
            if len(lines) == 3:
                lines = []
                do = True
            if mean:
                lines.extend(
                    ax.plot(triax,
                            e[c1],
                            marker[xt],
                            label=[label[xt] if do else ''][0]))
            if max:
                lines.extend(
                    ax.plot(triax,
                            e[c2],
                            marker[xt],
                            label=[label[xt] if do else ''][0]))

    f.ezlegend(ax, markers=True, loc=3)
    ax.axis(xmin=0, ymin=0, ymax=1.65)
    ax.set_xlabel('$\\sigma_{\\mathsf{m}}/\\sigma_{\\mathsf{e}}$')
    ax.set_ylabel('$\\mathsf{e}^{\\mathsf{p}}_{\\mathsf{e}}$')
    f.eztext(
        ax, 'Al-6061-T6\n{}\n{}'.format(
            constit.upper(),
            'Mean' * mean + '\n' * (max & mean) + 'Max' * max), 'ur')
    f.myax(ax)
def slowplots():
    '''
    Some old plots that take a long time to plot that I don't find useful anymore
    '''
    
    # Let's see if old-style calc last stage max is in the new 
    # datasetmaxloc = n.nonzero( (A[:,0] == maxij[-1,0]) & (A[:,1] == maxij[-1,1]) )[0]
    oldmaxloc = n.nonzero( (A[:,0] == maxij[-1,0]) & (A[:,1] == maxij[-1,1]) )[0]
    # And calcualte the new maxloc
    newmaxloc = n.argmax(de[-1, :, 3])
    
    p.style.use('mysty')
    fig1 = p.figure()
    ax1 = fig1.add_subplot(111)
    for i in de[:,:,3].T:
        p.plot(dr, i, 'C1', alpha=0.1)
    p.plot(dr, de[:,:,3].mean(axis=1),'C0', label='Increm. Mean')
    p.plot(dr, dmean, 'C2', label='Old Mean')
    p.plot(dr, dmax, 'C3', label='Old Max')
    if len(oldmaxloc) == 1:
        p.plot(dr, de[:,oldmaxloc,3], 'C4', label='Old Max Pt')
        if oldmaxloc[0] != newmaxloc:
            p.plot(dr, de[:,newmaxloc,3], 'C5', label='New Max Pt')
        else:
            f.eztext(ax1, 'Old pMax pt is same\nas new max pt.', 'ul')
    else:
        p.plot(dr, de[:,newmaxloc,3], 'C5', label='New Max Pt')
        f.eztext(ax1, 'Old Max Pt is not\nin the new dataset', 'ul')
    p.xlabel(xlab)
    p.ylabel('$\\mathsf{e}_\\mathsf{e}$')
    ax1.axis(xmin=0)
    f.myax(p.gca())
    f.ezlegend(p.gca())
    p.savefig('../{}/IncrementalAnalysis/IncrementalAnalysis1.png'.format(pname), dpi=125)

    # Epsilon v gamma
    fig2 = p.figure()
    ax2 = fig2.add_subplot(111)
    for gam, eps in zip(-2*de[:,:,1].T, de[:,:,2].T):
        ax2.plot(gam, eps, 'C1', alpha=0.05)
    ax2.plot(-2*de[:,:,1].mean(axis=1), de[:,:,2].mean(axis=1), label='Mean', zorder=50)
    if len(oldmaxloc) == 1:
        ax2.plot(-2*de[:,oldmaxloc,1], de[:,oldmaxloc,2], label='Old Max Pt')
        if oldmaxloc[0] != newmaxloc:
            ax2.plot(-2*de[:,newmaxloc,1], de[:,newmaxloc,2], label='New Max Pt')
    else:
        ax2.plot(-2*de[:,newmaxloc,1], de[:,newmaxloc,2], label='New Max Pt')
    ax2.set_xlabel('$\\mathsf{2e}_{\\theta\\mathsf{x}}$')
    ax2.set_ylabel('$\\mathsf{e}_\\mathsf{x}$')
    ax2.axis(xmin=0, ymin=0)
    f.myax(ax2)
    f.ezlegend(ax2)
    fig2.savefig('../{}/IncrementalAnalysis/IncrementalAnalysis2.png'.format(pname), dpi=125)
def PlotF(expt, F=None):
    '''
    Plot Components of the def. grad.
    If F isn't given, it gets the expt's old max point F
    '''
    if F is None:
        F = GetMaxPtF(expt)
    p.plot(-F[:, 1], F[:, 3], marker='.')
    p.axis(xmin=0, ymin=1)
    p.xlabel('-F$_\\mathsf{01}$')
    p.ylabel('F$_\\mathsf{11}$')
    if expt is not None:
        f.eztext(p.gca(), 'TTGM-{}'.format(expt), 'ul')
    f.myax(p.gca())
    return F
def FailureStrains(max=True, mean=True, vm=True, h8=False, anis=False):
    ex = n.genfromtxt('../ExptSummary.dat', delimiter=',')
    ex = ex[(ex[:, 1] == 0) & (ex[:, 3] != 0)][:, 0].astype(int)
    failz = n.genfromtxt('./failstns.dat', delimiter='\t')
    p.style.use('mysty')
    fig, ax = p.subplots()
    for k, x in enumerate(ex):
        lines = []
        triax = failz[failz[:, 0] == x, 2]
        proj = 'TTGM-{}_FS19SS6'.format(x)
        # [0-5]Mean VM-H8-Anis-de00-01-00, [6-11]Max VM-H8-Anis-de00-01-00, [12-13]Mean, max Classic LEp
        e = n.genfromtxt(
            '../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
            delimiter=',')[-1]
        if x == [35]:
            pass
            #e = n.genfromtxt('../{}/IncrementalAnalysis/NewFilterResults_4med.dat'.format(proj), delimiter=',')[-1]
        if vm:
            if mean:
                lines.append(ax.plot(triax, e[0], 'gs', label='Mean/VM')[0])
            if max: lines.append(ax.plot(triax, e[6], 'rs', label='Max/VM')[0])
        if h8:
            if mean:
                lines.append(
                    ax.plot(triax, e[1], 'go', mfc='none', label='Mean/H8')[0])
            if max:
                lines.append(
                    ax.plot(triax, e[7], 'ro', mfc='none', label='Max/H8')[0])
        if anis:
            if mean:
                lines.append(
                    ax.plot(triax, e[2], 'g^', mfc='none',
                            label='Mean/Ani')[0])
            if max:
                lines.append(
                    ax.plot(triax, e[8], 'r^', mfc='none', label='Max/Ani')[0])

    leg = ax.legend(lines, [i.get_label() for i in lines], loc=1)
    [
        l.set_color(leg.get_lines()[k].get_mec())
        for k, l in enumerate(leg.get_texts())
    ]
    ax.axis(xmin=0, ymin=0, ymax=1.65)
    ax.set_xlabel('$\\sigma_{\\mathsf{m}}/\\sigma_{\\mathsf{e}}$')
    ax.set_ylabel('$\\mathsf{e}^{\\mathsf{p}}_{\\mathsf{e}}$')
    f.eztext(ax, 'Incremental\nAl-6061-T6', 'bl')
    f.myax(ax)
    return fig, ax
def PlotOldMaxTraceBack(expt):
    '''
    Plots the STK16 max point eeq vs rot and its increm. ex vs 2eqx
    
    '''
    p.style.use('mysty')
    fig, ax = p.subplots()
    labs = [
        'Avg_AllPass', 'Avg_P2P', 'LastMax_TraceBk', 'Max_EachStgP2P',
        'LastMax_Trace_Nbhd', 'Avg_P2P_PassOnly'
    ]
    alpha = [1, 1, 1, .5, 1, 1]
    ls = ['-', '--', '-', '-', '--', '-', '--']
    proj = 'TTGM-{}_FS19SS6'.format(expt)
    dmean = n.genfromtxt('../{}/mean.dat'.format(proj))[:, -1]
    dmax = n.genfromtxt('../{}/MaxPt.dat'.format(proj), delimiter=',')[:, 10]
    # [0-4]AvgF-Passing-VM-H8-de00-01-11, [5-9]PassingP2P-VM-H8, [10-14]MaxPtTracedBack-VM-H8,
    # [15-19]MaxPtEachStage-VM-H8, [20-24]MaxPtTrace/NbhdFavg, [25-29]
    X = n.genfromtxt(
        '../{}/IncrementalAnalysis/OldFilteringResults.dat'.format(proj),
        delimiter=',')
    if expt in ['18', 18]:
        dr = n.genfromtxt('../{}/disp-rot.dat'.format(proj), delimiter=',')[:,
                                                                            4]
        xlab = '$\\delta/\\mathsf{L}$'
    else:
        dr = n.genfromtxt('../{}/disp-rot.dat'.format(proj), delimiter=',')[:,
                                                                            5]
        xlab = '$\\Phi$'
    for i in [2]:
        ax.plot(dr, X[:, i * 5], label='Incremental\nTracedBack')
    ax.plot(dr, dmax, label='STK16')
    ax.set_xlabel(xlab)
    ax.set_ylabel('e$_\\mathsf{e}$')
    f.ezlegend(ax, loc=2, title='TTGM-{} Max Values'.format(expt))
    ax.axis(xmin=0, ymin=0)
    f.myax(ax)

    fig2, ax2 = p.subplots()
    ax2.plot(-2 * X[:, 13], X[:, 14])
    ax2.set_xlabel('2e$_{\\theta\\mathsf{x}}$')
    ax2.set_ylabel('e$_\\mathsf{xx}$')
    f.eztext(ax2, 'TTGM-{} Max Values'.format(expt), 'ul')
    f.myax(ax2)
    p.show()
                  sheetname='FailureStrain',
                  index_col='Expt')

x[0] = read_excel('../../../../AAA_TensionTorsion/TT2_SetData.xlsx',
                  sheetname='FailureStrain',
                  index_col='Expt')
x[0].drop(17, inplace=True)

fig, ax1, ax2 = f.make21()

labs = ['GM', 'TT2'][::-1]
marks = 'o', '^'
for k, d in enumerate(x):
    ax1.plot(d.Triax.values, d['VM-Mean'].values, marks[k], label=labs[k])
    ax2.plot(d.Triax.values, d['VM-Max'].values, marks[k], label=labs[k])

ax1.set_ylabel('$\\bar{e}_e^f$')
ax2.set_ylabel('$e_e^f$')
f.eztext(ax1, 'Mean', 'ur')
f.eztext(ax2, 'Max', 'ur')

for ax in [ax1, ax2]:
    f.eztext(ax, '3D DIC\nAl 6061-T6', 'll')
    f.ezlegend(ax, markers=True)
    ax.set_xlabel('$\\sigma_m/\\sigma_e$')
    ax.axis([0, 0.6, 0, 1.8])
    f.myax(ax)

p.savefig('CompareGMTT2.png', dpi=125)
p.show()
示例#8
0
for k, (x, alp) in enumerate(zip(ex[:, 0].astype(int), ex[:, 3])):
    lines = []
    proj = 'TTGM-{}_FS19SS6'.format(x)
    # [0-5]Mean VM-H8-Anis-de00-01-00, [6-11]Max VM-H8-Anis-de00-01-00, [12-13]Mean, max Classic LEp
    e = n.genfromtxt(
        '../../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
        delimiter=',')[-1]
    sig, tau = n.genfromtxt('../../{}/STF.dat'.format(proj),
                            delimiter=',',
                            unpack=True,
                            usecols=(2, 3))
    triax, triax2 = stress_measures(sig[-1], tau[-1], alp)
    if x == ex[-1, 0]:
        ax.plot(triax, e[0],
                'C0s')  #, label='$\\beta=\\mathsf{1}$/$\\mathsf{2}$')
        ax.plot(triax2, e[0], 'C1o')  #, label='$\\beta=\\mathsf{f}(\\alpha)$')
    else:
        ax.plot(triax, e[0], 'C0s')
        ax.plot(triax2, e[0], 'C1o')

#f.ezlegend(ax,markers=True,fontsize=20, loc=3)
f.eztext(ax, '$\\beta=\\mathsf{1}$/$\\mathsf{2}$\n', 'bl', color='C0')
f.eztext(ax, '$\\beta=\\mathsf{f}(\\alpha)$', 'bl', color='C1')
ax.axis(xmin=0, ymin=0, ymax=1.65)
ax.set_xlabel('$\\sigma_{\\mathsf{m}}/\\sigma_{\\mathsf{e}}$')
ax.set_ylabel('$\\mathsf{e}^{\\mathsf{p}}_{\\mathsf{e}}$')
f.eztext(ax, 'Al-6061-T6\nMean values', 'ur')
f.myax(ax)
p.savefig('Triax_Beta.pdf')
p.show()
    def fun(b, a):
        return wrapped(a, b)

    for j, i in enumerate(als):
        #betas[j,z] = so.newton(fun,1,args=(i,))
        betas[j, z] = so.brentq(fun, 0.3, 1, args=(i, ))

import figfun as f
p.style.use('mysty')
fig, ax = p.subplots()
for i in range(z + 1):
    label = labels[i].upper() + '\n$\\beta_\\infty$={:.2f}'.format(betas[-1,
                                                                         i])
    p.plot(als[:-1], betas[:-1, i], label=label)

p.xlabel('$\\alpha$')
p.ylabel('$\\beta$')
f.ezlegend(ax)
f.eztext(ax, 'Al 6061-T6\n$\\mathsf{d}\\epsilon_\\mathsf{11}=\\mathsf{0}$',
         'ur')
f.myax(ax)
p.savefig('PlaneStn_YldFun.pdf')
p.show()

n.savetxt('PlaneStn_YldFun.dat',
          fmt='%.6f',
          delimiter=',',
          X=n.c_[als, betas],
          header='[0]Alpha, [1]VM, [2]H8, [3]Anis')
示例#10
0
[f.myax(x) for x in (ax1, ax2)]

fig.savefig('Failure_HC_{}'.format(constit), dpi=125)

# First load up the failure data
p.figure()


def JC(triax, D1, D2, D3):
    return D1 + D2 * n.exp(D3 * triax)


bounds = ((0, -n.inf, -n.inf), (n.inf, n.inf, 0))

for efm, lab in zip([efmx, efmn], ['Max', 'Mean']):
    params, info = so.curve_fit(JC, Σ, efm, bounds=bounds)
    x = n.linspace(0, 2 / 3)
    p.plot(x,
           JC(x, *params),
           label='{}\nD1={:.3f}\nD2={:.3f}\nD3={:.3f}'.format(lab, *params))
    p.plot(Σ, efm, '.')

f.ezlegend(p.gca())
f.eztext(p.gca(), '{}\nJohnson-Cook'.format(constit), 'ur')
p.xlabel('$\\sigma_m/\\sigma_e$')
p.ylabel('$e_e^f$')
p.axis(xmax=0.6)
f.myax(p.gca())

p.savefig('Failure_JC_{}'.format(constit), dpi=125)