Welcome to APAR’s documentation!

APAR is an Automated Product Analysis Routine written in Python and designed to automate the determination of concentrations and Faradaic efficiencies of electrochemical CO2 reduction reaction (eCO2RR) products from nuclear magnetic resonance (NMR) raw data.

Functionalities

The main functions are related to six consecutive steps described briefly: (1) a series of pre-processing steps are performed (e.g., apodization, zero-filling, phase correction, etc.) to increase the sing-to-noise ratio (SNR), (2) chemical shift referencing based on detection of userdefined internal standard, (3) peak identification with adjustable threshold based on SNR and peak integration, (4) product assignment using chemical shift positions and coupling constants reported in Preikschas, P. et al. under review (2023), (5) calculation of product concentrations based on an internal standard and (6) Faradaic efficiencies of (eCO2RR) products.

Installation

APAR requires the following open-source Python packages: (1) Nmrglue for reading NMR raw data and processing, (2) NumPy and (3) SciPy for handling multidimensional arrays and mathematical operations, (4) pandas for data export, and (5) matplotlib for data visualization (optional).

The current version and required packages can be installed directly from GitHub.

1git clone https://github.com/philpreikschas/apar
2pip install -r requirements.txt

Usage

Raw NMR data can be analyzed with APAR’s built-in functions following the above described six consecutive steps after importing APAR’s core module.

1import apar.core as apar
  1. Raw data import and processing

1# Load NMR data
2raw_dic, raw_data = apar.load_data("example-data/example-spectrum/1", "bruker")
3
4# Convert data to NMRPipe format
5converted_dic, converted_data = apar.convert_data(raw_dic, raw_data, "bruker")
6
7# Pre-processing raw data
8processed_dic, processed_data = apar.process_data(converted_dic, converted_data)
  1. Identification of internal standard and chemical shift referencing

1# Identification of internal standard: find peak position
2real_shift, expected_shift = apar.find_standard(processed_dic, processed_data)
3
4
5# Chemical shift referencing
6referenced_data = apar.referencing(
7      processed_dic, processed_data, real_shift, expected_shift)
  1. Peak identification based on SNR and integration

1# Get all peaks from shift-corrected data
2peaks = apar.peak_identification(processed_dic, referenced_data, SNR=8)
3
4# Peak integration
5integration_results = apar.peak_integration(processed_dic, referenced_data, peaks)
  1. Product assignment based on tabular data

1# Get product information
2products = apar.get_products()
3
4# Product assignment
5integration_results = apar.peak_integration(
6      processed_dic, referenced_data, peaks)
  1. Product quantification

1# Product quantification
2identified_products = apar.product_quantification(identified_products,
3      integration_results, concentration=50, standard="DMSO")
  1. Calculation of Faradaic efficienies

1# Calculate Faradaic efficiencies
2identified_products = apar.product_faradaic_efficiency(
3      identified_products, charge=-434.272, volume=40)

An example analysis scheme and NMR data are provided on GitHub.

Main functions

load_data()

Load raw data from directory.

Note

See docs of nmrglue for more options.

load_data(path, format)

Parameters

  • path (str): path to directory with raw data

  • format (str): format of raw data, resp., instrument used supported formats: bruker

Returns

  • dic (dictionary): dictionary of NMR parameters

  • data (numpy.ndarray): array of NMR data

convert_data()

Convert data to NMRPipe format.

convert_data(dic, data, format="bruker")

Parameters

  • dic (dictionary): dictionary of NMR parameters

  • data (numpy.ndarray): array of NMR data

  • format (str): format of raw data, resp., instrument used; supported formats: bruker

Returns

  • converted_dic (dictionary): dictionary of NMR parameters

  • converted_data (numpy.ndarray): array of NMR data in NMRPipe format

process_data()

Pre-processing of NMR raw data.

Note

optimized for 1H NMR recorded on a BRUKER AVANCE III HD spectrometer equipped with 5 mm BBO Prodigy CryoProbe and perfect echo W5 WATERGATE solvent suppression pulse sequence.

process_data(dic, data)

Parameters

  • dic (dictionary): dictionary of NMR parameters in NMRPipe format

  • data (numpy.ndarray): array of NMR data in NMRPipe format

Returns

  • processed_dic (dictionary): dictionary of NMR parameters

  • processed_data (numpy.ndarray): array of processed NMR data in NMRPipe format

get_standards()

Get a dictionary of internal standards with chemical shift positions.

get_standards()

Return

  • standards (dictionary): dictionary of internal standards (abbreviation, chemical shift in ppm, number of hydrogen atoms)

find_standard()

Find peak position of internal standards within limits.

find_standard(dic, data, limit=0.05, threshold=1e5, standard="DMSO")

Parameters

  • dic (dictionary): dictionary of NMR parameters in NMRPipe format

  • data (numpy.ndarray): array of processed NMR data

  • limit (float): limits for peak identification region in ppm

  • threshold (float): intensity threshold for automated peak picking

  • standard (str): name of internal standard

Returns

  • real_shift (numpy.float64): peak position of standard in ppm

  • expected_shift (numpy.float64): expected peak posistion of standard in ppm

referencing()

Chemical shift referencing based on resonance of internal standard.

referencing(dic, data, real_shift, expected_shift)

Parameters

  • dic (dictionary): dictionary of NMR parameters in NMRPipe format

  • data (numpy.ndarray): array of NMR data in NMRPipe format

  • real_shift (numpy.float64): peak position of standard in ppm

  • expected_shift (numpy.float64): expected peak posistion of standard in ppm

Return

  • referenced_data (numpy.ndarray): array of NMR data referenced on resonance of internal standard

peak_identification()

Peak identification with given SNR as intensity threshold.

peak_identification(dic, data, SNR=4)

Parameters

  • dic (dictionary): dictionary of NMR parameters in NMRPipe format

  • data (numpy.ndarray): array of NMR data in NMRPipe format

  • SNR (float): signal-to-noise ratio used as intensity threshold

Return

  • peaks (numpy.recarray): array of identified peaks

    consists of peak position (X_AXIS), cluster number (cID), estimated peak scales (linewidths, X_LW), and estimated peak amplitudes (VOL)

peak_integration()

Peak integration of identified peaks with fixed integration limits.

peak_integration(dic, data, peaks, water_shift=4.7, water_width=0.2, integration_limit=0.05)

Parameters

  • dic (dictionary): dictionary of NMR parameters in NMRPipe format

  • data (numpy.ndarray): array of NMR data in NMRPipe format

  • peaks (numpy.recarray): array of identified peaks

  • water_shift (float): expected peak position of water in ppm

  • water_width (float): expected width of water peak in ppm

  • integration_limit (float): fixed integration limits in ppm

Return

  • integration_results (numpy.ndarray): array of integration results

    peak position, lower and upper limit of integration, and area

get_products()

Get a dictionary of eCO2RR product information

get_products()

Return

  • products (pandas.DataFrame): array of products

    product name, chemical shift in ppm, multiplicity, number of hydrogen atoms contributing to peak, and number of transferred electrons

product_assignment()

Assign product names to identified peaks.

product_assignment(integration_results, products, threshold=0.02)

Parameters

  • integration_results (numpy.ndarray): array of integration results

  • products (pandas.DataFrame): array of products

  • threshold (float): deviation from expected chemical shift of product

Return

  • identified_products (pandas.DataFrame): array of products

    product name, expected chemical shift in ppm, multiplicity, number of hydrogen atoms contributing to peak, number of transferred electrons, observed chemical shift, and peak area

product_quantification()

Calculation of product concentrations based on internal standard.

product_quantification(products, integration_results, concentration, standard="DMSO")

Parameters

  • products (pandas.DataFrame): array of identified products with

    integration results

  • concentration (float): concentration of internal standard

  • standard (str): name of internal standard

Return

  • products (pandas.DataFrame): array of products

    product name, expected chemical shift in ppm, multiplicity, number of hydrogen atoms contributing to peak, number of transferred electrons, observed chemical shift, peak area, and concentration based on standard

product_faradaic_efficiency()

Calculate Faradaic efficienies of identified products from electrocatalytic data.

Note

Concentrations of products in µmol/L.

product_faradaic_efficiency(products, charge, volume)

Parameters

  • products (pandas.DataFrame): array of identified products

  • charge (float): total charge passed during experiment in A*s

  • volume (float): volume of electrolyte used in mL

Return

  • products (pandas.DataFrame): array of products

    product name, expected chemical shift in ppm, multiplicity, number of hydrogen atoms contributing to peak, number of transferred electrons, observed chemical shift, peak area, concentration based on standard, and FEs of products