Git Product home page Git Product logo

Comments (9)

sindresops avatar sindresops commented on September 23, 2024 1

Thanks for pointing me to those packages @richinex. I will definitely give them a go. I feel like this will end up with me integrating all four.

from equivalentcircuits.jl.

StefanPofahl avatar StefanPofahl commented on September 23, 2024 1

It took a while to figure out, how to simulate the impedance, based on the equivalent circuit model and it its parameters.
To help others here are the necessary code lines:

circuit_model = "R1-[C2,R3-[C4,R5]]"
circuit_params = parameteroptimisation(circuit_model, file_name_impedance_measurement)
circfunc = EquivalentCircuits.circuitfunction(circuit_model)
impedance_simulated = EquivalentCircuits.simulateimpedance_noiseless(circfunc, circuit_params, frequency_values)

from equivalentcircuits.jl.

MaximeVH avatar MaximeVH commented on September 23, 2024

Thank you for your feedback. An advantage of the optimization methods used in this module is that they should work regardless of initial guesses. I could include an optional argument to allow users to provide initial component parameter guesses. There are also some opportunities to leverage Julia's speed advantage for this package, which I'm considering to implement at a later stage.

from equivalentcircuits.jl.

sindresops avatar sindresops commented on September 23, 2024

Thanks for the reply! I will be familiarizing myself with the code and see if I can spot some performance traps :)

I think an optional argument for initial guess would be a great addition.

from equivalentcircuits.jl.

sindresops avatar sindresops commented on September 23, 2024

Definitely the parameter estimation that takes time. BlackBoxOptim.jl dominating the execution time.

image

I tried it with adding an optional initial guess x0. Just modifying the last unit test to take on two different guesses. The last one is the output from the parameter optimization without passing the optional argument.

image

It does not improve by orders of magnitude, but comes a little bit closer to Impedance.py.

Reducing MaxSteps from 170000 to 70000 linearly decreases execution time, without loss in accuracy for the example data in runtests.jl.

image

So I guess this optimization method does not tremendously benefit from the initial guess. I also tried modifying the SearchRange algorithm, but it did not change anything :)

I am curious as to what speed optimizations you were considering?

from equivalentcircuits.jl.

richinex avatar richinex commented on September 23, 2024

It is interesting to stumble across this great package. I am definitely gonna try library out since I have just started working with Julia . Meanwhile @sindresops I have built two python packages for multidimensional fitting of impedance spectra (pymultieis and pymultipleis - written in PyTorch and Jax respectively). You might wanna try it out. I also described in the examples how to use it to fit a single spectra.

I had to convert some of my codebase into Julia and noticed some of the concerns you raised. My take is that the optimization libraries in Julia are maybe not as optimized as they should be. I raised this same issue in Julia discourse and worked with some people to optimize my objective function as best as possible. Yet my python code still seems a little faster especially the one written in JAX (we could say that the python is just a wrapper anyway)

Concerning why impedancepy sometimes fail to fit when the initial values are far from optimal, i guess its because Levenberg Macquardt algorithm is sensitive to initial values. Also impedancepy uses scipy curve fit which employs numerical finite differencies. I implemented autodifferentiation and can see that my algorithm fits where impedancepy fails even when you use same initial values for both.

from equivalentcircuits.jl.

sindresops avatar sindresops commented on September 23, 2024

Thank you for your feedback. An advantage of the optimization methods used in this module is that they should work regardless of initial guesses. I could include an optional argument to allow users to provide initial component parameter guesses. There are also some opportunities to leverage Julia's speed advantage for this package, which I'm considering to implement at a later stage.

PR generated: #13

It seems to be quite a lot faster if you do a perfect guess (10X). I am sure that might come in handy

from equivalentcircuits.jl.

sindresops avatar sindresops commented on September 23, 2024

[...] There are also some opportunities to leverage Julia's speed advantage for this package, which I'm considering to implement at a later stage.

You mention speed advantages. If you were to point me in a direction, where would you be looking to optimize first?

from equivalentcircuits.jl.

MaximeVH avatar MaximeVH commented on September 23, 2024

The package's circuit_evolution() function uses some string processing (the manipulation and generation of strings), which has been reported as not being a strength of Julia. Suitable alternatives or improvements to this string processing could increase speed, though maybe not by a lot, as the optimization algorithms are the rate-limiting step.

As for the parameter optimization, a new option has been added in this repo (not registered yet) where you can input other optimization algorithms from the BlaxBoxOptim package. You could experiment with different optimization algorithms for the circuits you're fitting and see which trade-off between speed and performance is most suitable.

from equivalentcircuits.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.