Esempio n. 1
0
cos = []
newcos = []
ecdf = []
residues = []
residues_fit = []
a2 = []
a2_std = []
a2_bs = []

for k, (a, b, c) in enumerate(zip(aa, bb, cc)):
    f = partial(ellipsoid, a=a, b=b, c=c)
    print(k)
    for rseed in range(nseed):
        np.random.seed(rseed)
        x, t, u, St, Su = r_surface(Nran, f, *domain_t, *domain_u, 20, 20)
        xs = x[0, :]
        ys = x[1, :]
        zs = x[2, :]

        cos.append(get_cos(xs, ys, zs))
        newcos_, ecdf_, y_ = ecdf_residues(cos[-1])
        newcos.append(newcos_)
        ecdf.append(ecdf_)
        residues.append(y_)

        yfit_, d_yfit, a2_ = fits(newcos_, y_)
        residues_fit.append(yfit_)

        for i in range(Nbs):
            c_bs = np.random.choice(cos[-1], size=len(cos[-1]))
Esempio n. 2
0
#%%

# GENERATE POINTS UNIFORMLY DISTRIBUTED ON THE SURFACE OF AN ELLIPSE
# + VISUALIZE


def ellipsoid(t, u, a=1, b=1, c=1.1):
    return np.array(
        [a * np.sin(u) * np.cos(t), b * np.sin(u) * np.sin(t), c * np.cos(u)])


domain_t = [0, 2 * np.pi]
domain_u = [0, np.pi]

# Get random points
x, t, u, St, Su = r_surface(2000, ellipsoid, *domain_t, *domain_u, 20, 20)

# Set up plot
fig = plt.figure(figsize=(10, 10))
fig.subplots_adjust(hspace=0, wspace=0.1, bottom=.2)
ax = fig.add_subplot(111, projection='3d')
ax.set_xlim(-1.3, 1.3)
ax.set_ylim(-1.3, 1.3)
ax.set_zlim(-1.3, 1.3)

# Plot random points
ax.scatter(*x, marker='o', alpha=0.3, color='cadetblue')

# Plot function
shape_t, shape_u = np.meshgrid(np.linspace(*domain_t, 25),
                               np.linspace(*domain_u, 25))