コード例 #1
0
ファイル: fpqTraceMap.py プロジェクト: Leguark/map2loop
        bFilename = True
    #   line colour for traces
    if "-C" in sArg:
        sColour = sArg[2:]
    #   grid on
    if "-G" in sArg:
        bGrid = True
    #   nodes on
    if "-N" in sArg:
        bNode = True
#   filename is mandatory
if not bFilename:
    sys.exit('Usage: python3 fpqTraceMap.py -I<inputfilename>')

#   get the x,y nodes from the file
nodes = fpq.getNodes(fn)
nodexlist = nodes[0]
nodeylist = nodes[1]

#   get some stats
nTraces = int(len(nodexlist))
nNodes = int(sum(len(x) for x in nodexlist))
#   get plot limits
nodelist = nodexlist.copy()
nodelist.extend(nodeylist.copy())
xmin, xmax, ymin, ymax = fpq.getPlotLimits(nodelist)

#   plot the traces
plt.figure(figsize=(6, 6))
for node in range(0, len(nodexlist)):
    plt.plot(nodexlist[node], nodeylist[node], sColour)
コード例 #2
0
    #   sigma1 stress
    if "-S1" in sArg:
        fSigma1 = float(sArg[3:])
    #   sigma2 stress
    if "-S2" in sArg:
        fSigma2 = float(sArg[3:])
    #   theta, in degrees
    if "-T" in sArg:
        fTheta = float(sArg[2:])

#   filename is mandatory
if not bFilename:
    sys.exit('Usage: python3 fpqSlipTendency.py -I<inputfilename>')

#   get the x,y nodes & calculate angles from the file data
nodelist = fpq.getNodes(fn)
xnodelist = nodelist[0]
ynodelist = nodelist[1]
segangle = fpq.getSegAngles(xnodelist, ynodelist)

#   get the cmocean 'thermal' colour map, scaled from 0-100%
start = 0.0
stop = 1.0
number_of_lines = 101
cm_subsection = np.linspace(start, stop, number_of_lines)
colours = [cmo.cm.thermal(x) for x in cm_subsection]

#   slip tendency
#   calculate max. possible slip tendency for these stresses
nAlpha = np.arange(1, 180, 1)
Tsmax = max(
コード例 #3
0
ファイル: SpaceTime.py プロジェクト: RichardScottOZ/map2loop
def plot_folds(linear_filename, bbox):
    import fracpaq as fpq
    import matplotlib.pylab as plt
    import sys
    import numpy as np

    linear = gpd.read_file(linear_filename)
    folds = linear[linear['feature'].str.contains("Fold")]
    folds = folds.dropna(subset=['geometry'])

    f = open('fold.txt', 'w')
    for inf, fold in folds.iterrows():
        for coords in fold['geometry'].coords:
            ostr = "{}\t{}\t".format(coords[0], coords[1])
            f.write(ostr)
        f.write('\n')
    f.close()

    fn = 'fold.txt'
    #   defaults
    CM2INCHES = 0.3937
    bGrid = False
    bEqualArea = False
    nBinWidth = 5
    sColour = 'C0'
    xSize = 15.0 * CM2INCHES
    ySize = 15.0 * CM2INCHES

    #   get nodes and calculate angles from nodes
    nodelist = fpq.getNodes(fn)
    xnodelist = nodelist[0]
    ynodelist = nodelist[1]
    segangle = fpq.getSegAngles(xnodelist, ynodelist)
    nSegs = len(segangle)
    if (nSegs > 0):
        #   bin the data and find maximum per bin
        nBins = int(round(360 / nBinWidth))
        segangleDoubled = np.zeros(len(segangle))
        segangleDoubled = np.copy(segangle)
        segangleDoubled = np.concatenate(
            [segangleDoubled, segangleDoubled + 180.0])
        n, b = plt.histogram(segangleDoubled, nBins)
        nMax = max(n)

        #   plot the segment angle distribution
        plt.figure(figsize=(xSize, ySize))
        plt.subplot(111, projection='polar')
        coll = fpq.rose(segangle,
                        bins=nBins,
                        bidirectional=True,
                        eqarea=True,
                        color=sColour)
        plt.xticks(np.radians(range(0, 360, 45)),
                   ['0', '45', '90', '135', '180', '215', '270', '315'])
        if (nMax > 6):
            plt.rgrids(range(0, int(round(nMax * 1.1)),
                             int(round((nMax * 1.1) / 5))),
                       angle=330)
        plt.ylim(0, int(round(nMax * 1.1)))
        plt.title('Segment strikes, n=%i' % nSegs)
        plt.savefig("folds_rose.pdf")
        #folds.plot(figsize=(7,7),edgecolor='#ff0000',linewidth=0.3)
        #print('Plotted %5d segments & angles' % nSegs)
        #plt.savefig('folds.pdf')
        plt.title('Fold axial traces')
        plt.show()