MCMC-based Permittivity/Permeability Determination

permittivitycalc.piter

alias of permittivitycalc.iter_data.AirlineIter

class permittivitycalc.iter_data.AirlineIter(data_instance, trial_run=True, number_of_poles=1, fit_mu=False, number_of_poles_mu=1, fit_conductivity=False, optimization_fit=False, number_of_fits=1, start_freq=None, end_freq=None, initial_parameters=None, nsteps=1000, nwalkers=100, nburn=500, nthin=1, nworkers=1, publish=False, name=None)[source]

Iterative fit to measured S-parameters using a Cole-Cole model. Can fit both 2-port and 2-port + shorted measurements. A flat model can also be used for samples with no measurable frequency dispersion.

To determine an initial guess for the fit, first fit a Cole-Cole model to analytical results: either New Non-iterative, NRW, or both. This provides an initial guess for the Cole-Cole model parameters. Then use the emcee package with lmfit to perform a Bayesian fit to the S-Parameters. This finds the Cole-Cole model which produces the best fit model S-parameters.

Parameters:
  • data_instance (permittivitycalc.AirlineData) – AirlineData class instance containing raw S-parameters to be iterated over. If data_instance contains corrected data, it will be automatically used.
  • trial_run (bool) – If True only fit Cole-Cole model to analytical results and plot the results. Useful for determining the number of poles to be used in the Cole-Cole model before perfoming the more time consuming final fit to the S-parameters (Default: True).
  • number_of_poles (int) – Number of poles to be used in the Cole-Cole model for epsilon. When number_of_poles is 0, a flat model will be used instead of a Cole-Cole model (epsilon* = epsilon_real - 1j*epsilon_imag) (Default: 1).
  • fit_mu (bool) – If True, fit both permittivity and permeability (Default: False).
  • number_of_poles_mu (int) – Number of poles to be used in the Cole-Cole model for mu. When number_of_poles_mu is 0, a flat model will be used instead of a Cole-Cole model (mu* = mu_real - 1j*mu_imag) (Default: 1).
  • fit_conductivity (bool) – If True, include a seperate real conductivity term in the Cole-Cole model for epsilon. Can be ignored for materials with very low conductivity (Default: False).
  • optimization_fit (bool) – If True, perform a typical non-linear least squares optimization fit using Levenberg–Marquardt instead of a Bayesian fit with MCMC (Default: False).
  • number_of_fits (int) – Number of default emcee fits to perform beofre final fit. Subsequent fits will use the results from the pervious iteration as initial values. Generally, using more steps is preferable to initializing a new fit (Default: 1).
  • start_freq (float or int, optional) – Start frequency in Hz for iteration. If None, will use the starting frequency of the data instance (Default: None).
  • end_freq (float or int, optional) – End frequency in Hz for iteration (Default: None).
  • initial_parameters (dict, optional) – A dictionary containing custom initial values for the iteration. Default values will be automatically generated if none are provided. The dictionary must contain initial values for all parameters in the iteration and each parameter much have the exact name as the ones used in the iteration. See documnetation for the _colecole and _iteration_parameters for parameter naming conventions.
  • nsteps (int, optional) – Number of steps to be used by emcee for iteration when trial_run is False. See lmfit and emcee documentation for details (Default: 1000).
  • nwalkwers (int, optional) – Number of walkers to be used by emcee for iteration when trial_run is False. See lmfit and emcee documentation for details (Default: 100).
  • nburn (int, optional) – Number of steps for burn-in phase to be used by emcee for iteration when trial_run is False. See lmfit and emcee documentation for details (Default: 500).
  • nthin (int, optional) – Only accept every nthin samples in emcee for iteration when trial_run is False. See lmfit and emcee documentation for details (Default: 1).
  • nworkers (int or pool, optional) – Number of workers or pool object for paralelization (Default: 1).
  • epsilon_iter (array) – Complex array containing the results of the iterrative fit for epsilon. trail_run must be set to False.
  • mu_iter (array) – Complex array containing the results of the iterative fit for mu. trial_run must be set to False and fit_mu must be set to True.
  • param_results (dict) – Model parameters for epsilon and mu (if fit_mu is True).
  • lmfit_results (lmfit.minimizer.MinimizerResult object) – Results from lmfit. See lmfit documentation.
  • publish (bool, optional) – If True save figure as .eps file. Default: False.
  • name (str, optional) – Required when publish=True. Used in file name of saved figure.