Giter VIP home page Giter VIP logo

Comments (4)

pauliacomi avatar pauliacomi commented on September 26, 2024 1

Hi Arni,

I can confirm that the behaviour is as you described.

I do remember that the code is supposed to default to fit [0,0] and the first isotherm point if the fit isn't good enough. I'll look into this, likely before week is over as I am currently in the process of refactoring some code for the next version (expect 1.7/2.0 depending on the number of changes).

By the way, you can load the isotherm directly from the ISODB using an inbuilt function (which actually uses requests under the hood).

import pygaps

iso_name = "10.1021La803074g.isotherm3b"
iso = pygaps.isotherm_from_isodb(iso_name)

should do the same thing.

Best,
Paul

from pygaps.

pauliacomi avatar pauliacomi commented on September 26, 2024

Hi Arni,

After a bit of digging, I found the reason for this behaviour.

When a pyGAPS "model" (such as Henry, Langmuir, etc) is fitted, an initial guess is generated for the model parameters based on a langmuir constant and saturation approximation. There was an error in how this initial guess was calculated:

langmuir_k = loading[0] / pressure[0] / (saturation_loading - pressure[0])

Instead of

langmuir_k = loading[0] / pressure[0] / (saturation_loading - loading[0])

With most isotherms this was not a problem as the wrong value was "good enough" for a starting guess. On the other hand, when the isotherm had only one point (not including the [0,0]), the initial guess ended up negative or NaN, which led to minimisation problems.

I've made the above fix in the development branch of the code. The code snippet you provided should now work (provided you have the dev installed). If you have some time, could you check whether it fixes the problem on your end? If not, I suggest you wait until v2.0 is released over the weekend.

Best,
Paul

from pygaps.

Surluson avatar Surluson commented on September 26, 2024

Hi Paul,
Sorry for the late response, but your newest version did indeed fix the issue I was having.

Thanks for taking the time to actively continue developing PyGAPS!

Best,
Árni

from pygaps.

pauliacomi avatar pauliacomi commented on September 26, 2024

Hi Árni,

That's great to hear!
And thank you for the feedback.
Please don't hesitate to let me know if you find any other bugs or inconsistencies.

Best,
Paul

from pygaps.

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.