Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
EC Tools
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MDI
EC Tools
Commits
55213c3b
Commit
55213c3b
authored
11 months ago
by
Felix Thelen
Browse files
Options
Downloads
Patches
Plain Diff
Added all missing docstrings
parent
bc15d7d1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ec_tools/plotting.py
+54
-0
54 additions, 0 deletions
src/ec_tools/plotting.py
with
54 additions
and
0 deletions
src/ec_tools/plotting.py
+
54
−
0
View file @
55213c3b
...
...
@@ -7,7 +7,20 @@ from src.ec_tools.interp import cur_dens_at_pot, pot_at_cur_dens
def
plot_lsvs
(
lsvs
:
dict
[
int
,
pd
.
DataFrame
]
|
pd
.
DataFrame
,
title
:
str
,
excl_mas
:
list
[
int
]
=
None
,
ymin
:
float
=
None
,
ymax
:
float
=
None
,
color
:
str
=
None
,
alpha
:
float
=
0.3
,
save_path
:
str
=
None
):
"""
Plots a single LSV or all LSVs in a dictionary in a single potential vs. current density plot.
:param lsvs: single LSV given by a DataFrame with the two columns
"
Potential [mV]
"
and
"
Current density [mA/cm^2]
"
or dictionary of DataFrames with multiple LSVs
:param title: title of the plot
:param excl_mas: list of LSVs to exclude from the plotting. The values inside the list should correspond to the keys
of the LSV dictionary
:param ymin: minimum y-value
:param ymax: maximum y-value
:param color: color of the plot, by default, each LSV is automatically plotted in a different color
:param alpha: opacity of the plot
:param save_path: path to save the plot to in high resolution, for example
"
Downloads/LSVs.png
"
"""
# If just one LSV was provided, wrap it in a dictionary
...
...
@@ -35,6 +48,19 @@ def plot_lsvs(lsvs: dict[int, pd.DataFrame] | pd.DataFrame, title: str, excl_mas
def
_plot_on_wafer
(
coords
:
pd
.
DataFrame
,
vals
:
pd
.
Series
,
cmap
:
str
,
vmin
:
float
,
vmax
:
float
,
title
:
str
,
label
:
str
,
save_path
:
str
=
None
):
"""
Background method to create the wafer plot from a pandas Series of values.
:param coords: coordinates of all measurement points
:param vals: values to associate the coordinates with
:param cmap: matplotlib colormap for the scatter plot
:param vmin: minimum of the colorbar
:param vmax: maximum of the colorbar
:param title: title of the plot
:param label: label of the colorbar
:param save_path: path to save the plot to in high resolution, for example
"
Downloads/LSVs.png
"
"""
# Create the figure
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
5
,
4
))
# Plot the data
...
...
@@ -59,6 +85,17 @@ def plot_curs_on_wafer(lsvs: dict[int, pd.DataFrame], pot: float, excl_mas: list
cmap
:
str
=
'
viridis
'
,
vmin
:
float
=
None
,
vmax
:
float
=
None
,
save_path
:
str
=
None
):
"""
Plots all current densities at a given potential on the standard MDI measurement grid.
:param lsvs: dictionary of DataFrames with the columns
"
Potential [mV]
"
and
"
Current density [mA/cm^2]
"
:param pot: potential (in mV) at which all current densities need to be plotted
:param excl_mas: list of LSVs to exclude from the plotting. The values inside the list should correspond to the keys
of the LSV dictionary
:param title: title of the plot
:param cmap: matplotlib colormap for the scatter plot
:param vmin: minimum of the colorbar
:param vmax: maximum of the colorbar
:param save_path: path to save the plot to in high resolution, for example
"
Downloads/Plot.png
"
"""
# Load the MDI coordinates (in µm)
...
...
@@ -80,6 +117,17 @@ def plot_pots_on_wafer(lsvs: dict[int, pd.DataFrame], cur: float, excl_mas: list
cmap
:
str
=
'
viridis
'
,
vmin
:
float
=
None
,
vmax
:
float
=
None
,
save_path
:
str
=
None
):
"""
Plots all potentials at a given current density on the standard MDI measurement grid.
:param lsvs: dictionary of DataFrames with the columns
"
Potential [mV]
"
and
"
Current density [mA/cm^2]
"
:param cur: current density (in mA/cm^2) at which all potentials need to be plotted
:param excl_mas: list of LSVs to exclude from the plotting. The values inside the list should correspond to the keys
of the LSV dictionary
:param title: title of the plot
:param cmap: matplotlib colormap for the scatter plot
:param vmin: minimum of the colorbar
:param vmax: maximum of the colorbar
:param save_path: path to save the plot to in high resolution, for example
"
Downloads/Plot.png
"
"""
# Load the MDI coordinates (in µm)
...
...
@@ -100,6 +148,12 @@ def plot_pots_on_wafer(lsvs: dict[int, pd.DataFrame], cur: float, excl_mas: list
def
save_lsv_plots
(
lsvs
:
dict
[
int
,
pd
.
DataFrame
]
|
pd
.
DataFrame
,
save_path
:
str
,
excl_mas
:
list
[
int
]
=
None
):
"""
Saves all LSVs in separate plots and saves them to a given directory.
:param lsvs: dictionary of DataFrames with the columns
"
Potential [mV]
"
and
"
Current density [mA/cm^2]
"
:param save_path: path to a directory where all plots are saved
:param excl_mas: list of LSVs to exclude from the plotting. The values inside the list should correspond to the keys
of the LSV dictionary
"""
# Iterate either over all keys or over all indices
...
...
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