Ejemplo n.º 1
0
import matplotlib.pyplot as plt
from rebound import SimulationArchive, Particle, Simulation

from extradata import ExtraData
from utils import filename_from_argv, plot_settings, is_ci

plot_settings()

fn = filename_from_argv()
sa = SimulationArchive(str(fn.with_suffix(".bin")))
ed = ExtraData.load(fn)
print(ed.meta)

data = {}
sim: Simulation
print(f"{len(sa)} Snapshots found")
for sim in sa:
    t = sim.t
    for pn in range(1, sim.N):
        part: Particle = sim.particles[pn]
        hash = part.hash.value
        if hash not in data:
            data[hash] = ([], [])
        data[hash][0].append(t)
        data[hash][1].append(part.a)

for name, d in data.items():
    times, values = d
    print(list(map(len, [times, values])))
    if False:
        plt.scatter(times, values, label=name, s=.9)
Ejemplo n.º 2
0
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from imageio import imread

import sys

sys.path.insert(0, "../")

import linear_regression
import utils
import stat_tools
import crossvalidation
import bootstrap
from FrankeFunction import FrankeFunction

utils.plot_settings()  # LaTeX fonts in Plots!


def terrain_analysis_plots(
    spacing=100,
    max_degree=20,
    n_lambdas=30,
    k_folds=5,
    n_bootstraps=50,
    do_boot=False,
    do_subset=False,
):

    # Setting up the terrain data:
    # Note structure! X-coordinates are on the rows of terrain_data
    # Point_selection.flatten() moves most rapidly over the x-coordinates