Commit d2dad773 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

worked on lmc_mppy.py

parent 098de2fa
Pipeline #71418 canceled with stage
......@@ -6,7 +6,7 @@ import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from mpp.python.mppy import Mpp, PROJECT_ROOT_DIR, PY_DATA_DIR
from mpp.python.mppy import *
SPRNG5_DIR = PROJECT_ROOT_DIR + '/sprng5'
......@@ -43,7 +43,7 @@ class MLMCMpp(Mpp):
stdout = subprocess.Popen(['make', '-j'], cwd=SPRNG5_DIR,
stdout=subprocess.PIPE)
self.print_stdout(stdout, silent)
return 'Process finished with exit code 0'
def build(self, silent=False):
self.build_sprng5(silent)
......@@ -209,7 +209,7 @@ class MLMCMpp(Mpp):
self.plot_convergence_table(df, axes, label)
if plot_name is not None:
path = PY_DATA_DIR + 'Convergence_{}_{}.png'.format(plot_name, self.now)
path = PROJECT_PY_DATA_DIR + 'Convergence_{}_{}.png'.format(plot_name, self.now)
plt.savefig(path)
else:
plt.show()
......@@ -227,7 +227,7 @@ class MLMCMpp(Mpp):
self.plot_mlmc_table(df, axes)
if plot_name is not None:
path = PY_DATA_DIR + 'MLMC_{}_{}.png'.format(plot_name, self.now)
path = PROJECT_PY_DATA_DIR + 'MLMC_{}_{}.png'.format(plot_name, self.now)
plt.savefig(path)
else:
plt.show()
......@@ -263,16 +263,21 @@ class MLMCMpp(Mpp):
def save_convergence_table(self, df=None, table_name=None):
self.create_convergence_table_from_log(df)
path = PY_DATA_DIR + 'Convergence_{}_{}.csv'.format(table_name, self.now)
path = PROJECT_PY_DATA_DIR + 'Convergence_{}_{}.csv'.format(table_name, self.now)
df.to_csv(path)
def save_mlmc_table(self, df, table_name=None):
self.create_mlmc_table_from_log(df)
path = PY_DATA_DIR + 'MLMC_{}_{}.csv'.format(table_name, self.now)
path = PROJECT_PY_DATA_DIR + 'MLMC_{}_{}.csv'.format(table_name, self.now)
df.to_csv(path)
def clean_sprng5(self):
self.clean_directory(SPRNG5_DIR, False)
mlmc_mpp = MLMCMpp()
mpp = MLMCMpp()
if __name__ == "__main__":
# mpp.kill()
mpp.clean_build()
mpp.build()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment