Voltammetry package

voltammetry.voltammetry

This module contains the Voltammetry class, which is used to analyze voltammetry data.

class voltammetry.voltammetry.Voltammetry(voltage, current, time, args, charge=None)

Bases: madap.echem.procedure.EChemProcedure

This class defines the voltammetry method.

analyze_best_linear_fit(x_data, y_data)

Find the best linear region for the provided data.

Parameters
  • x_data (np.array) – Transformed time array (e.g., t^(-1/2) for diffusion or time for kinetics).

  • y_data (np.array) – Current array or transformed current array (e.g., log(current)).

Returns

Dictionary containing the best linear fit parameters:

start_index (int): Start index of the best linear region. end_index (int): End index of the best linear region. slope (float): Slope of the best linear fit. intercept (float): Intercept of the best linear fit. r_squared (float): R-squared value of the best linear fit.

Return type

best fit (dict)

convert_current()

Convert the current to A indipendently from the unit of measure

convert_time()

Convert the time to s indipendently from the unit of measure

save_figure(fig, plot, optional_name=None, plot_dir=None)

Save the figure in the plot directory.

Parameters
  • fig (matplotlib.figure.Figure) – figure to save

  • plot (madap.plot.plot) – plot object

  • optional_name (str) – optional name for the figure

  • plot_dir (str) – plot directory

voltammetry.voltammetry_CA

This module defines the cyclic amperometry methods. It is a subclass of the Voltammetry class and the EChemProcedure class. It contains the cyclic amperometry methods for analyzing the data and plotting the results.

class voltammetry.voltammetry_CA.Voltammetry_CA(current, voltage, time, args, charge=None)

Bases: madap.echem.voltammetry.voltammetry.Voltammetry, madap.echem.procedure.EChemProcedure

This class defines the chrono amperometry method.

analyze()

Analyze the data to calculate the diffusion coefficient and reaction rate constant: 1. Calculate the diffusion coefficient using Cottrell analysis. 2. Analyze the reaction kinetics to determine if the reaction is first or second order.

property figure

Get the figure of the plot.

Returns

Figure object for ca plot.

Return type

obj

perform_all_actions(save_dir: str, plots: list, optional_name: Optional[str] = None)

Perform all the actions for the cyclic amperometry method: analyze, plot, and save data.

plot(save_dir, plots, optional_name: Optional[str] = None)

Plot the data.

Parameters
  • save_dir (str) – The directory where the plot should be saved.

  • plots (list) – A list of plots to be plotted.

  • optional_name (str) – The optional name of the plot.

save_data(save_dir: str, optional_name: Optional[str] = None)

Save the data

Parameters
  • save_dir (str) – The directory where the data should be saved

  • optional_name (str) – The optional name of the data.

voltammetry.voltammetry_CP

This module contains the cyclic potentiometry class.

class voltammetry.voltammetry_CP.Voltammetry_CP(voltage, current, time, args, charge=None)

Bases: madap.echem.voltammetry.voltammetry.Voltammetry, madap.echem.procedure.EChemProcedure

This class defines the cyclic potentiometry method.

analyze()

Analyze the cyclic potentiometry data. These analysis include: 1. Calculate dQ/dV 2. Calculate dV/dt 3. Calculate initial stabilization time 4. Find potential transition times 5. Calculate diffusion coefficient

property figure

Get the figure of the plot.

Returns

Figure object for ca plot.

Return type

obj

perform_all_actions(save_dir: str, plots: list, optional_name: Optional[str] = None)

Perform all the actions for the cyclic potentiometry method: analyze, plot, and save data.

Parameters
  • save_dir (str) – The directory where the data should be saved

  • plots (list) – The list of plots to be plotted

  • optional_name (str) – The optional name of the data.

plot(save_dir, plots, optional_name: Optional[str] = None)

Plot the cyclic potentiometry data.

Parameters
  • save_dir (str) – The directory where the plot should be saved

  • plots (list) – The list of plots to be plotted

  • optional_name (str) – The optional name of the plot.

save_data(save_dir: str, optional_name: Optional[str] = None)

Save the data

Parameters
  • save_dir (str) – The directory where the data should be saved

  • optional_name (str) – The optional name of the data.

voltammetry.voltammetry_CV

This module contains the cyclic potentiometry class.

class voltammetry.voltammetry_CP.Voltammetry_CP(voltage, current, time, args, charge=None)

Bases: madap.echem.voltammetry.voltammetry.Voltammetry, madap.echem.procedure.EChemProcedure

This class defines the cyclic potentiometry method.

analyze()

Analyze the cyclic potentiometry data. These analysis include: 1. Calculate dQ/dV 2. Calculate dV/dt 3. Calculate initial stabilization time 4. Find potential transition times 5. Calculate diffusion coefficient

property figure

Get the figure of the plot.

Returns

Figure object for ca plot.

Return type

obj

perform_all_actions(save_dir: str, plots: list, optional_name: Optional[str] = None)

Perform all the actions for the cyclic potentiometry method: analyze, plot, and save data.

Parameters
  • save_dir (str) – The directory where the data should be saved

  • plots (list) – The list of plots to be plotted

  • optional_name (str) – The optional name of the data.

plot(save_dir, plots, optional_name: Optional[str] = None)

Plot the cyclic potentiometry data.

Parameters
  • save_dir (str) – The directory where the plot should be saved

  • plots (list) – The list of plots to be plotted

  • optional_name (str) – The optional name of the plot.

save_data(save_dir: str, optional_name: Optional[str] = None)

Save the data

Parameters
  • save_dir (str) – The directory where the data should be saved

  • optional_name (str) – The optional name of the data.

voltammetry.voltammetry_plotting

This module defines the plotting of the cyclic voltammetry studies.

class voltammetry.voltammetry_plotting.VoltammetryPlotting(current, time, voltage, electrode_area, mass_of_active_material, cumulative_charge, procedure_type, applied_voltage=None, applied_current=None)

Bases: madap.plotting.plotting.Plots

This class defines the plotting of the cyclic voltammetry studies.

CA(subplot_ax, x_lim_min=0, y_lim_min=0, legend=True)

Plot the CA plot. :param subplot_ax: axis to which the plot should be added :type subplot_ax: matplotlib.axes

CC(subplot_ax)

Plot the CC plot.

Parameters

subplot_ax (matplotlib.axes) – axis to which the plot should be added

CP(subplot_ax, y_lim_min=0, y_lim_max=0)

Plot the voltage plot.

Parameters
  • subplot_ax (matplotlib.axes) – axis to which the plot should be added

  • y_lim_min (float) – minimum value of the y axis

CV(subplot_ax, data, anodic_peak_params, cathodic_peak_params, cycle_list)

Plot the CV plot.

Parameters
  • subplot_ax (matplotlib.axes) – axis to which the plot should be added

  • data (pandas.DataFrame) – dataframe of the data

  • anodic_peak_params (dict) – dictionary of anodic peak parameters

  • cathodic_peak_params (dict) – dictionary of cathodic peak parameters

Tafel(subplot_ax, data, anodic_peak_params, cathodic_peak_params, E_half_params, cycle_list)

Plot the Tafel plot.

Parameters
  • subplot_ax (matplotlib.axes) – axis to which the plot should be added

  • data (pandas.DataFrame) – dataframe of the data

  • anodic_peak_params (dict) – dictionary of anodic peak parameters

  • cathodic_peak_params (dict) – dictionary of cathodic peak parameters

anson(subplot_ax, diffusion_coefficient)

Plot the Anson plot.

Parameters

subplot_ax (matplotlib.axes) – axis to which the plot should be added

compose_volt_subplot(plots: list)

Compose the subplot for the CA plot. :param plots: List of plots to be composed. :type plots: list

Returns

Figure and axis of the subplot.

Return type

fig, ax

cottrell(subplot_ax, diffusion_coefficient, best_fit_diffusion=None)

Plot the Cottrell plot. :param subplot_ax: axis to which the plot should be added :type subplot_ax: matplotlib.axes

differential_capacity(subplot_ax, dQdV_no_nan, positive_peaks, negative_peaks=None)

Plot the differential capacity plot.

Parameters
  • subplot_ax (matplotlib.axes) – axis to which the plot should be added

  • dQdV_no_nan (list) – list of differential capacity

  • positive_peaks (list) – list of positive peaks

  • negative_peaks (list) – list of negative peaks

log_CA(subplot_ax, y_data, reaction_rate, reaction_order, best_fit_reaction_rate)

Plot the Log CA plot.

Parameters

subplot_ax (matplotlib.axes) – axis to which the plot should be added

peak_scan(subplot_ax, anodic_peak_params, cathodic_peak_params, E_half_params)

Plot the peak scan plot.

Parameters
  • subplot_ax (matplotlib.axes) – axis to which the plot should be added

  • data (pandas.DataFrame) – dataframe of the data

  • scan_rate (float) – scan rate

  • anodic_peak_params (dict) – dictionary of anodic peak parameters

  • cathodic_peak_params (dict) – dictionary of cathodic peak parameters

potential_rate(subplot_ax, dVdt, transition_values, tao_initial)

Plot the potential rate plot.

Parameters
  • subplot_ax (matplotlib.axes) – axis to which the plot should be added

  • dVdt (list) – list of potential rates

  • transition_values (dict) – dictionary of transition values

  • tao_initial (float) – initial stabilization time

potential_waveform(subplot_ax, data)

Plot the potential waveform plot.

Parameters
  • subplot_ax (matplotlib.axes) – axis to which the plot should be added

  • data (pandas.DataFrame) – dataframe of the data

voltage_profile(subplot_ax)

Plot the voltage profile plot.

Parameters

subplot_ax (matplotlib.axes) – axis to which the plot should be added