Skip to content
Snippets Groups Projects
Commit 55213c3b authored by Felix Thelen's avatar Felix Thelen
Browse files

Added all missing docstrings

parent bc15d7d1
Branches
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment