示例#1
0
def plotChainStress():
    """ atomStress() ploting graphix chain stress """
    xfile0 = '{}'.format(namespace.xfile[0])
    xfile1 = '{}'.format(namespace.xfile[1])
    xfile2 = '{}'.format(namespace.xfile[2])
    xfile3 = '{}'.format(namespace.xfile[3])
    xfile4 = '{}'.format(namespace.xfile[4])
    xfile5 = '{}'.format(namespace.xfile[5])
    xfile6 = '{}'.format(namespace.xfile[6])
    xfile7 = '{}'.format(namespace.xfile[7])
    xfile8 = '{}'.format(namespace.xfile[8])
    xfile9 = '{}'.format(namespace.xfile[9])

    l = (computeDist(xfile0, xfile1) + computeDist(xfile1, xfile2) + computeDist(xfile2, xfile3) + computeDist(xfile3,
                                                                                                               xfile4) + computeDist(
        xfile4, xfile5) + computeDist(xfile5, xfile6) + computeDist(xfile6, xfile7) + computeDist(xfile7,
                                                                                                  xfile8) + computeDist(
        xfile8, xfile9))

    epsilon = (l - l[0]) / l[0]

    v = (l + 1.34) * np.pi

    if namespace.stressdia:
        time = np.array(getColumn(pfile, 0)).astype(float) * 0.001
        p1 = pxx / v
        p2 = pyy / v
        p3 = pzz / v

        if namespace.toforce:
            p1 = np.pi * p1 / 100
            p2 = np.pi * p2 / 100
            p3 = np.pi * p3 / 100

        plt.figure(title)
        plt.title(title)
        plt.xlabel(xlabel)
        plt.ylabel(ylabel)
        plt.grid(True)

        from operator import itemgetter

        list1 = epsilon
        list2 = p2
        x, y = [list(x) for x in zip(*sorted(zip(list1, list2), key=itemgetter(0)))]

        # plt.plot(l, p1, 'b', label=l1)
        plt.plot(x, y, 'rx', label=l2)
        # plt.plot(l, p3, 'g', label=l3)

        if namespace.sumfilter:
            sumfsignal = noiseFilterPlot(time, p2)
            if namespace.plotpeaks:
                peak = plotPeaks(time, sumfsignal, 800, 20, 200, 5900)

        if namespace.windowfit:
            plotPolinom2Window(l, p1, c1[0], c1[1], c1[2], c1[3], 'k--')
            plotPolinom2Window(l, p2, c2[0], c2[1], c2[2], c2[3], 'k-')

    if namespace.stresstime:
        time = np.array(getColumn(pfile, 0)).astype(float) * 0.001
        p1 = pxx / v
        p2 = pyy / v
        p3 = pzz / v

        if namespace.toforce:
            p1 = np.pi * p1 / 100
            p2 = np.pi * p2 / 100
            p3 = np.pi * p3 / 100

        plt.figure(title)
        plt.title(title)
        plt.xlabel(xlabel)
        plt.ylabel(ylabel)
        plt.grid(True)

        plt.plot(time, p1, 'b', label=l1)
        plt.plot(time, p2, 'r', label=l2)
        plt.plot(time, p3, 'g', label=l3)

        if namespace.sumfilter:
            sumfsignal = noiseFilterPlot(time, p2)
            if namespace.plotpeaks:
                peak = plotPeaks(time, sumfsignal, 800, 20, 200, 5900)

        if namespace.windowfit:
            plotPolinom2Window(time, p1, c1[0], c1[1], c1[2], c1[3], 'k--')
            plotPolinom2Window(time, p2, c2[0], c2[1], c2[2], c2[3], 'k-')
    if namespace.plotpeaks:
        return peak
示例#2
0
def plotAtomStress():
    """ TODO atomStress() ploting graphix single atom stress
    """
    if namespace.true:
        xfile0 = '{}'.format(namespace.xfile[0])
        xfile1 = '{}'.format(namespace.xfile[1])
        xfile2 = '{}'.format(namespace.xfile[2])
        l1 = computeDist(xfile0, xfile1)
        l2 = computeDist(xfile1, xfile2)

        v = (0.5 * l1 + 0.5 * l2) * np.pi
        time = np.array(getColumn(pfile, 0)).astype(float) * 0.001

        p1 = pxx / v
        p2 = pyy / v
        p3 = pzz / v

        if namespace.toforce:
            p1 = np.pi * p1 / 100
            p2 = np.pi * p2 / 100
            p3 = np.pi * p3 / 100

        plt.figure(title)
        plt.title(title)
        plt.xlabel(xlabel)
        plt.ylabel(ylabel)
        plt.grid(True)

        plt.plot(time, p1, 'b')
        plt.plot(time, p2, 'r')
        plt.plot(time, p3, 'g')

        if namespace.sumfilter:
            sumfsignal = noiseFilterPlot(time, p2)
            if namespace.plotpeaks:
                peak = plotPeaks(time, sumfsignal, 800, 20, 200, 5900)

        if namespace.windowfit:
            plotPolinom2Window(time, p1, c1[0], c1[1], c1[2], c1[3], 'k--')
            plotPolinom2Window(time, p2, c2[0], c2[1], c2[2], c2[3], 'k-')

    if namespace.conditional:
        v = 1.34 * np.pi
        time = np.array(getColumn(pfile, 0)).astype(float) * 0.001

        p1 = pxx / v
        p2 = pyy / v
        p3 = pzz / v

        if namespace.toforce:
            p1 = np.pi * p1 / 100
            p2 = np.pi * p2 / 100
            p3 = np.pi * p3 / 100

        plt.figure(title)
        plt.title(title)
        plt.xlabel(xlabel)
        plt.ylabel(ylabel)
        plt.grid(True)

        plt.plot(time, p1, 'b')
        plt.plot(time, p2, 'r')
        plt.plot(time, p3, 'g')

        if namespace.sumfilter:
            sumfsignal = noiseFilterPlot(time, p2)
            if namespace.plotpeaks:
                peak = plotPeaks(time, sumfsignal, 800, 20, 200, 5900)

        if namespace.windowfit:
            plotPolinom2Window(time, p1, c1[0], c1[1], c1[2], c1[3], 'k--')
            plotPolinom2Window(time, p2, c2[0], c2[1], c2[2], c2[3], 'k-')
    if namespace.plotpeaks:
        return peak