Ejemplo n.º 1
0
import matplotlib.pyplot as plt
import matplotlib.tri as tri
from matplotlib.lines import Line2D
import numpy as np
import math

from pyutils import readfile, column, checkPtInside


def trArea(x, y):
    return (abs(x[0] * (y[1] - y[2]) + x[1] * (y[2] - y[0]) + x[2] *
                (y[0] - y[1])) / 2.0)


xyc, nl = readfile('data/cali.dat')
xc = np.array(column(xyc, 0))
yc = np.array(column(xyc, 1))

xy, nl = readfile('data/cali_cvt_4096.dat')
x = np.array(column(xy, 0))
y = np.array(column(xy, 1))

# Create the Triangulation; no triangles so Delaunay triangulation created.
triang = tri.Triangulation(x, y)

# Mask off unwanted triangles.
xmid = x[triang.triangles].mean(axis=1)
ymid = y[triang.triangles].mean(axis=1)
mask = checkPtInside(xc, yc, xmid, ymid)
triang.set_mask(mask)
Ejemplo n.º 2
0
        ctype = sys.argv[2]
        clen  = sys.argv[3]
    if ( rtype == "numcov2D" ) | ( rtype == "numcov2Du" ) :
        clen  = sys.argv[2]
        nreal = sys.argv[3]
    if ( rtype == "anlKLevec2D" ) | ( rtype == "anlKLevec2Du" ):
        ctype = sys.argv[2]
        clen  = sys.argv[3]
    if ( rtype == "numKLevec2D" ) | (rtype == "numKLevec2Du" ) :
        clen  = sys.argv[2]
        nreal = sys.argv[3]

if rtype == "samples":
    fname = "cvspl_"+clen+"_512/samples_"+clen+"_512.dat"
    print "Processing file ",fname
    din,nliles=readfile(fname);
    # Plot samples
    fs1=18
    lw1=2
    xp=column(din,0);
    fig = plt.figure(figsize=(4,4))
    ax = fig.add_axes([0.19, 0.13, 0.76, 0.82]) 
    for i in range(1,Npl+1):
        plt.plot(xp,column(din,i),linewidth=lw1)
    plt.xlabel('$x$',fontsize=fs1)
    plt.ylabel(r'$F(x,\theta)$',fontsize=fs1)
    ax.set_ylim([-4*sigma,4*sigma])
    ax.set_yticks([-4*sigma,-2*sigma,0,2*sigma,4*sigma])
    plt.savefig("rf1D_"+clen+".pdf")

if rtype == "pltKLeig1D":
Ejemplo n.º 3
0
import os
import sys
import numpy as np
from scipy import stats
import matplotlib
import matplotlib.pylab as plt
from pylab import *

from pyutils import readfile, column

if (len(sys.argv) > 1):
    dir = sys.argv[1]
else:
    print "Need 1 arguments: directory"

x, nx = readfile(dir + "/xgrid.dat")
y, ny = readfile(dir + "/ygrid.dat")
x = column(x, 0)
y = column(y, 0)

fig = plt.figure(figsize=(4, 4))
ax = fig.add_axes([0.05, 0.05, 0.9, 0.9])
ax.set_xticks(x)
ax.set_yticks(y)
ax.set_xticklabels([])
ax.set_yticklabels([])
grid(True)
ticklines = ax.get_xticklines()
ticklines.extend(ax.get_yticklines())
gridlines = ax.get_xgridlines()
gridlines.extend(ax.get_ygridlines())
Ejemplo n.º 4
0
        ctype = sys.argv[2]
        clen = sys.argv[3]
    if (rtype == "numcov2D") | (rtype == "numcov2Du"):
        clen = sys.argv[2]
        nreal = sys.argv[3]
    if (rtype == "anlKLevec2D") | (rtype == "anlKLevec2Du"):
        ctype = sys.argv[2]
        clen = sys.argv[3]
    if (rtype == "numKLevec2D") | (rtype == "numKLevec2Du"):
        clen = sys.argv[2]
        nreal = sys.argv[3]

if rtype == "samples":
    fname = "cvspl_" + clen + "_512/samples_" + clen + "_512.dat"
    print("Processing file ", fname)
    din, nliles = readfile(fname)
    # Plot samples
    fs1 = 18
    lw1 = 2
    xp = column(din, 0)
    fig = plt.figure(figsize=(4, 4))
    ax = fig.add_axes([0.19, 0.13, 0.76, 0.82])
    for i in range(1, Npl + 1):
        plt.plot(xp, column(din, i), linewidth=lw1)
    plt.xlabel('$x$', fontsize=fs1)
    plt.ylabel(r'$F(x,\theta)$', fontsize=fs1)
    ax.set_ylim([-4 * sigma, 4 * sigma])
    ax.set_yticks([-4 * sigma, -2 * sigma, 0, 2 * sigma, 4 * sigma])
    plt.savefig("rf1D_" + clen + ".pdf")

if rtype == "pltKLeig1D":