Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-microstructure
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klaus Böhnlein
dune-microstructure
Commits
7c1909f1
Commit
7c1909f1
authored
1 year ago
by
Klaus Böhnlein
Browse files
Options
Downloads
Patches
Plain Diff
Add new script for perforated bilayer plot
parent
5aa42a5b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Plot-Scripts/PerforatedBilayerPlot.py
+205
-0
205 additions, 0 deletions
Plot-Scripts/PerforatedBilayerPlot.py
with
205 additions
and
0 deletions
Plot-Scripts/PerforatedBilayerPlot.py
0 → 100644
+
205
−
0
View file @
7c1909f1
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
math
import
os
import
subprocess
import
fileinput
import
re
import
sys
import
matplotlib
as
mpl
from
mpl_toolkits.mplot3d
import
Axes3D
import
matplotlib.cm
as
cm
import
matplotlib.ticker
as
ticker
from
matplotlib.ticker
import
MultipleLocator
,
FormatStrFormatter
,
MaxNLocator
import
seaborn
as
sns
import
matplotlib.colors
as
mcolors
import
codecs
import
json
# ----------------------------------------------------
# --- Define Plot style:
plt
.
style
.
use
(
"
seaborn
"
)
mpl
.
rcParams
[
'
text.usetex
'
]
=
True
mpl
.
rcParams
[
"
font.family
"
]
=
"
serif
"
mpl
.
rcParams
[
"
font.size
"
]
=
"
8
"
mpl
.
rcParams
[
'
xtick.bottom
'
]
=
True
mpl
.
rcParams
[
'
xtick.major.size
'
]
=
3
mpl
.
rcParams
[
'
xtick.minor.size
'
]
=
1.5
mpl
.
rcParams
[
'
xtick.major.width
'
]
=
0.75
mpl
.
rcParams
[
'
xtick.labelsize
'
]
=
8
mpl
.
rcParams
[
'
xtick.major.pad
'
]
=
1
mpl
.
rcParams
[
'
ytick.left
'
]
=
True
mpl
.
rcParams
[
'
ytick.major.size
'
]
=
3
mpl
.
rcParams
[
'
ytick.minor.size
'
]
=
1.5
mpl
.
rcParams
[
'
ytick.major.width
'
]
=
0.75
mpl
.
rcParams
[
'
ytick.labelsize
'
]
=
8
mpl
.
rcParams
[
'
ytick.major.pad
'
]
=
1
mpl
.
rcParams
[
'
axes.titlesize
'
]
=
8
mpl
.
rcParams
[
'
axes.titlepad
'
]
=
1
mpl
.
rcParams
[
'
axes.labelsize
'
]
=
8
#Adjust Legend:
mpl
.
rcParams
[
'
legend.frameon
'
]
=
True
# Use frame for legend
# mpl.rcParams['legend.framealpha'] = 0.5
mpl
.
rcParams
[
'
legend.fontsize
'
]
=
8
# fontsize of legend
#Adjust grid:
mpl
.
rcParams
.
update
({
"
axes.grid
"
:
True
})
# Add grid
mpl
.
rcParams
[
'
axes.labelpad
'
]
=
3
mpl
.
rcParams
[
'
grid.linewidth
'
]
=
0.25
mpl
.
rcParams
[
'
grid.alpha
'
]
=
0.9
# 0.75
mpl
.
rcParams
[
'
grid.linestyle
'
]
=
'
-
'
mpl
.
rcParams
[
'
grid.color
'
]
=
'
gray
'
#'black'
mpl
.
rcParams
[
'
text.latex.preamble
'
]
=
r
'
\usepackage{amsfonts}
'
# Makes Use of \mathbb possible.
# ----------------------------------------------------------------------------------------
textwidth
=
6.26894
#textwidth in inch
# width = textwidth * 0.5
width
=
textwidth
height
=
width
/
1.618
# The golden ratio.
dataset_numbers
=
[
0
,
1
,
2
,
3
,
4
,
5
]
kappa_sim_upper
=
[]
#--- Choose wether to perforate upper (passive) or lower (active) layer
# perforatedLayer = 'upper'
perforatedLayer
=
'
lower
'
for
dataset_number
in
dataset_numbers
:
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
width
,
height
))
Path_KappaUpper
=
'
./experiment/perforated-bilayer/results_
'
+
perforatedLayer
+
'
_
'
+
str
(
dataset_number
)
+
'
/kappa_simulation.txt
'
# Path_KappaLower = './experiment/perforated-bilayer/results_lower_' + str(dataset_number) + '/kappa_simulation.txt'
tmp
=
open
(
Path_KappaUpper
).
read
().
split
(
"
,
"
)
# kappa_sim_lower = open(Path_KappaLower).read().split(",")
curvature
=
[
float
(
i
)
for
i
in
tmp
]
# kappa_sim_upper[dataset_number] = np.array(curvature)
kappa_sim_upper
.
append
(
np
.
array
(
curvature
))
# kappa_sim_lower = [float(i) for i in kappa_sim_lower]
input
=
[
0
,
0.05
,
0.10
,
0.15
,
0.20
,
0.25
,
0.30
]
# Design parameter (volume ratio)
# --------------- Plot Lines + Scatter -----------------------
line_1
=
ax
.
plot
(
input
,
kappa_sim_upper
[
0
],
# data
# color='forestgreen', # linecolor
marker
=
'
D
'
,
# each marker will be rendered as a circle
markersize
=
5
,
# marker size
# markerfacecolor='darkorange', # marker facecolor
markeredgecolor
=
'
black
'
,
# marker edgecolor
markeredgewidth
=
0.75
,
# marker edge width
# linestyle='dashdot', # line style will be dash line
linewidth
=
1.5
,
# line width
zorder
=
3
,
label
=
r
"
$r = 0.12$
"
)
line_2
=
ax
.
plot
(
input
,
kappa_sim_upper
[
1
],
# data
# color='forestgreen', # linecolor
marker
=
'
D
'
,
# each marker will be rendered as a circle
markersize
=
5
,
# marker size
# markerfacecolor='darkorange', # marker facecolor
markeredgecolor
=
'
black
'
,
# marker edgecolor
markeredgewidth
=
0.75
,
# marker edge width
# linestyle='dashdot', # line style will be dash line
linewidth
=
1.5
,
# line width
zorder
=
3
,
label
=
r
"
$r = 0.17$
"
)
line_3
=
ax
.
plot
(
input
,
kappa_sim_upper
[
2
],
# data
# color='forestgreen', # linecolor
marker
=
'
D
'
,
# each marker will be rendered as a circle
markersize
=
5
,
# marker size
# markerfacecolor='darkorange', # marker facecolor
markeredgecolor
=
'
black
'
,
# marker edgecolor
markeredgewidth
=
0.75
,
# marker edge width
# linestyle='dashdot', # line style will be dash line
linewidth
=
1.5
,
# line width
zorder
=
3
,
label
=
r
"
$r = 0.22$
"
)
line_4
=
ax
.
plot
(
input
,
kappa_sim_upper
[
3
],
# data
# color='forestgreen', # linecolor
marker
=
'
D
'
,
# each marker will be rendered as a circle
markersize
=
5
,
# marker size
# markerfacecolor='darkorange', # marker facecolor
markeredgecolor
=
'
black
'
,
# marker edgecolor
markeredgewidth
=
0.75
,
# marker edge width
# linestyle='dashdot', # line style will be dash line
linewidth
=
1.5
,
# line width
zorder
=
3
,
label
=
r
"
$r = 0.34$
"
)
line_5
=
ax
.
plot
(
input
,
kappa_sim_upper
[
4
],
# data
# color='orangered', # linecolor
marker
=
'
o
'
,
# each marker will be rendered as a circle
markersize
=
5
,
# marker size
# markerfacecolor='cornflowerblue', # marker facecolor
markeredgecolor
=
'
black
'
,
# marker edgecolor
markeredgewidth
=
0.75
,
# marker edge width
# linestyle='--', # line style will be dash line
linewidth
=
1.5
,
# line width
zorder
=
3
,
alpha
=
0.8
,
# Change opacity
label
=
r
"
$r=0.43$
"
)
line_6
=
ax
.
plot
(
input
,
kappa_sim_upper
[
5
],
# data
# color='forestgreen', # linecolor
marker
=
'
D
'
,
# each marker will be rendered as a circle
markersize
=
5
,
# marker size
# markerfacecolor='darkorange', # marker facecolor
markeredgecolor
=
'
black
'
,
# marker edgecolor
markeredgewidth
=
0.75
,
# marker edge width
# linestyle='dashdot', # line style will be dash line
linewidth
=
1.5
,
# line width
zorder
=
3
,
label
=
r
"
$r = 0.49$
"
)
# --------------- Set Axes -----------------------
# Plot - Title
title
=
perforatedLayer
+
'
layer perforation
'
ax
.
set_title
(
title
)
# match dataset_number:
# case 0:
# ax.set_title(r"ratio $r = 0.12$")
# case 1:
# ax.set_title(r"ratio $r = 0.17$")
# case 2:
# ax.set_title(r"ratio $r = 0.22$")
# case 3:
# ax.set_title(r"ratio $r = 0.34$")
# case 4:
# ax.set_title(r"ratio $r = 0.43$")
# case 5:
# ax.set_title(r"ratio $r = 0.49$")
ax
.
set_xlabel
(
r
"
Volume ratio
"
,
labelpad
=
4
)
ax
.
set_ylabel
(
r
"
Curvature $\kappa$
"
,
labelpad
=
4
)
plt
.
tight_layout
()
# --- Set Legend
legend
=
ax
.
legend
()
frame
=
legend
.
get_frame
()
frame
.
set_edgecolor
(
'
black
'
)
# --- Adjust left/right spacing:
# plt.subplots_adjust(right=0.81)
# plt.subplots_adjust(left=0.11)
# ---------- Output Figure as pdf:
fig
.
set_size_inches
(
width
,
height
)
fig
.
savefig
(
'
PerforatedBilayer_
'
+
perforatedLayer
+
'
.pdf
'
)
# plt.show()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment