echemdb.cv.cv_entry
A Data Package describing a Cyclic Voltammogram.
These are the individual elements of a CVDatabase
.
EXAMPLES:
Data Packages containing published data, also contain information on the source of the data:
>>> from echemdb.cv.cv_database import CVDatabase
>>> db = CVDatabase.create_example()
>>> entry = db['alves_2011_electrochemistry_6010_f1a_solid']
>>> entry.bibliography
Entry('article',
fields=[
('title', 'Electrochemistry at Ru(0001) in a flowing CO-saturated electrolyte—reactive and inert adlayer phases'),
('journal', 'Physical Chemistry Chemical Physics'),
('volume', '13'),
('number', '13'),
('pages', '6010--6021'),
('year', '2011'),
('publisher', 'Royal Society of Chemistry'),
('abstract', 'We investigated ...')],
persons=OrderedCaseInsensitiveDict([('author', [Person('Alves, Otavio B'), Person('Hoster, Harry E'), Person('Behm, Rolf J{\\"u}rgen')])]))
- class echemdb.cv.cv_entry.CVEntry(package)
A data packages describing a Cyclic Voltammogram.
EXAMPLES:
An entry can be created directly from a datapackage that has been created with svgdigitizer’s cv command. However, entries are normally obtained by opening a
CVDatabase
of entries:>>> from echemdb.cv.cv_database import CVDatabase >>> database = CVDatabase.create_example() >>> entry = next(iter(database))
- get_electrode(name)
Returns an electrode with the specified name.
EXAMPLES:
>>> entry = CVEntry.create_examples()[0] >>> entry.get_electrode('WE') {'name': 'WE', 'function': 'working electrode', 'type': 'single crystal', 'crystallographic orientation': '0001', 'material': 'Ru', 'preparation procedure': 'Sputtering and flash annealing under UHV conditions with repeated cycles of oxygen adsorption and desorption.', 'shape': {'height': {'unit': 'mm', 'value': 2}, 'type': 'hat shaped'}, 'source': {'supplier': 'Mateck'}}
TESTS:
>>> entry.get_electrode('foo') Traceback (most recent call last): ... KeyError: "Electrode with name 'foo' does not exist"
- plot(x_label='E', y_label='j', name=None)
Return a plot of this entry. The default plot is a cyclic voltammogram (‘j vs E’). When j is not present in the data, I is used instead.
EXAMPLES:
>>> entry = CVEntry.create_examples()[0] >>> entry.plot() Figure(...)
The plot can also be returned with custom axis dimensions (field names) available in the resource:
>>> entry.plot(x_label='t', y_label='E') Figure(...)
A plot resembling the original figure can be obtained by first rescaling:
>>> rescaled_entry = entry.rescale('original') >>> rescaled_entry.plot() Figure(...)
- rescale(units)
Return a rescaled
CVEntry
with axes in the specifiedunits
.Usage is essentially the same as for
echemdb.entry.Entry.rescale', i.e., new units are expected as dict, where the key is the axis name and the value the new unit, such as `{'j': 'uA / cm2', 't': 'h'}()
.Additionally, the entry can be rescaled to the axes’ units of the original datapackage:
>>> entry = CVEntry.create_examples()[0] >>> rescaled_entry = entry.rescale(units='original') >>> rescaled_entry.package.get_resource('echemdb').schema.fields [{'name': 't', 'type': 'number', 'unit': 's'}, {'name': 'E', 'type': 'number', 'unit': 'V', 'reference': 'RHE'}, {'name': 'j', 'type': 'number', 'unit': 'mA / cm2'}]
- thumbnail(width=96, height=72, dpi=72, **kwds)
Return a thumbnail of the entry’s curve as a PNG byte stream.
EXAMPLES:
>>> entry = CVEntry.create_examples()[0] >>> entry.thumbnail() b'\x89PNG...'
The PNG’s
width
andheight
can be specified in pixels. Additional keyword arguments are passed to the data frame plotting method:>>> entry.thumbnail(width=4, height=2, color='red', linewidth=2) b"\x89PNG..."