Electrochemistry - Mass Spectrometry (EC-MS)

The main class for EC-MS data is the ECMSMeasurement. It inherits from both ECMeasurement and MSMeasurement. An ECMSMeasurement can be created either by adding an ECMeasurement and an MSMeasurement using the + operator, or by directly importing data using an EC-MS reader such as “zilien”.

It comes with the EC-MS plotter which makes EC-MS plots like this one:

../../../_images/ec_ms_annotated.svg

ECMSMeasurement.plot_measurement(). Data from Trimarco, 2018.

Besides the plotter, an ECMSMeasurement has a class for calibration of the MS signal using electrochemically generated species: ECMSCalibration.

ECMSCyclicVoltammogram adds to ECMSMeasurement the tools for selecting and analyzing data based on an electrochemical cyclic voltammatry program that are implemented in CyclicVoltammogram (see The cv module).

Finally, deconvolution of mass spectrometry data from the diffusion broadening in the EC cell, described in this publication, is implemented in the deconvolution module, in a class inheriting from ECMSMeasurement.

ixdat has all the functionality and more for EC-MS data and analysis as the legacy EC_MS package. This includes the tools behind the EC-MS analysis and visualization in the puplications:

ixdat is used for the following EC-MS articles:

The ec_ms module

Source: https://github.com/ixdat/ixdat/tree/user_ready/src/ixdat/techniques/ec_ms.py

Module for representation and analysis of EC-MS measurements

class ixdat.techniques.ec_ms.ECMSCalibration(name=None, date=None, tstamp=None, setup=None, ms_cal_results=None, signal_bgs=None, RE_vs_RHE=None, A_el=None, R_Ohm=None, L=None, technique='EC-MS')[source]

Class for calibrations useful for ECMSMeasurements

calibrate_series(key, measurement=None)[source]

Return a calibrated series for key based on the raw data in the measurement.

Key should be “potential” or “current”. Anything else will return None.

  • “potential”: the calibration looks up “raw_potential” in the measurement,

shifts it to the RHE potential if RE_vs_RHE is available, corrects it for Ohmic drop if R_Ohm is available, and then returns a calibrated potential series with a name indicative of the corrections done. - “current”: The calibration looks up “raw_current” in the measurement, normalizes it to the electrode area if A_el is available, and returns a calibrated current series with a name indicative of whether the normalization was done.

class ixdat.techniques.ec_ms.ECMSCyclicVoltammogram(*args, **kwargs)[source]

Class for raw EC-MS functionality. Parents: CyclicVoltammogram, ECMSMeasurement

class ixdat.techniques.ec_ms.ECMSMeasurement(**kwargs)[source]

Class for raw EC-MS functionality. Parents: ECMeasurement and MSMeasurement

as_cv(**kwargs)

Convert self to a CyclicVoltammogram

default_exporter

alias of ECMSExporter

default_plotter

alias of ECMSPlotter

property ec_plotter

A plotter for just plotting the ec data

ecms_calibration(mol, mass, n_el, tspan, tspan_bg=None)[source]

Calibrate for mol and mass based on one period of steady electrolysis

Parameters
  • mol (str) – Name of the molecule to calibrate

  • mass (str) – Name of the mass at which to calibrate

  • n_el (str) – Number of electrons passed per molecule produced (remember the sign! e.g. +4 for O2 by OER and -2 for H2 by HER)

  • tspan (tspan) – The timespan of steady electrolysis

  • tspan_bg (tspan) – The time to use as a background

Return MSCalResult: The result of the ecms_calibration

ecms_calibration_curve(mol, mass, n_el, tspan_list=None, selector_name=None, selector_list=None, t_steady_pulse=None, tspan_bg=None, force_through_zero=False, ax='new', axes_measurement=None, axes_measurement_J_name='raw_current', return_ax=False)[source]

Fit mol’s sensitivity at mass based on steady periods of EC production.

Parameters
  • mol (str) – Name of the molecule to calibrate

  • mass (str) – Name of the mass at which to calibrate

  • n_el (str) – Number of electrons passed per molecule produced (remember the sign! e.g. +4 for O2 by OER and -2 for H2 by HER)

  • tspan_list (list of tspan) – The timespans of steady electrolysis

  • selector_name (str) – Name of selector which identifies the periods of steady electrolysis for automatic selection of timespans of steady electrolysis. E.g. “selector” or “Ns” for biologic EC data

  • selector_list (list) – List of values for selector_name for automatic selection of timespans of steady electrolysis

  • t_steady_pulse (float) – Length of steady electrolysis for each segment given by selector_list. Defaults to None = entire length of segment

  • tspan_bg (tspan) – The time to use as a background

  • force_through_zero (boolean) – Whether to force the calibration curve through zero. This can be done when confident in the background subtraction.

  • ax (Axis) – The axis on which to plot the ms_calibration curve result. Defaults to a new axis.

  • axes_measurement (list of Axes) – The EC-MS plot axes to highlight the ms_calibration on. Defaults to None. These axes are not returned.

  • axes_measurement_J_name (str) – The J_name used in the axis passed to axes_measurement. Must be passed manually as the axis does not “know” its J_name. Defaults to “raw_current”. IMPORTANT: the method still uses “raw_current” to calculate the sensitivity factor, this J_name is only used for plotting.

  • return_ax (bool) – Whether to return the axis on which the calibration curve is plotted together with the MSCalResult. Defaults to False.

Return MSCalResult(, Axis): The result of the ms_calibration (and calibration

curve axis if requested) based on integration of selected time periods.

classmethod from_dict(obj_as_dict)[source]

Initiate an ECMSMeasurement from a dictionary representation.

This unpacks the ECMSCalibration from its own nested dictionary TODO: Figure out a way for that to happen automatically.

property ms_plotter

A plotter for just plotting the ms data

siq_ecms_calibration(mol, mass, n_el, tspan, tspan_bg=None)[source]

Calibrate for mol and mass based on one period of steady electrolysis

Use spectro_inlets_quantification package. :param mol: Name of the molecule to calibrate :type mol: str :param mass: Name of the mass at which to calibrate :type mass: str :param n_el: Number of electrons passed per molecule produced (remember the

sign! e.g. +4 for O2 by OER and -2 for H2 by HER)

Parameters
  • tspan (tspan) – The timespan of steady electrolysis

  • tspan_bg (tspan) – The time to use as a background

Return siq.CalPoint: The result of the ecms_calibration

siq_ecms_calibration_curve(mol, mass, n_el, tspan_list=None, selector_name=None, selector_list=None, t_steady_pulse=None, tspan_bg=None, force_through_zero=False, ax='new', axes_measurement=None, axes_measurement_J_name='raw_current', return_ax=False)[source]

Fit mol’s sensitivity at mass based on steady periods of EC production.

Use spectro_inlets_quantification.

Parameters
  • mol (str) – Name of the molecule to calibrate

  • mass (str) – Name of the mass at which to calibrate

  • n_el (str) – Number of electrons passed per molecule produced (remember the sign! e.g. +4 for O2 by OER and -2 for H2 by HER)

  • tspan_list (list of tspan) – The timespans of steady electrolysis

  • selector_name (str) – Name of selector which identifies the periods of steady electrolysis for automatic selection of timespans of steady electrolysis. E.g. “selector” or “Ns” for biologic EC data

  • selector_list (list) – List of values for selector_name for automatic selection of timespans of steady electrolysis

  • t_steady_pulse (float) – Length of steady electrolysis for each segment given by selector_list. Defaults to None = entire length of segment

  • tspan_bg (tspan) – The time to use as a background

  • force_through_zero (boolean) – Whether to force the calibration curve through zero. This can be done when confident in the background subtraction.

  • ax (Axis) – The axis on which to plot the ms_calibration curve result. Defaults to a new axis.

  • axes_measurement (list of Axes) – The EC-MS plot axes to highlight the ms_calibration on. Defaults to None. These axes are not returned.

  • axes_measurement_J_name (str) – The J_name used in the axis passed to axes_measurement. Must be passed manually as the axis does not “know” its J_name. Defaults to “raw_current”. IMPORTANT: the method still uses “raw_current” to calculate the sensitivity factor, this J_name is only used for plotting.

  • return_ax (bool) – Whether to return the axis on which the calibration curve is plotted together with the MSCalResult. Defaults to False.

Return MSCalResult(, Axis): The result of the ms_calibration (and calibration

curve axis if requested) based on integration of selected time periods.

property tspan

The tspan of an MS measurement is the tspan of its potential data

The deconvolution module

Source: https://github.com/ixdat/ixdat/tree/user_ready/src/ixdat/techniques/deconvolution.py

Module for deconvolution of mass transport effects.

class ixdat.techniques.deconvolution.DecoMeasurement(name, **kwargs)[source]

Class implementing deconvolution of EC-MS data

extract_kernel(signal_name, cutoff_pot=0, tspan=None, tspan_bg=None)[source]

Extracts a Kernel object from a measurement.

Parameters
  • signal_name (str) – Signal name from which the kernel/impule response is to be extracted.

  • cutoff_pot (int) – Potential which the defines the onset of the impulse. Must be larger than the resting potential before the impulse.

  • tspan (list) – Timespan from which the kernel/impulse response is extracted.

  • tspan_bg (list) – Timespan that corresponds to the background signal.

grab_partial_current(signal_name, kernel_obj, tspan=None, tspan_bg=None, snr=10)[source]

Return the deconvoluted partial current for a given signal

Parameters
  • signal_name (str) – Name of signal for which deconvolution is to be carried out.

  • kernel_obj (Kernel) – Kernel object which contains the mass transport parameters

  • tspan (list) – Timespan for which the partial current is returned.

  • tspan_bg (list) – Timespan that corresponds to the background signal.

  • snr (int) – signal-to-noise ratio used for Wiener deconvolution.

class ixdat.techniques.deconvolution.Kernel(parameters={}, MS_data=None, EC_data=None)[source]

Kernel class implementing datatreatment of kernel/impulse response data.

calculate_kernel(dt=0.1, duration=100, norm=True, matrix=False)[source]

Calculates a kernel/impulse response.

Parameters
  • dt (int) – Timestep for which the kernel/impulse response is calculated. Has to match the timestep of the measured data for deconvolution.

  • duration (int) – Duration in seconds for which the kernel/impulse response is calculated. Must be long enough to reach zero.

  • norm (bool) – If true the kernel/impulse response is normalized to its area.

  • matrix (bool) – If true the circulant matrix constructed from the kernel/ impulse reponse is returned.

property charge

Integrates the measured current over the time.

plot(dt=0.1, duration=100, ax=None, norm=True, **kwargs)[source]

Returns a plot of the kernel/impulse response.

property sig_area

Integrates a measured impulse response and returns the area.