示例#1
0
def pl3d(im):
    """
    ir = pyfits.getdata("/home/fvidal/data/Run2015/June2015_27_onsky/ir/ir_2015-06-28_06h27m40s_script44_gain.fits")

    JAMAIS TESTEE !!!!!!!!!!!!!!

    """
    X = np.arange(-5, 5, 0.25)
    Y = np.arange(-5, 5, 0.25)
    X, Y = np.meshgrid(X, Y)
    Z = im
    plt.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
    plt.show()
def mesh_plot(plt, X, Y, Z, title):
    plt.plot_surface(X, Y, Z, rstride=1, cstride=1, alpha=0.7, cmap=cm.jet)
    # DEBUG plt.plot_wireframe(X, Y, Z, rstride=1, cstride=1)
    plt.contourf(X, Y, Z, zdir='z', cmap=cm.jet,
                 offset=-400)  # These used to use coolwarm
    plt.contourf(X, Y, Z, zdir='x', cmap=cm.jet, offset=41.6)
    plt.contourf(X, Y, Z, zdir='y', cmap=cm.jet, offset=-87.4)
    plt.set_xlabel('Lat')
    plt.set_xlim(41.6, 42.2)
    plt.set_ylabel('Long')
    plt.set_ylim(-88.0, -87.4)
    plt.set_zlabel('Number of Crimes')
    plt.set_zlim(-100, 1000)
    plt.set_title(f'{title}')
示例#3
0
import embrace_setup as ep
from fft_funcs import *
import break_on_lics as bol
import matplotlib.pyplot as plt


vals = ep.get_lists("5step.csv")

ac_mag = vals[4]

x = []
y = []
z = []

for s_s in range(50):
    for i in range(1,11):
        lics, hics = bol.get_lics(ac_mag,s_s,i*.1)
        x.append(s_s)
        y.append(i)
        z.append(len(hics))

plt.plot_surface(x,y,z)
plt.show()



plt.subplot(gs[0])

xmin = -2.0
xmax = 10.5
ymin = -2.0
ymax = 10.5
dx = 0.1
ep = 1.0e-5
x = np.arange(xmin, xmax + ep, dx)
y = np.arange(ymin, ymax + ep, dx)
X, Y = np.meshgrid(x, y)
t = np.arange(xmin, xmax, 0.1)
Z = problemFunc(X, Y, Q, c)
# plt.pcolor(X, Y, Z, cmap="Oranges")
# plt.contourf(X, Y, Z, 15, cmap="Oranges")
plt.plot_surface(X, Y, Z, cmap='bwr', linewidth=0)
# area1x = [-6, 1, 0, 0, 3, 6, 6, 12, 12, -6]
# area1y = [4, 4, 2, 0, 0, 3, 4, 4, -6, -6]
# plt.fill(area1x,area1y,color="gray",alpha=0.4)
# area1x = [-6, 12, 12, -6]
# area1y = [4, 4, 12, 12]
# plt.fill(area1x,area1y,color="gray",alpha=0.4)
plt.xlabel("x1")
plt.ylabel("x2")

plt.plot(t, np.zeros(len(t)), 'k')
plt.plot(np.zeros(len(t)), t, 'k')
plt.axis([xmin, xmax, ymin, ymax])

plt.title("-nu * log(x)")
plt.grid()
示例#5
0
        pass


perceptron = Model()
perceptron.fit(X, y)
"""
fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(x, y, z)
"""

x_points = np.linspace(4, 7, 10)
y_ = -(perceptron.w[0] * x_points + perceptron.b) / perceptron.w[1]
plt.plot(x_points, y_)

plt.plot_surface(data[:50, 0],
                 data[:50, 1],
                 data[:50, 1],
                 'bo',
                 color='blue',
                 label='0')
plt.plot_surface(data[50:100, 0],
                 data[50:100, 1],
                 data[:50, 1],
                 'bo',
                 color='orange',
                 label='1')
plt.xlabel('sepal length')
plt.ylabel('sepal width')
plt.legend()
plt.show()
示例#6
0
Z_3 = (-w[0] * X - w[3] * Y) / w[-1]
Z_4 = (-w[1] * X - w[2] * Y) / w[-1]
Z_5 = (-w[1] * X - w[3] * Y) / w[-1]
Z_6 = (-w[2] * X - w[3] * Y) / w[-1]

fig.add_subplot(321, projection='3d')
ax.plot_surface(X, Y, Z_1, cmap=plt.cm.ocean, linewidth=0, antialiased=False)

plt.scatter(x_data[:, 0],
            x_data[:, 1],
            x_data[:, 2],
            c=y_data,
            cmap=plt.cm.Dark2)

fig.add_subplot(322, projection='3d')
plt.plot_surface(X, Y, Z_2, cmap=plt.cm.ocean, linewidth=0, antialiased=False)

plt.scatter(x_data[:, 0],
            x_data[:, 1],
            x_data[:, 2],
            c=y_data,
            cmap=plt.cm.Dark2)

fig.add_subplot(323, projection='3d')
plt.plot_surface(X, Y, Z_3, cmap=plt.cm.ocean, linewidth=0, antialiased=False)

plt.scatter(x_data[:, 0],
            x_data[:, 1],
            x_data[:, 2],
            c=y_data,
            cmap=plt.cm.Dark2)
示例#7
0
ax1 = fig.add_subplot(111)
ax1.plot(gfile['lcfs'][:,0], gfile['lcfs'][:,1])
gfile['psiRZn']
ax1.plot(gfile['R'], gfile['Z'], '.')
ax1.clear()
ax1.plot(gfile['lcfs'][:,0], gfile['lcfs'][:,1])
RR, ZZ = np.meshgrid(gfile['R'], gfile['Z'])
zip(RR, ZZ)
list(zip(RR, ZZ))
points = np.vstack(RR.ravel(), ZZ.ravel())
points = np.vstack([RR.ravel(), ZZ.ravel()])
points
ax1.scatter(RR, ZZ)
gfile['lcfs']
plt.plot(RR, ZZ, gfile['psiRZn'])
plt.plot_surface(RR, ZZ, gfile['psiRZn'])
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(RR, ZZ, gfile['psiRZn'])
x = gfile['R']
y = gfile['Z']
data = gfile['psiRZn']
from scipy.interpolate import RegularGridInterpolator
my_f = RegularGridInterpolator((x, y), data)
my_f
testr
testz
my_f(testr, testz)
my_f((testr, testz))
div