DistributedRelaxationTimes.calculate_shape_factor
— Methodcalculate_shape_factor(frequencies,coefficient, rbf_kernel)
Calculates the shape factor of the RBF using the Full Width at Half Maximum (FWHM).
The inputs are the frequencies
, the width coefficient hyperparameter coefficient
and the used RBF function rbf_kernel
.
DistributedRelaxationTimes.compute_DRT
— Methodcompute_DRT(frequencies, measurements; <keyword arguments>)
Calculate the Distribution of Relaxation Times using RBF discretization and Tikhonov regularisation.
The essential inputs are a set of frequencies and the impedance measurements conducted at those frequencies. There are also a number of keyword arguments to fine-tune the calculation.
Keyword arguments
method::String="im"
: the part of the measurements used to calculate the DRT.rbf_kernel = SqExponentialKernel()
: The RBF used to discretize the DRT.width_coeff::Float64=0.10
: the hyperparameter influencing the shape factor of the RBF.λ::Float64=1e-2
: a hyperparameter tuning the degree of regularisation.peak_strictness::Float64=0.01
: A measure to avoid artifacts in the DRT by removing peaks with amplitude less than a given percentage of the highest peak.
DistributedRelaxationTimes.construct_Z_imag
— MethodconstructZimag(freq, ϵ, rbf_kernel)
Calculates the matrix to be multiplied with the weights Θ
to obtain the imaginary part of the reconstructed impedance values in the DRT equation. As this matrix can be Toeplitz factorized, it can be efficiently constructed using the first column and first rows.
DistributedRelaxationTimes.construct_Z_real
— Methodconstruct_Z_real(freq, ϵ, rbf_kernel)
Calculates the matrix to be multiplied with the weights Θ
to obtain the real part of the reconstructed impedance values in the DRT equation. As this matrix can be Toeplitz factorized, it can be efficiently constructed using the first column and first rows.
DistributedRelaxationTimes.drt_interpolation
— Methoddrt_interpolation(out_frequencies,frequencies, θ, ϵ, rbf_kernel)
Calculates the DRT (defined on the whole real line), using the weights θ the RBF information, and the frequencies.
DistributedRelaxationTimes.find_optimal_lambda
— Methodfind_optimal_lambda(frequencies, measurements;
method="re_im_cv",
width_coeff=0.1,
rbf_kernel=SqExponentialKernel())
Suggests values for the hyperparameter λ
` using Saccoccio et al.'s discrepancy or Re-Im-crossvalidation methods.
The function's inputs and keyword arguments are similar to the those of the compute_DRT
function, with the exception of the method
keyword argument, which allows users to choose between
re_im_cv
: Re-Im-crossvalidationdiscrepancy
: minimisation of the discrepancy between the weightsθ
calculated using the real and imaginary parts of the impedance spectrum.
DistributedRelaxationTimes.get_peak_inds
— Methodgetpeakinds(drt,strictness)
Find the peaks in the DRT. Possible artifacts are eliminated depending on the value of the strictness argument.
DistributedRelaxationTimes.integration_Z_imag
— Methodintegration_Z_imag(ϵ, fᵣ, fc, rbf_kernel)
Performs the numerical integration required to calculate the values of the reconstructed imaginary impedance values in the DRT equation.
DistributedRelaxationTimes.integration_Z_real
— Methodintegration_Z_real(ϵ,fᵣ,fc, rbf_kernel)
Performs the numerical integration required to calculate the values of the reconstructed real impedance values in the DRT equation.
DistributedRelaxationTimes.joint_objective
— Functionoint_objective(X₁, Y₁, X₂, Y₂, θ, λ, weights)
Objective function for the DRT calculation using both the real (Y₁
) and imaginary (Y₂
) parts of the impedance measurements. - X₁
and X₂
are the matrices for the reconstruction of the real and imaginary impedance values, respectively. - θ
is a vector of weights to be optimised. - λ
is the regularisation hyperparameter. - weights
provides the option to provide more weight to the real or imaginary parts during the optimisation.
DistributedRelaxationTimes.objective
— Methodobjective(X, Y, θ, λ)
Objective function for the Tikhonov regularisation, where X
is the matrix for the reconstruction of the real or imaginary impedance values, Y
is the real or imaginary part of the impedance measurements, θ
is a vector of weights to be optimised, and λ
is the regularisation hyperparameter.
DistributedRelaxationTimes.plot_DRT
— Methodplot_DRT(peak_times, peak_amps, τs, γs)
Visualises the output of the compute_DRT
function.
Keyword arguments: - lab::String="DRT"
: label for the plot. - title::String="Distribution of relaxation times"
: The title of the plot. - color::Symbol=:auto
: The color of the DRT plot. - style::Symbol=:solid
: The linestyle of the DRT plot.
DistributedRelaxationTimes.regulariser
— Methodregulariser(λ ,Θ)
Calculates the regularisation term using the L2-norm of the weight vector Θ
and the tuning hyperparameter λ
.