Comments (5)
Weird behaviour...
Under the hood, the IsothermInterpolator
is a thin wrapper around scipy.interpolate.interp1d
that adds caching for convenience. If interp_fill
is anything besides None
, its value is passed directly to the parameter fill_value
of interp1d
, which expects an array.
But then I tried going through interp1d
with the raw data and it worked just fine.
I eventually found out that the error in precision is introduced in the on-the-fly conversion. As the isotherm is in an absolute pressure mode, and it is being asked to predict loading from a relative pressure, it performs a pressure conversion in the loading_at
function. This seems to lower data precision for some reason.
Can you try?
isotherm.convert(pressure_mode='relative')
loading = isotherm.loading_at(
pressure=self.pressure,
branch='ads',
pressure_mode='relative',
loading_unit='mol',
loading_basis='molar',
material_unit='g',
material_basis='mass',
)
Does it work?
from pygaps.
Yup, that works perfectly! Thanks Paul.
from pygaps.
I have been trying to get this working for a while, and it turns the code into a complicated hack.
- The loss of precision is inherent to floating point. Not much can be done here.
- Failing gracefully on the interpolator requires a lot of data introspection to get it right. The value to interpolate can be either a number or a list, with different behaviours needed for each: searching if the data point is close to the function edges for a single number, or searching the same thing for each array member for an array.
It might be too much for an edge case. I suggest it is left as-is for now.
from pygaps.
That makes sense. Any idea why the on-the-fly conversion does this and isotherm.conver()
doesn't?
from pygaps.
In the first case there is a double convert: absolute to relative when generating pressure = isotherm.pressure(branch='ads', pressure_mode='relative')
, then relative to absolute in isotherm.loading_at()
.
When isotherm.convert()
is used, the interpolator is re-generated with the new values.
I will close this.
from pygaps.
Related Issues (20)
- Documentation: Modelling in pyGAPS HOT 3
- module 'scipy' has no attribute 'stats' HOT 3
- jensen-seaton models fail for isosteric enthalpy with example data
- Problem while using ads to calculate mesopore psd HOT 5
- Some adsorbate names unrecognised by CoolProp HOT 2
- Access isotherm parameters HOT 3
- Add uncertainty to various calculations that can benefit HOT 1
- account for a measurement of p0 at each point
- identify and convert excess/absolute isotherms HOT 4
- Quantachrome ".txt" files cannot be reliably parsed HOT 11
- carefully address isotherm fraction/percent modes
- A issue in pygaps.modelIsotherms HOT 3
- Issue in Dubinin calculations HOT 7
- Modelling problems after converting units HOT 1
- Add convert functionality for isotherm models
- AIF files version not being parsed HOT 4
- Circular import on pip install HOT 2
- 3P report file not parsing properly HOT 2
- Chi theory? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygaps.