reda.eis package¶
Submodules¶
reda.eis.convert module¶
- reda.eis.convert.convert(input_format, output_format, data, one_spectrum=False)[source]¶
Convert from the given format to the requested format
- Parameters:
- input_formatformat of input data (parameter ‘data’)
- output_formatformat of output data
- datanumpy array containing data in specified input format
- one_spectrumTrue|False, the input data comprises one spectrum. This
allows for an additional format of the data array.
- reda.eis.convert.generic_magpha_to_reim(mag, pha)[source]¶
Generically convert magnitude and phase to real and imaginary part using the formula \(mag \cdot exp(1j / 1000 * pha)\)
Thus it is suitable for resistivities, multiply conductivity phases with -1
reda.eis.plots module¶
- class reda.eis.plots.multi_sip_response(objects=None, labels=None, obj_dict=None)[source]¶
Bases:
object
manage multiple sip_response objects and provide some nice overview plots
Methods
add
(response[, label])add one response object to the list
plot_rmag
(filename[, pmin, pmax, title])plot all resistance/resistivity magnitude spectra
plot_rpha
(filename[, pmin, pmax, title])plot all resistance/resistivity phase spectra
plot_cim
plot_cre
set_xlim
- plot_rmag(filename, pmin=None, pmax=None, title=None)[source]¶
plot all resistance/resistivity magnitude spectra
- class reda.eis.plots.sip_response(frequencies, rcomplex=None, ccomplex=None, rmag=None, rpha=None, rmag_err=None, rpha_err=None)[source]¶
Bases:
object
Hold one EIS/SIP spectrum and return it in various formats
Methods
plot
(filename[, title, reciprocal, limits, ...])Standard plot of spectrum
to_one_line
(array)Flatten the array to one dimension using the 'F' (Fortran) style and return a 2D array
- plot(filename, title=None, reciprocal=None, limits=None, dtype='rho', return_fig=False, **kwargs)[source]¶
Standard plot of spectrum
- Parameters:
- filenamestr
Output filename. Include the ending to specify the filetype (usually .pdf or .png)
- titlestring, optional
Title for the plot
- reciprocal
reda.eis.plots.sip_response
, optional If another
reda.eis.plots.sip_response
object is provided here, use this as the reciprocal spectrum.- limitsdict, optional
A dictionary which contains plot limits. See code example below.
- dtypestring, optional
Determines if the data plotted included geometric factors (‘rho’) or not (‘r’). Default: ‘rho’
- return_figbool, optional
If True, then do not delete the figure object after saving to file and return the figure object. Default: False
- **kwargsdict
kwargs is piped through to the _plot function
- Returns:
- fig
matplotlib.Figure
The figure object. Only returned if return_fig is set to True
- fig
Examples
>>> from reda.eis.plots import sip_response >>> import numpy as np >>> frequencies = np.array([ ... 1.00000000e-03, 1.77827941e-03, 3.16227766e-03, 5.62341325e-03, ... 1.00000000e-02, 1.77827941e-02, 3.16227766e-02, 5.62341325e-02, ... 1.00000000e-01, 1.77827941e-01, 3.16227766e-01, 5.62341325e-01, ... 1.00000000e+00, 1.77827941e+00, 3.16227766e+00, 5.62341325e+00, ... 1.00000000e+01, 1.77827941e+01, 3.16227766e+01, 5.62341325e+01, ... 1.00000000e+02, 1.77827941e+02, 3.16227766e+02, 5.62341325e+02, ... 1.00000000e+03]) >>> rcomplex = np.array([ ... 49.34369772-0.51828971j, 49.11781581-0.59248806j, ... 48.85819872-0.6331137j , 48.58762806-0.62835135j, ... 48.33331113-0.57965851j, 48.11599009-0.50083533j, ... 47.94405036-0.41005275j, 47.81528917-0.32210768j, ... 47.72215469-0.24543425j, 47.65607773-0.18297794j, ... 47.60962191-0.13433101j, 47.57706229-0.09755774j, ... 47.55424286-0.07031682j, 47.53822912-0.05041399j, ... 47.52697253-0.03601005j, 47.51904718-0.02565412j, ... 47.51345965-0.01824266j, 47.50951606-0.01295546j, ... 47.50673042-0.00919217j, 47.50476152-0.0065178j , ... 47.50336925-0.00461938j, 47.50238442-0.00327285j, ... 47.50168762-0.00231829j, 47.50119454-0.00164187j, ... 47.50084556-0.00116268j]) >>> spectrum = sip_response(frequencies=frequencies, rcomplex=rcomplex) >>> fig = spectrum.plot('spectrum.pdf', return_fig=True)
reda.eis.test_convert module¶
Tests for converter functions
Run with
nosetests test_convert.py -s -v
- class reda.eis.test_convert.TestClass_input_styles[source]¶
Bases:
object
Test the three input styles:
1D
2D - one spectrum
2D - multiple spectra
Methods
precompute_values
setup_method
test_input_styles
- class reda.eis.test_convert.TestClass_test_converters[source]¶
Bases:
object
Methods
We test by converting to all values, from all values.
check_from_function
check_to_function
precompute_values
setup_method
teardown
test_from_cmag_cpha
test_from_cre_cim
test_from_cre_cmim
test_from_rmag_rpha
test_from_rre_rim
test_from_rre_rmim
test_to_cmag_cpha
test_to_cre_cim
test_to_cre_mim
test_to_rre_rim
- test_convert()[source]¶
We test by converting to all values, from all values. This is a chain test, i.e. we only provide the first input data, and then we use the output of this conversion to feed the next conversion. The last conversion then converts back to the initial data format, and thus we can compare those outputs to the hardcoded values.
reda.eis.units module¶
- reda.eis.units.get_label(parameter, ptype, flavor=None, mpl=None)[source]¶
Return the label of a given SIP parameter
- Parameters:
- parameterstr
type of parameter, e.g. rmag|rpha|cre|cim
- ptypestring
material|meas. Either return the material property (e.g. resistivity) or the measurement parameter (e.g., impedance)
- flavorstring, optional
if set, must be one of latex|mathml. Return a label for latex processing, or for mathml processing
- mplmatplotlib, optional
if set, infer flavor from mpl.rcParams. Will not be used if flavor is set
- Returns:
- labelstring
the requested label