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 KelinCompare(expt, savedata=False):
    proj = 'TTGM-{}_FS19SS6'.format(expt)
    key = n.genfromtxt('../ExptSummary.dat', delimiter=',')
    alpha = key[key[:, 0] == expt, 3].ravel()
    dr = n.genfromtxt('../{}/disp-rot.dat'.format(proj), delimiter=',')[:, 5]
    d = n.load(
        '../{}/IncrementalAnalysis/NewFilterPassingPoints_3med.npy'.format(
            proj))
    mnmx = d[..., 17].min(axis=1), d[..., 17].max(axis=1)
    cols = {4: (0, 1), 1: (2, 3), 5: (4, 5)}
    s = read_excel('../Misc/KelinSim.xlsx', parse_cols=cols[expt]).values
    if savedata:
        n.savetxt('KelinCompare_Expt-{}.dat'.format(expt),
                  X=n.c_[dr, d[..., 17].mean(axis=1), mnmx[0], mnmx[1]],
                  fmt="%.6f",
                  delimiter=',')
        n.savetxt('KelinCompare_Expt-{}_kel.dat'.format(expt),
                  X=s,
                  fmt="%.6f",
                  delimiter=',')
    p.style.use('mysty')
    fig, ax = p.subplots()
    p.fill_between(dr, mnmx[0], mnmx[1], alpha=0.1, color='C0')
    p.plot(dr, mnmx[1], 'C0', label='Exp')
    p.plot(dr, mnmx[0], 'C0')
    p.plot(dr, d[:, :, 17].mean(axis=1), '--', color='C0')
    p.plot(s[:, 0], s[:, 1], 'C1', lw=2, label='Anal Anis')
    ax.axis(xmin=0, ymin=0)
    ax.set_xlabel('$\\Phi$')
    ax.set_ylabel('e$_\\mathsf{e}$')
    f.ezlegend(ax,
               loc=2,
               title='TTGM-{}\n$\\alpha$ = {:g}'.format(expt, alpha[0]))
    f.myax(ax)
    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 NewOldMax(expt, mode=None):
    '''
    Plots the STK16 max point and the new max point eeq vs rot
    Can plot either Total or incremental method of calculation
    '''
    proj = 'TTGM-{}_FS19SS6'.format(expt)
    dr = n.genfromtxt('../{}/disp-rot.dat'.format(proj), delimiter=',')[:, 5]
    oldmax = n.genfromtxt('../{}/MaxPt.dat'.format(proj), delimiter=',')[:, 10]
    oldmax_incr = n.genfromtxt(
        '../{}/IncrementalAnalysis/OldFilteringResults.dat'.format(proj),
        delimiter=',',
        usecols=(10))
    maxi, maxj = n.genfromtxt('../{}/max.dat'.format(proj), delimiter=',')[-1,
                                                                           -2:]
    # [0]Index_x [1]Index_y [2,3,4]Undef_X,Y,Z inches
    # [5,6,7]Def_X,Y,Z inches [8,9,10,11]DefGrad (11 12 21 22)
    # [12,13,14,15,16,17] e00, e01, e11, eeqVM, eeqH8, eeqAnis
    D = n.load(
        '../{}/IncrementalAnalysis/NewFilterPassingPoints_3med.npy'.format(
            proj))
    locmax = D[-1, :, 15].argmax()

    p.style.use('mysty')
    fig, ax = p.subplots()
    if mode != 'Total':
        ax.plot(dr,
                oldmax_incr,
                label='STK16 ({:.0f},{:.0f})'.format(maxi, maxj),
                zorder=10)
        ax.plot(dr,
                D[:, locmax, 15],
                label='New ({:.0f},{:.0f})'.format(*D[-1, locmax, :2]))
        title = 'TTGM-{} Max Incr. Values'.format(expt)
    else:
        ax.plot(dr,
                oldmax,
                label='STK16 ({:.0f},{:.0f})'.format(maxi, maxj),
                zorder=10)
        # [0-5]Mean VM-H8-Anis-de00-01-00, [6-11]Max VM-H8-Anis-de00-01-00, [12-13]Mean, max Classic LEp
        h = n.genfromtxt(
            '../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
            delimiter=',',
            usecols=(13, ))
        ax.plot(dr, h, label='New ({:.0f},{:.0f})'.format(*D[-1, locmax, :2]))
        title = 'TTGM-{} Max Total Stn'.format(expt)

    ax.set_xlabel('$\\Phi$')
    ax.set_ylabel('e$_\\mathsf{e}$')
    ax.axis(xmin=0, ymin=0)
    f.ezlegend(ax, title=title, loc=2)
    f.myax(ax)

    return None
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 PlotOldStrainDef(expt, stndef='Haltom'):
    '''
    Obsolete.  See PlotStrainPaths
    '''
    from FtfEig import LEp
    proj = 'TTGM-{}_FS19SS6'.format(expt)
    # [0]Index_x [1]Index_y [2,3,4]Undef_X,Y,Z inches
    # [5,6,7]Def_X,Y,Z inches [8,9,10,11]DefGrad (11 12 21 22)
    # [12,13,14,15,16] e00, e01, e11, eeqVM, eeqH8
    d = n.load(
        '../{}/IncrementalAnalysis/NewFilterPassingPoints_3med.npy'.format(
            proj))
    # [0-4]Mean VM-H8-de00-01-00, [5-9]Max VM-H8-de00-01-00, [10-11]Mean, max Classic LEp
    maxp = n.genfromtxt(
        '../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
        delimiter=',')
    p.style.use('mysty')
    fig, ax = p.subplots()
    if expt in [18, '18']:
        col = 12
    else:
        col = 13

    if stndef == 'Haltom':
        # Haltom definitions
        [
            p.plot(-n.arctan2(d[:, i, 9], d[:, i, 11]),
                   d[:, i, 11] - 1,
                   alpha=0.5) for i in range(d.shape[1])
        ]
    else:
        # Aramis definition
        for i in range(d.shape[1]):
            lep, NEx, NExy, NEy = LEp(d[:, i, 8], d[:, i, 9], d[:, i, 10],
                                      d[:, i, 11], True)
            NEx -= 1
            NEy -= 1
            G = n.arctan(NExy / (1 + NEx)) + n.arctan(NExy / (1 + NEy))
            p.plot(-G, NEy, alpha=0.5)

    p.axis(xmin=0, ymin=0)
    p.xlabel('$\\gamma$')
    p.ylabel('$\\epsilon_\\mathsf{x}$')
    f.myax(ax)
    return fig, ax
def PlotAllEeqRot(expt=24, ij=None, kelin=False):
    '''
    Plots every maxima's eeq vs rot
    '''
    proj = 'TTGM-{}_FS19SS6'.format(expt)
    dr = n.genfromtxt('../{}/disp-rot.dat'.format(proj), delimiter=',')[:, 5]
    # [0]Index_x [1]Index_y [2,3,4]Undef_X,Y,Z inches
    # [5,6,7]Def_X,Y,Z inches [8,9,10,11]DefGrad (11 12 21 22)
    # [12,13,14,15,16,17] e00, e01, e11, eeqVM, eeqH8, eeqAnis
    d = n.load(
        '../{}/IncrementalAnalysis/NewFilterPassingPoints_3med.npy'.format(
            proj))
    locmax = d[-1, :, 15].argmax()
    p.style.use('mysty')
    fig, ax = p.subplots()
    p.plot(dr, d[:, :, 15], alpha=0.2)
    p.plot(dr,
           d[:, locmax, 15],
           'k',
           label='Max ({},{})'.format(*d[-1, locmax, :2].astype(int)))
    p.plot(dr, d[:, :, 15].mean(axis=1), 'k--', label='Mean')
    if ij is not None:
        try:
            loc = n.nonzero((d[-1, :, 0] == ij[0])
                            & (d[-1, :, 1] == ij[1]))[0][0]
            p.plot(dr, d[:, loc, 15], 'r', label='({},{})'.format(*ij))
        except IndexError:
            d = n.load(
                '../{}/IncrementalAnalysis/PointsInLastWithStrains.npy'.format(
                    proj))
            loc = n.nonzero((d[0, :, 0] == ij[0])
                            & (d[0, :, 1] == ij[1]))[0][0]
            ee = []
            for i in range(d.shape[0]):
                ee.append(d[i, loc, 15])
            p.plot(dr, ee, 'r', label='({},{}) (no pass)'.format(*ij))
    if kelin and (expt in [1, 4, 5]):
        cols = {4: (0, 1), 1: (2, 3), 5: (4, 5)}
        s = read_excel('../Misc/KelinSim.xlsx', parse_cols=cols[expt]).values
        p.plot(s[:, 0], s[:, 1], 'b', label='Anal Anis')
    ax.axis(xmin=0, ymin=0)
    ax.set_xlabel('$\\Phi$')
    ax.set_ylabel('e$_\\mathsf{e}$')
    f.ezlegend(ax, loc=2, hl=2, title='TTGM-{}'.format(expt))
    f.myax(ax)
def SetStrainpaths(Mean=True, Max=False):
    '''
    Plot axial vs shear strain (mean or max) for all expts)
    '''
    ex = n.genfromtxt('../ExptSummary.dat', delimiter=',')
    ex = ex[ex[:, 3].argsort()][::-1]
    ex = ex[(ex[:, 3] != 0)]
    alp = ex[:, 3]
    ex = ex[:, 0].astype(int)
    p.style.use('mysty')
    fig, ax = p.subplots()
    for k, (x, a) in enumerate(zip(ex, alp)):
        proj = 'TTGM-{}_FS19SS6'.format(x)
        LL = n.genfromtxt('../{}/prof_stages.dat'.format(proj),
                          delimiter=',',
                          dtype=int)[3]
        # [0-5]Mean VM-H8-Anis-de00-01-00, [6-11]Max VM-H8-Anis-de00-01-00, [12-13]Mean, max Classic LEp
        D = n.genfromtxt(
            '../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
            delimiter=',')
        D[:, [4, 10]] *= -1
        if n.isnan(a):
            a = '$\\infty$'
        line, = p.plot(D[:, 4], D[:, 5], label='{}'.format(a))
        LLmark, = p.plot(D[LL, 4], D[LL, 5], 'rs')
        if Max:
            maxline, = p.plot(D[:, 10],
                              D[:, 11],
                              color=line.get_color(),
                              alpha=0.3)
            maxmark, = p.plot(D[LL, 10], D[LL, 11], 'rs', alpha=0.3)
        if not Mean:
            maxline.set_alpha(1)
            maxmark.set_alpha(1)
            maxline.set_label(line.get_label())
            line.remove()
            LLmark.remove()
    ax.axis(xmin=-.02, ymin=0)
    ax.set_xlabel('e$_{\\theta\\mathsf{x}}$')
    ax.set_ylabel('e$_\\mathsf{xx}$')
    f.ezlegend(ax,
               title='Mean' * Mean + '\n' * (Max & Mean) + 'Max' * Max,
               loc=0)
    f.myax(ax)
    p.show()
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()
Пример #12
0
def YldLocusPlot():
    p.style.use('mysty')
    fig = p.figure(figsize=(8, 8))
    ax = fig.add_axes([.125, .125, .75, .75])
    anx, any = CalContour(close=True).T
    hx, hy = CalContour(coefs=1, a=8, close=True).T
    vx, vy = CalContour(coefs=1, a=2, close=True).T
    ax.plot(vx, vy, label='VM')
    ax.plot(hx, hy, label='H8')
    ax.plot(anx, any, label='Anis')
    ax.plot([0, 1.2], [0, 1.2], 'k--', alpha=0.2)
    ax.set_xlabel('$\\tau_\\mathsf{x}/\\tau_o$')
    ax.set_ylabel('yo')
    ax.set_ylabel('$\\frac{\\tau_\\theta}{\\tau_o}$')
    import figfun as f
    f.ezlegend(ax, loc=2)
    ax.set_title("Kelin's Calibration")
    f.myax(ax, autoscale=.9)
def PlotAllOldFilters(expt):
    p.style.use('mysty-sub')
    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))[:, 10]
    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$'
    fig, ax1, ax2 = f.make21()
    for i in [0, 1, 5]:
        ax1.plot(dr, X[:, i * 5], label=labs[i], alpha=alpha[i], ls=ls[i])
    ax1.plot(dr, dmean, 'k--', label='Old')
    ax1.set_xlabel(xlab)
    ax1.set_ylabel('e$_\\mathsf{e}$')
    f.ezlegend(ax1, loc=2, title='Mean Values')
    ax1.axis(xmin=0, ymin=0)
    f.myax(ax1)

    for i in [2, 3, 4]:
        ax2.plot(dr, X[:, i * 5], label=labs[i], alpha=alpha[i], ls=ls[i])
    ax2.plot(dr, dmax, 'k--', label='Old')
    ax2.set_xlabel(xlab)
    ax2.set_ylabel('e$_\\mathsf{e}$')
    f.ezlegend(ax2, loc=2, title='Max Values')
    ax2.axis(xmin=0, ymin=0)
    f.myax(ax2)
    p.show()
def SetStrainpaths(Mean=True,
                   Max=False,
                   corners=False,
                   corneronly=False,
                   export=False):
    '''
    Plot axial vs shear strain (mean or max) for all expts)
    '''
    key = n.genfromtxt('../ExptSummary.dat', delimiter=',')
    if corneronly:
        corners = True
        corneralphas = n.unique(key[n.in1d(key[:, 1], [1, 2])][:, 3])
        key = key[n.in1d(key[:, 3], corneralphas)]
    if not corners:
        key = key[key[:, 1] == 0]
    key = key[key[:, 3].argsort()][::-1]
    key = key[(key[:, 3] != 0)]
    alp = key[:, 3]
    ex = key[:, 0].astype(int)
    extype = key[:, 1].astype(int)
    p.style.use('mysty')
    fig, ax = p.subplots()
    for k, (x, a, xt) in enumerate(zip(ex, alp, extype)):
        proj = 'TTGM-{}_FS19SS6'.format(x)
        LL = n.genfromtxt('../{}/prof_stages.dat'.format(proj),
                          delimiter=',',
                          dtype=int)[3]
        # [0-5]Mean VM-H8-Anis-de00-01-00, [6-11]Max VM-H8-Anis-de00-01-00, [12-13]Mean, max Classic LEp
        D = n.genfromtxt(
            '../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
            delimiter=',')
        D[:, [4, 10]] *= -1
        labeladd = [
            '', '($\\Sigma\\rightarrow\\mathcal{{T}}$)',
            '($\\mathcal{{T}}\\rightarrow\\Sigma$)'
        ]
        if n.isnan(a):
            label = '$\\infty$'
        else:
            label = '{}'.format(a) + labeladd[xt]
        line, = p.plot(D[:, 4], D[:, 5], label=label)
        LLmark, = p.plot(D[LL, 4], D[LL, 5], 'rs')
        if Max:
            maxline, = p.plot(D[:, 10],
                              D[:, 11],
                              color=line.get_color(),
                              alpha=0.3)
            maxmark, = p.plot(D[LL, 10], D[LL, 11], 'rs', alpha=0.3)
        if not Mean:
            maxline.set_alpha(1)
            maxmark.set_alpha(1)
            maxline.set_label(line.get_label())
            line.remove()
            LLmark.remove()
        if export:
            if k == 0:
                import pandas as pd
                fid = pd.ExcelWriter('StrainPaths.xlsx')
                LLdat = n.empty((len(ex), D.shape[1] + 3))
                header = "MeanVM,H8,Anis,e11,e12,e22,MaxVM,H8,Anis,e11,e12,e22,MeanClasscLEp,MaxLEp".split(
                    ',')
            pd.DataFrame(D).to_excel(fid,
                                     sheet_name='Exp{} _ {}'.format(x, a),
                                     index=False,
                                     header=header)
            LLdat[k] = n.hstack(([x, a, xt], D[LL]))

    if export:
        pd.DataFrame(LLdat).to_excel(fid,
                                     sheet_name='LL',
                                     index=False,
                                     header=["Exp", "Alpha",
                                             "ExpType"].extend(header))
        fid.save()

    ax.axis(xmin=-.02, ymin=0)
    ax.set_xlabel('e$_{\\theta\\mathsf{x}}$')
    ax.set_ylabel('e$_\\mathsf{xx}$')
    f.ezlegend(ax,
               title='Mean' * Mean + '\n' * (Max & Mean) + 'Max' * Max,
               loc=0)
    f.myax(ax)
    p.show()
Пример #15
0
         label=('{}\n$\\sigma_c$,a,c\n' + '{:.3f}\n' * 3).format(
             constit, *res.x))
ax1.plot(d.Triax, sts, 'o')
ax1.set_xlabel('$\\sigma_m/\\sigma_e$')
ax1.set_ylabel('$\\sigma_e^f$')
f.ezlegend(ax1)

eef_pred = interp1d(mat[:, 1], mat[:, 0], fill_value='extrapolate').__call__(
    plot_HC(res.x, α, constit))
ax2.plot(η, eef_pred)
ax2.axis([0, .6, 0, 2])
ax2.set_xlabel('$\\sigma_m/\\sigma_e$')
ax2.set_ylabel('$e_e^f$')
ax2.plot(d.Triax, d.efmn, 'o')

[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)
Пример #16
0
p.style.use('mysty-sub')
p.figure(1, facecolor='w', figsize=(8, 12))
p.subplot(2, 1, 1)

for j in profStg:
    p.plot(DR[int(j), 4], DR[int(j), 2], 'o', markersize=7, mec='none')
p.plot(DR[:, 4], DR[:, 2], 'b', zorder=0)
p.xlabel('$\\delta/\\mathsf{L}$')
p.ylabel('$\\Sigma$\n$(\\mathsf{ksi})$')
p.title('TT2-{:.0f}, $\\alpha$ = {}.  FS{:.0f}SS{:.0f}. Tube DC-{:.0f}'.format(
    expt, alpha, FS, SS, tube),
        size=18)
p.gcf().gca().set_ylim([0, 1.2 * n.max(STF[:, 2])])
p.gcf().gca().set_xlim(left=0)

ff.myax(p.gcf(), ff.ksi2Mpa, '$\\Sigma$\n$(\\mathsf{MPa})$')

p.subplot(2, 1, 2)
for j in profStg:
    p.plot(DR[j, 5], DR[j, 3], 'o', markersize=7, mec='none')
p.plot(DR[:, 5], DR[:, 3], 'b', zorder=0)
p.xlabel('$\\phi^{\\circ}$')
p.ylabel('$\\mathcal{T}$\n$(\\mathsf{ksi})$')
p.gcf().gca().set_ylim([0, 1.2 * n.max(STF[:, 3])])
p.gcf().gca().set_xlim(left=0)

ff.myax(p.gcf(), ff.ksi2Mpa, '$\\mathcal{T}$\n$(\\mathsf{MPa})$')

if savefigs:
    p.savefig('1 - Sts-Delta-Rot.png', dpi=125)
    p.close()
def PlotStrainPaths(expt, ij=None, stndef=None, eq=False):
    '''
    Plots all new passing points incr. strain paths.
    Also highlights the max and mean.
    if ij is not None, then it will plot a given ij point's path
    '''
    proj = 'TTGM-{}_FS19SS6'.format(expt)
    # [0]Index_x [1]Index_y [2,3,4]Undef_X,Y,Z inches
    # [5,6,7]Def_X,Y,Z inches [8,9,10,11]DefGrad (11 12 21 22)
    # [12,13,14,15,16,17] e00, e01, e11, eeqVM, eeqH8, eeqAnis
    d = n.load(
        '../{}/IncrementalAnalysis/NewFilterPassingPoints_3med.npy'.format(
            proj))
    maxloc = d[-1, :, 15].argmax()
    maxij = d[-1, maxloc, :2].astype(int)
    # [0-5]Mean VM-H8-Anis-de00-01-11, [6-11]Max VM-H8-Anis-de00-01-00, [12-13]Mean, max Classic LEp
    maxp = n.genfromtxt(
        '../{}/IncrementalAnalysis/NewFilterResults_3med.dat'.format(proj),
        delimiter=',')
    p.style.use('mysty')
    fig, ax = p.subplots()
    if expt in [18, '18']:
        col = 12
    else:
        col = 13
    if ij is not None:
        loc = n.nonzero((d[-1, :, 0] == ij[0]) & (d[-1, :, 1] == ij[1]))[0][0]
    if stndef not in ['Haltom', 'Aramis']:
        if eq == True:
            # Plots hoops strain vs gamma instead
            d[:, :, 12:15] = d[:, :, [14, 13, 12]]
            maxp[:, [5, 10]] = maxp[:, [2, 7]]
        [
            p.plot(-2 * d[:, i, col], d[:, i, 14], alpha=0.3)
            for i in range(d.shape[1])
        ]
        p.plot(-2 * maxp[:, col - 3],
               maxp[:, 11],
               'k',
               label='Max ({},{})'.format(*maxij))
        p.plot(-2 * maxp[:, col - 9], maxp[:, 5], 'k--', label='Mean')
        if ij is not None:
            p.plot(-2 * d[:, loc, col],
                   d[:, loc, 14],
                   'r',
                   label='{:.0f},{:.0f}'.format(*ij))
    elif stndef == 'Haltom':
        [
            p.plot(-n.arctan2(d[:, i, 9], d[:, i, 11]),
                   d[:, i, 11] - 1,
                   alpha=0.5) for i in range(d.shape[1])
        ]
        p.plot(-n.arctan2(d[:, maxloc, 9], d[:, maxloc, 11]),
               d[:, maxloc, 11] - 1,
               'k',
               label='Max ({},{})'.format(*maxij))
        p.plot(-n.arctan2(d[:, :, 9], d[:, :, 11]).mean(axis=1),
               d[:, :, 11].mean(axis=1) - 1,
               'k--',
               label='Mean')
        if ij is not None:
            p.plot(-n.arctan2(d[:, loc, 9], d[:, loc, 11]),
                   d[:, loc, 11] - 1,
                   'r',
                   label='{:.0f},{:.0f}'.format(*ij))
    elif stndef == 'Aramis':
        tempG = n.empty(d.shape[:2])
        tempNEy = n.empty_like(tempG)
        for i in range(d.shape[1]):
            lep, NEx, NExy, NEy = LEp(d[:, i, 8], d[:, i, 9], d[:, i, 10],
                                      d[:, i, 11], True)
            NEx -= 1
            NEy -= 1
            G = -n.arctan(NExy / (1 + NEx)) - n.arctan(NExy / (1 + NEy))
            tempG[:, i] = G
            tempNEy[:, i] = NEy
            p.plot(G, NEy, alpha=0.5)
        p.plot(tempG[:, maxloc],
               tempNEy[:, maxloc],
               'k',
               label='Max ({},{})'.format(*maxij))
        p.plot(tempG.mean(axis=1), tempNEy.mean(axis=1), 'k--', label='Mean')
        if ij is not None:
            p.plot(tempG[:, loc],
                   tempNEy[:, loc],
                   'r',
                   label='{:.0f},{:.0f}'.format(*ij))
    if expt not in [18, '18', 31, '31']:
        p.axis(xmin=0, ymin=0)
    ax.set_xlabel('2e$_{\\theta\\mathsf{x}}$')
    ax.set_ylabel('e$_\\mathsf{xx}$')
    f.ezlegend(ax, loc=2, hl=2, title='TTGM-{}'.format(expt))
    f.myax(ax)
    p.show()
    return fig, ax
    'LastMax_Trace_Nbhd', 'Avg_P2P_PassOnly'
]
alpha = [1, 1, 1, .5, 1, 1]
ls = ['-', '--', '-', '-', '--', '-', '--']

dmean = n.genfromtxt('../{}/mean.dat'.format(proj))[:, -1]
dmax = n.genfromtxt('../{}/MaxPt.dat'.format(proj))[:, 10]

fig, ax1, ax2 = f.make21()
for i in [0, 1, 5]:
    ax1.plot(dr, X[:, i * 5], label=labs[i], alpha=alpha[i], ls=ls[i])
ax1.plot(dr, dmean, 'k--', label='Old')
ax1.set_xlabel(xlab)
ax1.set_ylabel('e$_\\mathsf{e}$')
f.ezlegend(ax1, loc=2, title='Mean Values')
ax1.axis(xmin=0, ymin=0)
f.myax(ax1)

for i in [2, 3, 4]:
    ax2.plot(dr, X[:, i * 5], label=labs[i], alpha=alpha[i], ls=ls[i])
ax2.plot(dr, dmax, 'k--', label='Old')
ax2.set_xlabel(xlab)
ax2.set_ylabel('e$_\\mathsf{e}$')
f.ezlegend(ax2, loc=2, title='Max Values')
ax2.axis(xmin=0, ymin=0)
f.myax(ax2)

p.savefig('../{0}/IncrementalAnalysis/OldFilteringResults.png'.format(proj),
          dpi=125)
p.close()
#tric = p.tricontourf(x,y,LEp,crange,extend='both',cmap=cmap)

tric = p.tricontourf(x,
                     y,
                     Z.triangles,
                     colorval,
                     crange,
                     extend='both',
                     cmap=cmap)

ax.axis([n.min(x) * 1.1, 1.1 * n.max(x), -.2 / .0461, .2 / .0461])
#ax.plot(box_path[:,0], box_path[:,1], 'w')
#p.axis('equal')
ax.set_xlabel('$\\mathsf{x}_\\mathsf{o}/\\mathsf{R}_\\mathsf{o}$')
ax.set_ylabel('$\\frac{\\mathsf{y}_\\mathsf{o}}{\\mathsf{t}_\\mathsf{o}}$')
f.myax(ax)
ax_bar = fig.add_axes(n.array([9.5, 1, .25, 4]) * mult)
ticklocs = n.abs(n.unique(crange // .1 * .1))
ticklabs = ['{:g}'.format(L) for L in ticklocs]
cbar = p.colorbar(tric,
                  ax_bar,
                  extendrect=True,
                  extendfrac=0,
                  ticks=ticklocs,
                  format='%.1f')

cbar.set_label(clabel)
f.colorbar(ax, cbar)
if save:
    p.savefig('TTGM-11.png'.format(cmap), bbox_inches='tight', dpi=400)
    # This gets rid of the weird aliasing effect for the PDF, but introduces some anomalous things into the png
        p.setp(l1.get_texts(),color='r')
        l2 = ax11.legend(loc='lower right',fontsize=10,title=legtitle)
        p.setp(l2.get_title(),fontsize=10)
        ax11.add_artist(l1)
        ax12.set_xlabel('$\\phi^\\circ$')
        ax12.set_ylabel('$\\mathcal{T}$\n$(\\mathsf{ksi})$')
        ax12.set_ylim([0,1.2*n.max(limloads[:,1])])
        ax12.set_xlim(left=0)
        l1 = ax12.legend([m22,m21],["Station 2", "LL"],loc='upper right',numpoints=1,fontsize=10,frameon=False)
        p.setp(l1.get_texts(),color='r')
        l2 = ax12.legend(loc='lower right',fontsize=10,title=legtitle)
        p.setp(l2.get_title(),fontsize=10)
        ax12.add_artist(l1)
        
        p.sca(ax11)
        ff.myax(fig1,ff.ksi2Mpa,'$\\Sigma$\n$(\\mathsf{MPa})$')
        p.sca(ax12)
        ff.myax(fig1,ff.ksi2Mpa,'$\\mathcal{T}$\n$(\\mathsf{MPa})$')

        if savefigs:
            fig1.savefig('{}/1 - Sts-Delta-Rot.png'.format(savepath),dpi=125)
            #p.close()

    ##################################################
    # Figure 2 - Epsilon-Gamma
    ##################################################
    if G == 0:
        p.style.use('mysty-sub')
        fig2 = p.figure(2,facecolor='w',figsize=(8,12) )
        ax21 = fig2.add_subplot(2,1,1)
        ax22 = fig2.add_subplot(2,1,2)
Пример #21
0
#[4]d/Lg lo, [5]d/Lg hi, [6,7,8]S11,22,33,
# [9,10,11]LE11,22,33, [12]Vol'

loc = n.argmax(d[1])

d = d[:, :loc + 1]

# Ax vs hoop sts
fig1 = p.figure()
ax1 = fig1.add_subplot(111)
ax1.plot(d[3], d[2], label='Nominal')
ax1.plot(d[7], d[8], label='True')
ax1.set_xlabel('$\\sigma_\\theta$ (ksi)')
ax1.set_ylabel('$\\sigma_\\mathsf{x}$\n(ksi)')
ax1.legend(loc='lower right')
f.myax(ax1)

# Ax sts vs ax stn
fig2, ax21, ax22 = f.make12()
ax21.plot(d[4], d[2], label='$\\delta/\\mathsf{L}$')
ax21.plot(d[11], d[2], label='$e_\\mathsf{x}$')
[i.set_visible(False) for i in ax21.xaxis.get_ticklabels()[::2]]
ax21.set_xlabel('$\\epsilon_\\mathsf{x}$')
ax21.set_ylabel('$\\sigma_\\mathsf{x}$\n(ksi)')
ax21.legend(loc='lower right')
f.myax(ax21)

ax22.plot(d[10], d[3])
ax22.set_xlabel('$\\mathsf{e}_\\theta$')
ax22.set_ylabel('$\\sigma_\\theta$\n(ksi)')
f.myax(ax22)
Пример #22
0
        ax12.set_ylim([0, 1.2 * n.max(limloads[:, 1])])
        ax12.set_xlim(left=0)
        l1 = ax12.legend([m22, m21], ["Station 2", "LL"],
                         loc='upper right',
                         numpoints=1,
                         fontsize=10,
                         frameon=False)
        p.setp(l1.get_texts(), color='r')
        l2 = ax12.legend(loc='lower right',
                         fontsize=10,
                         title='Expt; $\\alpha$; Tube')
        p.setp(l2.get_title(), fontsize=10)
        ax12.add_artist(l1)

        p.sca(ax11)
        ff.myax(fig1, ff.ksi2Mpa, '$\\Sigma$\n$(\\mathsf{MPa})$')
        p.sca(ax12)
        ff.myax(fig1, ff.ksi2Mpa, '$\\mathcal{T}$\n$(\\mathsf{MPa})$')

        if savefigs:
            #fig1.savefig('{}/1 - Sts-Delta-Rot.png'.format(savepath),dpi=125)
            #fig1.savefig('{}/1 - Sts-Delta-Rot.pdf'.format(savepath),dpi=125)
            p.close()

    ##################################################
    # Figure 2 - Epsilon-Gamma
    ##################################################
    if G == 0:
        p.style.use('mysty-sub')
        p.rcParams['axes.prop_cycle'] = cycler('color', colors)
        fig2 = p.figure(2, facecolor='w', figsize=(8, 12))