Beispiel #1
0
from os import path
import sys

sys.path.append(path.split(path.split(path.abspath(__file__))[0])[0])
from python_scripts.experiment import Experiment

if __name__ == "__main__":
    experiment_path = sys.argv[1]

    exp = Experiment(experiment_path)
    exp.save_xyz(experiment_path)
Beispiel #2
0
    fig = temperature.get_figure(experiment)
    plt.savefig(path.join(images_path, 'temperature.' + image_format), dpi=dpi)
    plt.close(fig)

    fig = pressure.get_figure(experiment)
    plt.savefig(path.join(images_path, 'pressure.' + image_format), dpi=dpi)
    plt.close(fig)

    fig = energies.get_figure(experiment)
    plt.savefig(path.join(images_path, 'energies.' + image_format), dpi=dpi)
    plt.close(fig)

    fig = diffusion.get_figure(experiment)
    plt.savefig(path.join(images_path, 'diffusion.' + image_format), dpi=dpi)
    plt.close(fig)

    fig = radial_distr.get_figure(experiment)
    plt.savefig(path.join(images_path, 'radial_distr.' + image_format),
                dpi=dpi)
    plt.close(fig)


if __name__ == "__main__":
    experiment_path = sys.argv[1]
    if not path.exists(path.join(experiment_path, 'images')):
        os.mkdir(path.join(experiment_path, 'images'))

    gen_images(Experiment(experiment_path), path.join(experiment_path,
                                                      'images'))
Beispiel #3
0
sys.path.append(path.split(path.split(path.abspath(__file__))[0])[0])
from python_scripts.experiment import Experiment


def get_figure(exp):
    fig, ax = plt.subplots(1, 1, figsize=(8, 8))
    fig.suptitle('Pressure stabilization and fluctuations', fontsize=20)
    fig.subplots_adjust(bottom=0.1, left=0.1, right=0.95, top=0.90)
    ax.set_xlabel('time, $\sigma \sqrt{m / \epsilon}$', fontsize=14)
    ax.set_ylabel(r'$P, \epsilon / \sigma^3$', fontsize=14)
    ax.ticklabel_format(axis='x', style='sci', scilimits=(-1, 3))

    mean_press = np.mean(exp.pressures)
    std_press = np.std(exp.pressures)

    ax.plot(exp.ts, exp.pressures, 'ro', ms=2)
    ax.plot([exp.ts[0], exp.ts[-1]], [mean_press + std_press] * 2, 'g-', lw=2)
    ax.plot([exp.ts[0], exp.ts[-1]], [mean_press - std_press] * 2, 'g-', lw=2)

    return fig


if __name__ == '__main__':
    experiment_path = sys.argv[1]

    experiment = Experiment(experiment_path)

    fig = get_figure(experiment)
    plt.show()
Beispiel #4
0
import sys

sys.path.append(path.split(path.split(path.abspath(__file__))[0])[0])
from python_scripts.experiment import Experiment
from python_scripts import results


def gen_results(experiment, save_path):
    results.put("E_full", np.mean(experiment.energies),
                np.std(experiment.energies), save_path)

    kin_energies = np.sum(np.linalg.norm(experiment.vels, axis=2)**2 / 2,
                          axis=1)
    mean_kin_energy = np.mean(kin_energies)
    std_kin_energy = np.std(kin_energies)
    results.put("E_kin/E_full", mean_kin_energy / np.mean(experiment.energies),
                0, save_path)

    results.put("temperature",
                2 / 3 * mean_kin_energy / experiment.num_particles,
                2 / 3 * std_kin_energy / experiment.num_particles, save_path)

    results.put("pressure", np.mean(experiment.pressures),
                np.std(experiment.pressures), save_path)


if __name__ == "__main__":
    experiment_path = sys.argv[1]

    gen_results(Experiment(experiment_path), experiment_path)
Beispiel #5
0
import shutil
import stat
import sys
from datetime import datetime

sys.path.append(path.split(path.split(path.abspath(__file__))[0])[0])
from python_scripts import gen_images, gen_results
from python_scripts.experiment import Experiment

print("Replacing files...")
c_path = sys.argv[1]
if path.exists(path.join(c_path, 'data.bin')):
    experiments_path = sys.argv[2]
    new_dir_name = datetime.strftime(datetime.now(), "%y.%m.%d-%H:%M:%S")
    os.mkdir(path.join(experiments_path, new_dir_name))
    shutil.move(path.join(c_path, 'data.bin'),
                path.join(experiments_path, new_dir_name, 'data.bin'))
    shutil.move(path.join(c_path, 'log.txt'),
                path.join(experiments_path, new_dir_name, 'log.txt'))
    os.chdir(path.join(experiments_path, new_dir_name))

print("Importing data...")
experiment = Experiment('.')

print("Generating results...")
gen_results.gen_results(experiment, ".")

print("Generating images...")
os.mkdir("images")
gen_images.gen_images(experiment, 'images')
Beispiel #6
0
import os
from os import path
import sys
import numpy as np

sys.path.append(path.split(path.split(path.abspath(__file__))[0])[0])
from python_scripts.experiment import Experiment
from python_scripts import gen_images, gen_results

if __name__ == "__main__":
    experiment_path = sys.argv[1]
    start_time = float(sys.argv[2])

    exp = Experiment(experiment_path)
    exp.cut(slice(np.argmax(exp.ts > start_time), exp.num_frames + 1))
    exp.save_pickle(experiment_path)

    os.mkdir(path.join(experiment_path, 'images (cut)'))
    gen_images.gen_images(exp, path.join(experiment_path, 'images (cut)'))
    gen_results.gen_results(exp, experiment_path)
Beispiel #7
0
    vs = np.mean(np.linalg.norm(exp1.vels - exp2.vels, axis=2)**2,
                 axis=1) / np.sqrt(3 * np.mean(exp1.temperature))

    # popt, pcov = curve_fit(lambda x, a, b: a * np.exp(b * x),
    #                       xdata=exp1.ts, ydata=)

    fig, ax = plt.subplots(1, 1, figsize=(12, 6))
    fig.subplots_adjust(bottom=0.1, left=0.05, right=0.95, top=0.92)
    fig.suptitle("...", fontsize=20)

    ax.set_xlabel(r"$t$, ", fontsize=14)
    ax.ticklabel_format(style='sci', scilimits=(-2, 2))
    ax.set_yscale('log')

    ax.plot(exp1.ts, rs, 's', label=r'$\left\langle \Delta r^2 \right\rangle$')
    ax.plot(exp1.ts, vs, '^', label=r'$\left\langle \Delta v^2 \right\rangle$')

    ax.legend()

    return fig


if __name__ == "__main__":
    experiment1_path = sys.argv[1]
    experiment2_path = sys.argv[2]

    experiment1 = Experiment(experiment1_path)
    experiment2 = Experiment(experiment2_path)
    fig = get_figure(experiment1, experiment2)
    plt.show()