HN Module — HavNegpy 1.1 documentation

# HN Module

## `HN class`

class HavNegpy.HN

  A class to analyze dielectric loss data with HN function

  Fit functions include single, double, HN with conductivity, and HN with flank

## `HavNegpy.HN fit functions`

HN.hn(x, b, g, fm, deps)

  HN fit function to fit single dielectric loss peak

  Parameters

    - x (float) – frequency.

    - b (float) – symmetric fractional parameter.

    - g (float) – asymmetric fractional parameter.

    - fm (float) – maximum frequency of the peak.

    - deps (float) – dielectric strength.

  Returns

    y – estimated log dielectric loss based on the supplied parameters.

  Return type

    array

HN.hn_cond(x, b, g, fm, deps, cond, s)

  HN fit function to fit single dielectric loss peak together with conductivity

  Parameters

    - x (float) – frequency.

    - b (float) – symmetric fractional parameter.

    - g (float) – asymmetric fractional parameter.

    - fm (float) – maximum frequency of the loss peak.

    - deps (float) – dielectric strength.

    - cond (float) – DC conductivity contribution.

    - s (float) – power law exponent.

  Returns

    y – estimated log dielectric loss based on the supplied parameters.

  Return type

    array

HN.hn_flank(x, b, g, fm, deps, N, s)

  HN fit function to fit single dielectric loss peak together with a high frequency flank

  Parameters

    - x (float) – frequency.

    - b (float) – symmetric fractional parameter.

    - g (float) – asymmetric fractional parameter.

    - fm (float) – maximum frequency of the loss peak.

    - deps (float) – dielectric strength.

    - N (float) – value of the high frequency flank.

    - s (float) – power law exponent.

  Returns

    y – estimated log dielectric loss based on the supplied parameters.

  Return type

    array

HN.flank_s(x, N, s)

  Function to estimate the high frequency flank contribution from the total fit

  While fitting, the deconvoluted flank is based on this function.

  Parameters

    - x (float) – frequency.

    - N (float) – value of the high frequency flank.

    - s (float) – power law exponent.

  Returns

    y – estimated log high frequency flank.

  Return type

    array

HN.cond_s(x, cond, s)

  Function to estimate the conductivity contribution from the total fit

  While fitting, the deconvoluted conductivity is based on this function.

  Parameters

    - x (float) – frequency.

    - cond (float) – DC conductivity contribution.

    - s (float) – power law exponent.

  Returns

    y – estimated log conductivity.

  Return type

    array

HN.double_hn(x, b1, g1, fm1, deps1, b2, g2, fm2, deps2)

  HN fit function to fit two dielectric loss peaks

  Parameters

    - x (float) – frequency.

    - b1 (float) – symmetric fractional parameter of the 1st peak.

    - g1 (float) – asymmetric fractional parameter of the 1st peak.

    - fm1 (float) – maximum frequency of the 1st peak.

    - deps1 (float) – dielectric strength of the 1st peak.

    - b2 (float) – symmetric fractional parameter of the 2nd peak.

    - g2 (float) – asymmetric fractional parameter of the 2nd peak.

    - fm2 (float) – maximum frequency of the 2nd peak.

    - deps2 (float) – dielectric strength of the 2nd peak.

  Returns

    y – estimated log dielectric loss based on the supplied parameters.

  Return type

    array

HN.double_hn_cond(x, b1, g1, fm1, deps1, b2, g2, fm2, deps2, cond, s)

  HN fit function to fit two dielectric loss peaks together with conductivity

  Parameters

    - x (float) – frequency.

    - b1 (float) – symmetric fractional parameter of the 1st peak.

    - g1 (float) – asymmetric fractional parameter of the 1st peak.

    - fm1 (float) – maximum frequency of the 1st peak.

    - deps1 (float) – dielectric strength of the 1st peak.

    - b2 (float) – symmetric fractional parameter of the 2nd peak.

    - g2 (float) – asymmetric fractional parameter of the 2nd peak.

    - fm2 (float) – maximum frequency of the 2nd peak.

    - deps2 (float) – dielectric strength of the 2nd peak.

    - cond (float) – DC conductivity contribution.

    - s (float) – power law exponent.

  Returns

    y – estimated log dielectric loss based on the supplied parameters.

  Return type

    array

## `HavNegpy.HN dump methods`

HN.dump_parameters_hn()

  dumps the initial fit parameters for hn function as a dictionary in a json file to load it during curve fitting

  Returns

  Return type

    None

HN.dump_parameters_double_hn()

  dumps the initial fit parameters for double hn function as a dictionary in a json file to load it during curve fitting

  Returns

  Return type

    None

HN.dump_parameters_flank()

  dumps the initial fit parameters for hn function with flank as a dictionary in a json file to load it during curve fitting

  Returns

  Return type

    None

## `HavNegpy.HN initial view methods`

HN.initial_view_hn(x, y)

  plots the hn function based on the initial parameters given via the dump_parameters method

  Parameters

    - x (array) – log frequency.

    - y (array) – log dielectric loss.

  Returns

  Return type

    None.

HN.initial_view_hn_cond(x, y)

  plots the hn function with conductivity based on the initial parameters given via the dump_parameters method

  Parameters

    - x (array) – log frequency.

    - y (array) – log dielectric loss.

  Returns

  Return type

    None.

HN.initial_view_double_hn(x, y)

  plots the double hn function based on the initial parameters given via the dump_parameters method

  Parameters

    - x (array) – log frequency.

    - y (array) – log dielectric loss.

  Returns

  Return type

    None.

HN.initial_view_double_hn_cond(x, y)

  plots the double hn function with conductivity based on the initial parameters given via the dump_parameters method

  Parameters

    - x (array) – log frequency.

    - y (array) – log dielectric loss.

  Returns

  Return type

    None.

HN.initial_view_flank(x, y)

  plots the hn function with flank based on the initial parameters given via the dump_parameters method

  Parameters

    - x (array) – log frequency.

    - y (array) – log dielectric loss.

  Returns

  Return type

    None.

## `HavNegpy.HN methods for fitting and saving the fit results`

HN.create_analysis_file()

  Creates a file to save the fit results based on the choice of fit function

  Provides option to use an existing file and creates a new file if not found

  Returns

  Return type

    None.

HN.select_range(x, y)

  Selects the region of interest to fit data using mplcursors allows two clicks to select the lower and upper bound of the x-axis and returns the selected x and y vaues for fitting

  Returns

    - x1 (array) – log frequency

    - y1 (array) – log dielectric loss

HN.fit(x, y)

  > Fits the dielectric loss data with choice of fit function The fit parameters are declared as global variables to be saved via save_fit function

  > The initial fit parameters are taken from json file and the final fit parameters are dumped in the same json file to be used for next iteration.

  > xarray

  >   log frequency.

  > yarray

  >   log dielectric loss.

  Returns

    fit_par – dictionary containing the fit parameters.

  Return type

    dictionary

HN.save_fit_hn(T)

  saves the fit parameters of hn function in a file the file must be created via create_analysis_file function

  Parameters

    T (float) – Temperature,or can also be an integer that corresponds to a file number during analysis.

  Returns

  Return type

    None.

HN.save_fit_hn_cond(T)

  saves the fit parameters of hn function with conductivity in a file, the file must be created via create_analysis_file function

  Parameters

    T (float) – Temperature,or can also be an integer that corresponds to a file number during analysis.

  Returns

  Return type

    None.

HN.save_fit_hn_flank(T)

  saves the fit parameters of hn function with flank in a file, the file must be created via create_analysis_file function

  Parameters

    T (float) – Temperature,or can also be an integer that corresponds to a file number during analysis.

  Returns

  Return type

    None.

HN.save_fit_double_HN(T)

  saves the fit parameters of double hn function in a file, the file must be created via create_analysis_file function

  Parameters

    T (float) – Temperature,or can also be an integer that corresponds to a file number during analysis.

  Returns

  Return type

    None.