echemdb
The electrochemical data shown on the echemdb.org website can be downloaded from the echemdb data repository and stored in a collection.
from unitpackage.database.echemdb import Echemdb
db = Echemdb.from_remote()
type(db)
unitpackage.database.echemdb.Echemdb
Collection
In contrast to the Collection object described in the usage section, Echemdb provides data specific functionality.
All other functionalities of the base class are still applicable.
For example, statistics of the collection can be shown.
db.describe()
{'number of references': 44,
'number of entries': 205,
'materials': {'Ag', 'Au', 'Cu', 'Pt', 'Ru'}}
Metadata
The entries have properties which allow for more convenient filtering of the collection.
db_filtered = db.filter(lambda entry: entry.get_electrode('WE').material == 'Pt')
db_filtered.describe()
{'number of references': 19, 'number of entries': 130, 'materials': {'Pt'}}
Single entries can be selected by their identifier provided on echemdb.org/cv for each entry.
entry = db['engstfeld_2018_polycrystalline_17743_f4b_1']
type(entry)
unitpackage.database.echemdb_entry.EchemdbEntry
entry.package provides a full list of available descriptors.
As indicated above, electrodes used to record the data are listed in the system.electrodes descriptor and are accessible with
entry.get_electrode('WE')
{'name': 'WE', 'function': 'working electrode', 'crystallographicOrientation': '100', 'geometricElectrolyteContactArea': {'unit': '1 / cm2'}, 'material': 'Cu', 'preparationProcedure': {'description': ['Sputter and heating under UHV conditions.']}, 'shape': {'diameter': {'unit': 'mm', 'value': 4.4}, 'height': {'unit': 'mm', 'value': 2}, 'type': 'head shaped'}, 'source': {'manufacturer': 'Mateck'}}
Note
Usually measurements are performed in a three electrode configuration, with a working electrode WE, a counter electrode CE, and a reference electrode REF.
Data
In a freshly created collection all values of in the dataframe are in SI units.
entry.df.head(5)
| t | E | j | |
|---|---|---|---|
| 0 | 0.00 | -0.198005 | 0.036712 |
| 1 | 0.02 | -0.197005 | 0.045084 |
| 2 | 0.04 | -0.196005 | 0.050082 |
| 3 | 0.06 | -0.195005 | 0.054618 |
| 4 | 0.08 | -0.194005 | 0.058966 |
The original units in the published figure are stored as metadata. For data digitized with svgdigitizer a time axis is only present, when a scan rate was given in the SVG.
entry.figureDescription.fields
[{'name': 'E', 'type': 'number', 'unit': 'V', 'orientation': 'horizontal', 'reference': 'RHE'},
{'name': 'j', 'type': 'number', 'unit': 'uA / cm2', 'orientation': 'vertical'}]
entry.figureDescription.scanRate
50.0 mV / s
Changing column units
An entry can be rescaled to new units.
rescaled_entry = entry.rescale({'E': 'mV', 'j': 'A / m2' })
rescaled_entry.df.head(5)
| t | E | j | |
|---|---|---|---|
| 0 | 0.00 | -198.005384 | 0.036712 |
| 1 | 0.02 | -197.005384 | 0.045084 |
| 2 | 0.04 | -196.005384 | 0.050082 |
| 3 | 0.06 | -195.005384 | 0.054618 |
| 4 | 0.08 | -194.005384 | 0.058966 |
The information is updated in the field description of the mutable resource.
rescaled_entry.mutable_resource.schema
{'fields': [{'name': 't', 'type': 'number', 'unit': 's'},
{'name': 'E', 'type': 'number', 'unit': 'mV', 'reference': 'RHE'},
{'name': 'j', 'type': 'number', 'unit': 'A / m2'}]}
An entry can be rescaled to its original units.
original_entry = rescaled_entry.rescale('original')
original_entry.df.head(5)
| t | E | j | |
|---|---|---|---|
| 0 | 0.00 | -0.198005 | 3.671208 |
| 1 | 0.02 | -0.197005 | 4.508403 |
| 2 | 0.04 | -0.196005 | 5.008222 |
| 3 | 0.06 | -0.195005 | 5.461767 |
| 4 | 0.08 | -0.194005 | 5.896625 |
The information in the mutable resource is updated accordingly.
original_entry.mutable_resource.schema
{'fields': [{'name': 't', 'type': 'number', 'unit': 's'},
{'name': 'E', 'type': 'number', 'unit': 'V', 'reference': 'RHE'},
{'name': 'j', 'type': 'number', 'unit': 'uA / cm2'}]}
Shifting reference scales
A key issue for comparing electrochemical current potential traces is that data can be recorded with different reference electrodes. Hence direct comparison of the potential data is not straight forward unless the data is shifted to a common reference scale. The shift to a different reference scale depends on how the value of that reference electrode vs the standard hydrogen electrode (SHE) is determined and sometimes depends on the source of the reported data.
Separate consideration
To mitigate this issue, the unitpackage.electrochemistry.reference_electrode module, contains a collection of commonly used reference electrodes that can be accessed by its API.
from unitpackage.electrochemistry.reference_electrode import _reference_electrodes
_reference_electrodes.keys()
dict_keys(['SHE', 'Ag/AgCl', 'Ag/AgCl-sat', 'Ag/AgCl-1M', 'CE-sat', 'CE-1M', 'CE-0.1M', 'Hg/HgO-0.1M-NaOH', 'Hg/HgO-0.5M-NaOH', 'Hg/HgO-1M-NaOH', 'Hg/HgO-0.1M-KOH', 'Hg/HgO-0.5M-KOH', 'Hg/HgO-1M-KOH', 'MSE-sat', 'MSE-0.5M', 'RHE'])
A ReferenceElectrode object can be created by providing the corresponding acronym.
from unitpackage.electrochemistry.reference_electrode import ReferenceElectrode
ref = ReferenceElectrode('CE-sat')
ref
{'name': 'CE-sat', 'full_name': 'Saturated calomel electrode', 'alias': 'SCE', 'entries': [{'value': 0.26796, 'standard': 'ECHEMDB-2026', 'approach': 'experimental', 'unit': 'V', 'vs': 'SHE', 'source': {'doi': 'https://doi.org/10.1007/978-3-642-36188-3', 'title': 'Handbook of Reference Electrodes'}, 'choice': 'Recommended value in Handbook of Reference Electrodes (DOI: https://doi.org/10.1007/978-3-642-36188-3).', 'uncertainty': None}], 'temperature_dependence': []}
A certain ReferenceElectrode can contain multiple entries with values from different sources. For the echemdb standard data values were chosen based on the discussion of the specified reference electrodes in the literature.
ref.standard_data
{'value': 0.26796, 'standard': 'ECHEMDB-2026', 'approach': 'experimental', 'unit': 'V', 'vs': 'SHE', 'source': {'doi': 'https://doi.org/10.1007/978-3-642-36188-3', 'title': 'Handbook of Reference Electrodes'}, 'choice': 'Recommended value in Handbook of Reference Electrodes (DOI: https://doi.org/10.1007/978-3-642-36188-3).', 'uncertainty': None}
The shift a certain reference electrode vs that of another known reference electrode can be inferrred.
The resulting value is always in V!
ref.shift(to='CE-1M')
0.01214000000000004
The shift can also be calculated for a specific potential.
ref.shift(to='CE-1M', potential = 0.564)
0.57614
For conversion to and from the RHE scale, the pH is required.
ref.shift(to='RHE', potential = 0.564, ph=13)
-0.47226
unitpackage implementation
If the reference scale is given for a certain entry, the potentials can directly be shifted
entry_mse = entry.rescale_reference('MSE-sat')
entry_mse.df.head()
Reference MSE-sat is of type 'generic', i.e., the value is not based on experimental or theoretical values. Consult the details for MSE-sat with `ReferenceElectrode.data`.
| t | E | j | |
|---|---|---|---|
| 0 | 0.00 | 1.224295 | 0.036712 |
| 1 | 0.02 | 1.225295 | 0.045084 |
| 2 | 0.04 | 1.226295 | 0.050082 |
| 3 | 0.06 | 1.227295 | 0.054618 |
| 4 | 0.08 | 1.228295 | 0.058966 |
If a pH value is provided in the metadata, conversion to RHE is straight forward. In other cases the pH must be provide as additional argument.
entry.system.electrolyte.ph
{'value': 13}
entry.get_electrode('REF')
{'name': 'REF', 'function': 'reference electrode', 'source': {'manufacturer': 'homemade'}, 'type': 'RHE'}
entry.df.head()
| t | E | j | |
|---|---|---|---|
| 0 | 0.00 | -0.198005 | 0.036712 |
| 1 | 0.02 | -0.197005 | 0.045084 |
| 2 | 0.04 | -0.196005 | 0.050082 |
| 3 | 0.06 | -0.195005 | 0.054618 |
| 4 | 0.08 | -0.194005 | 0.058966 |
entry_rhe = entry.rescale_reference('SHE')
entry_rhe.df.head()
| t | E | j | |
|---|---|---|---|
| 0 | 0.00 | 0.570295 | 0.036712 |
| 1 | 0.02 | 0.571295 | 0.045084 |
| 2 | 0.04 | 0.572295 | 0.050082 |
| 3 | 0.06 | 0.573295 | 0.054618 |
| 4 | 0.08 | 0.574295 | 0.058966 |
Plotting
The default plot to present the data is j vs. E (or I vs. E).
The curve label consists of the figure number in the original publication followed by a unique identifier.
entry.plot()
The dimensions of the axis can still be specified explicitly.
entry.plot(x_label='t', y_label='j')
Bibliography
All entries within the Echemdb collection are referenced and included in a bibtex bibliography.
len(db.bibliography.entries)
44
Each entry in the Echemdb collection can be cited.
entry = db['engstfeld_2018_polycrystalline_17743_f4b_1']
entry.citation(backend='text') # other available backends: 'latex' or 'markdown'. 'text' is default.
'A. K. Engstfeld et al. Polycrystalline and single-crystal Cu electrodes: influence of experimental conditions on the electrochemical properties in alkaline media. Chem.-Eur. J, 24(67):17743–17755, 2018.'