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

added 1d plots

parent 876fac83
......@@ -226,8 +226,8 @@ class MLMCMpp(Mpp):
os.path.join(self.PROJECT_PY_DATA_DIR, 'MLMC {}.csv'.format(self.now)))
self.mlmc_df().to_csv(path)
def perm_potential_plot(self, sample_id, perm="kappa.vtk", u="u.vtk",
dpi=200.0, save_only=False):
def perm_potential_plot_2d(self, sample_id, perm="kappa.vtk", u="u.vtk",
dpi=200.0, save_only=False):
path = os.path.abspath(os.path.join(self.PROJECT_VTK_DATA_DIR, sample_id))
if not os.path.exists(path):
raise FileNotFoundError('Sample folder not found')
......@@ -246,13 +246,57 @@ class MLMCMpp(Mpp):
if not save_only:
plt.show()
#from ipywidgets import interact, interactive, fixed, interact_manual
#import ipywidgets as widgets
def perm_potential_plot_1d(self, sample_id, perm="kappa.vtk", u="u.vtk",
dpi=200.0, save_only=False): # Todo Parameter für hold on ja oder nein
if isinstance(sample_id, str):
sample_id = [sample_id]
# @interact(n=widgets.IntSlider(min=0, max=100, step=1, value=0))
# def perm_potential_plot_slider(self, n):
# p = VtkPlot(dpi=200.0)
# p.add_vtk("U.%04d.vtk" % n,vmin = 0.0, vmax = 1.0)
p = VtkPlot(figsize=(12, 4), dpi=dpi)
plt.axis('off')
gs = gridspec.GridSpec(1, 2)
for s_id in sample_id:
path = os.path.abspath(os.path.join(self.PROJECT_VTK_DATA_DIR, s_id))
if not os.path.exists(path):
raise FileNotFoundError('Sample folder {} not found'.format(path))
p.set_wd(path)
p.ax1 = p.fig.add_subplot(gs[0])
p.add_1D_vtk(perm, ax=p.ax1)
p.ax1.set_title('Permeability')
p.ax2 = p.fig.add_subplot(gs[1])
p.add_1D_vtk(u, ax=p.ax2)
p.ax2.set_title('Potential')
# png_file = os.path.abspath(os.path.join(path, 'perm_potential.png'))
# plt.savefig(png_file)
if not save_only:
plt.show()
# def summarize_plot(perm="kappa.vtk", load="load.vtk", flux="flux.vtk", u="u.vtk", quiver_filter=1,
# quiver_scale=0.25, no_mesh=False,
# dpi=400.0):
# p = VtkPlot(figsize=(8, 8), dpi=dpi)
# p.set_wd('../build/data/vtk/')
# plt.axis('off')
# gs = gridspec.GridSpec(2, 2, hspace=0.5, wspace=0.5)
# p.ax1 = p.fig.add_subplot(gs[0])
# p.add_vtk(perm, cb=True, ax=p.ax1)
# p.ax1.set_title('Permeability')
# p.ax2 = p.fig.add_subplot(gs[1])
# if not no_mesh:
# p.add_mesh(u, point_data=True, linewidth=0.1, ax=p.ax2)
# p.add_vtk(u, cb=True, ax=p.ax2)
# if no_mesh:
# p.ax2.set_title('Potential u and used Mesh')
# else:
# p.ax2.set_title('Potential u and used Mesh')
# p.ax3 = p.fig.add_subplot(gs[2])
# p.add_vtk(u, cb=True, ax=p.ax3)
# p.add_quivers(flux, quiver_filter=quiver_filter, quiver_scale=quiver_scale, ax=p.ax3)
# p.ax3.set_title('Flux q over Potential u')
# p.ax4 = p.fig.add_subplot(gs[3])
# p.add_vtk(load, cb=True, ax=p.ax4)
# p.ax4.set_title('Process load')
# plt.show()
@staticmethod
def prepare_pd_table():
......@@ -262,4 +306,8 @@ class MLMCMpp(Mpp):
plt.rcParams.update({'font.size': 14})
mpp = MLMCMpp()
Markdown is supported
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