MaximeVH / EquivalentCircuits.jl

A julia package to either fit the parameters of a specified equivalent electrical circuit to electrochemical impedance data, or to suggest a plausible circuit configuration for a given set of measurements (either through a comparison of circuits from the literature, or through an evolutionary algorithm approach).
MIT License
22 stars 6 forks source link

The output parameters are too small and add user customized threshold? #24

Open RunzeZhang123 opened 1 year ago

RunzeZhang123 commented 1 year ago

Hi Maxime,

Hope you are doing well!

Would it be possible for you to add a user-customized threshold for the fitting process? Sometimes I found the default threshold 5e-4 couldn't raise any results for my EIS data. Thus, I think if we can customize that fitting threshold by using an additional argument of the evolution function, that would be great.

Another issue I noticed is the evolution function sometimes give me super small component value (such as 1e-18). Would it be possible to add an argument of the evolution function so that we can control the possible ranges of different types of components?

For the circuit_optimization function, I noticed you added some additional arguments. That's really fantastic. Would it be possible for us to fix (or set initial values of) only one (or several) circuit components instead of setting them all? I noticed the current arguments require the same length of the number of components.

For example: if I want to optimize the parameters for R1-P2-[R3,P4], with the current argument, I need to set x0 = [10,10,0.5,10,10,0.5]. I wonder if I can only pass something like R1_initial = 10 but don't set other components?

Thank you so much for your generous contribution to this awesome package. This is really FANTASTIC!!!

Best, Runze

MaximeVH commented 1 year ago

Hi Runze,

Glad to receive feedback from you. These are all excellent suggestions, particularly adjusting the convergence threshold.

I will be making several updates to this package next week, and your suggestions are included in the list.

Best regards, Maxime

MaximeVH commented 1 year ago

Hi Runze,

An optional argument, convergence_threshold, has been added so that the default value of 4e-5 can be adjusted. A dictionary of parameter bounds can now be input in the circuit_evolution function in the optional argument bounds. An example of such a dictionary is: Dict('R'=>[0,1.0e9],'C'=>[0,10],'L'=>[0,5],'P'=>[[0,0],[1.0e9,1]]).

Finally, you can fix a single component value in the parameter_optimisation function by using the fixed_params argument. This argument should be a tuple containing a list of the component indices to be fixed and their respective values. For example, if you wish to fix only the first resistor of R1-P2-[R3,P4] to 10, this can be done as follows: parameteroptimisation("R1-P2-[R3,P4]", measurements,frequencies,fixed_params = ([1],[10]).

These updates have been added to the repo; I'll do some testing and make some other adjustments before they are included in the next release of this package.

Best regards,

Maxime

RunzeZhang123 commented 1 year ago

Hey Maxime,

Thank you so much for these prompt updates! Really appreciate your consistent help and impressive professionalism. Can't wait to try these new features 👯‍♂️

Best, Runze