Plotting

API Reference

impedancefitter.plotting.emcee_plot(res, clustered=False, **corner_kwargs)[source]

Create corner plot.

Parameters
  • res (dict) – Dictionary containing values and flatchain

  • corner_kwargs (dict, optional) – Dictionary with further corner plot options

impedancefitter.plotting.plot_bode(omega, Z, title='', Z_fit=None, show=True, save=False, Z_comp=None, labels=['Data', 'Best fit', 'Init fit'], append=False)[source]

Bode plot of impedance.

Plots phase and log of magnitude over log of frequency.

Parameters
  • omega (numpy.ndarray, double) – Frequency array

  • Z (numpy.ndarray, complex) – Impedance array, experimental data or data to compare to.

  • Z_fit (numpy.ndarray, complex) – Impedance array, fit result. If provided, the difference between data and fit will be shown.

  • title (str) – Title of plot.

  • show (bool, optional) – Show figure (default is True).

  • save (bool, optional) – Save figure to pdf (default is False). Name of figure starts with title.

  • Z_comp (numpy.ndarray, complex, optional) – Complex-valued impedance array. Might be used to compare the properties of two data sets.

  • labels (list) – List of labels for three plots. Must have length 3 always. Is ordered like: [Z, Z_fit, Z_comp]

  • save (bool, optional) – save figure to pdf (default is False). Name of figure starts with title and ends with _bode_plot.pdf.

  • append (bool, optional) – Decide if you want to show plot or add line to existing plot.

impedancefitter.plotting.plot_cole_cole(omega, Z, c0, Z_comp=None, title='', show=True, save=False, labels=None)[source]
Parameters
  • omega (numpy.ndarray, double) – frequency array

  • Z (numpy.ndarray, complex) – impedance array

  • c0 (double) – unit capacitance of device

  • Z_comp (numpy.ndarray, complex, optional) – complex-valued impedance array. Might be used to compare the properties of two data sets.

  • title (str, optional) – title of plot. Default is an empty string.

  • show (bool, optional) – show figure (default is True)

  • save (bool, optional) – save figure to pdf (default is False). Name of figure starts with title and ends with _dielectric_properties.pdf.

  • logscale (str, optional) – Decide what you want to plot using log scale. Possible are permittivity, conductivity and both

  • labels (list, optional) – Give custom labels. Needs to be a list of length 2.

impedancefitter.plotting.plot_compare_to_data(omega, Z, Z_fit, subplot=None, title='', show=True, save=False, residual='parts', sign=False, limits=None)[source]

plots the difference of the fitted function to the data

Parameters
  • omega (numpy.ndarray, double) – frequency array

  • Z (numpy.ndarray, complex) – impedance array, experimental data or data to compare to

  • Z_fit (numpy.ndarray, complex) – impedance array, fit result

  • subplot (optional) – decide whether it is a new figure or a subplot. Default is None (yields new figure). Otherwise it can be an integer to denote the subfigure.

  • title (str, optional) – title of plot. Default is an empty string.

  • show (bool, optional) – show figure (default is True). Only has an effect when subplot is None.

  • save (bool, optional) – save figure to pdf (default is False). Name of figure starts with title and ends with _relative_difference_to_data.pdf or _difference_to_data.pdf.

  • relative (str, optional) – Plot relative difference if True, else plot residual (i.e. just difference).

  • sign (bool, optional) – Use sign of residual. Default is False, i.e. absolute value is plotted.

  • residual (str) – Plot relative difference w.r.t. real and imaginary part if parts. Plot relative difference w.r.t. absolute value if absolute. Plot difference (residual) if diff.

  • limits (list, optional) – List with entries [bottom, top] for y-axis of residual plot.

impedancefitter.plotting.plot_complex_permittivity(omega, Z, c0, Z_comp=None, title='', show=True, save=False, logscale='permittivity', labels=None)[source]
Parameters
  • omega (numpy.ndarray, double) – frequency array

  • Z (numpy.ndarray, complex) – impedance array

  • c0 (double) – unit capacitance of device

  • Z_comp (numpy.ndarray, complex, optional) – complex-valued impedance array. Might be used to compare the properties of two data sets.

  • title (str, optional) – title of plot. Default is an empty string.

  • show (bool, optional) – show figure (default is True)

  • save (bool, optional) – save figure to pdf (default is False). Name of figure starts with title and ends with _dielectric_properties.pdf.

  • logscale (str, optional) – Decide what you want to plot using log scale. Possible are permittivity, loss and both

  • labels (list, optional) – Give custom labels. Needs to be a list of length 2.

impedancefitter.plotting.plot_dielectric_properties(omega, Z, c0, Z_comp=None, title='', show=True, save=False, logscale='permittivity', labels=None)[source]
Parameters
  • omega (numpy.ndarray, double) – frequency array

  • Z (numpy.ndarray, complex) – impedance array

  • c0 (double) – unit capacitance of device

  • Z_comp (numpy.ndarray, complex, optional) – complex-valued impedance array. Might be used to compare the properties of two data sets.

  • title (str, optional) – title of plot. Default is an empty string.

  • show (bool, optional) – show figure (default is True)

  • save (bool, optional) – save figure to pdf (default is False). Name of figure starts with title and ends with _dielectric_properties.pdf.

  • logscale (str, optional) – Decide what you want to plot using log scale. Possible are permittivity, conductivity and both

  • labels (list, optional) – Give custom labels. Needs to be a list of length 2.

impedancefitter.plotting.plot_impedance(omega, Z, title='', Z_fit=None, show=True, save=False, Z_comp=None, labels=['Data', 'Best fit', 'Init fit'], residual='parts', sign=False, Zlog=False, append=False, limits_residual=None)[source]

Plot the result and compare it to data Z.

Generates 4 subplots showing the real and imaginary parts over the frequency; a Nyquist plot of real and negative imaginary part and the relative differences of real and imaginary part as well as absolute value of impedance.

Parameters
  • omega (numpy.ndarray, double) – Frequency array

  • Z (numpy.ndarray, complex) – Impedance array, experimental data or data to compare to.

  • Z_fit (numpy.ndarray, complex) – Impedance array, fit result. If provided, the difference between data and fit will be shown.

  • title (str) – Title of plot.

  • show (bool, optional) – Show figure (default is True).

  • save (bool, optional) – Save figure to pdf (default is False). Name of figure starts with title and ends with _impedance_overview.pdf.

  • Z_comp (numpy.ndarray, complex, optional) – Complex-valued impedance array. Might be used to compare the properties of two data sets.

  • labels (list) – List of labels for three plots. Must have length 3 always. Is ordered like: [Z, Z_fit, Z_comp]

  • residual (str) – Plot relative difference w.r.t. real and imaginary part if parts. Plot relative difference w.r.t. absolute value if absolute. Plot difference (residual) if diff.

  • sign (bool, optional) – Use sign of residual. Default is False, i.e. absolute value is plotted.

  • Zlog (bool, optional) – Log-scale of impedance

  • append (bool, optional) – Decide if you want to show plot or add line to existing plot.

impedancefitter.plotting.plot_uncertainty(omega, Zdata, Z, Z1, Z2, sigma, show=True, model=None)[source]

Plot best fit with uncertainty interval.

Parameters
  • Zdata (numpy.ndarray, complex) – impedance array of experimental data

  • Z (numpy.ndarray, complex) – impedance array of best fit

  • Z1 (numpy.ndarray, complex) – impedance array of upper uncertainty limit

  • Z2 (numpy.ndarray, complex) – impedance array of lower uncertainty limit

  • sigma (double) – confidence level

  • show (bool, optional) – show figure (default is True)

  • model (int, optional) – numbering of model for sequential plotting