In [1]:
%run import.ipynb
import matplotlib.pyplot as plt
Instead of using the raw creation method for models, we'll use the already available PointIsotherms, together with the from_pointisotherm
class method. Let's select one of the isotherms and attempt to model it with the Double Site Langmuir model. It is worth noting that, if the branch is not selected, the model will automatically select the adsorption branch.
In [2]:
isotherm = next(i for i in isotherms_n2_77k if i.material=='UiO-66(Zr)')
model = pygaps.ModelIsotherm.from_pointisotherm(
isotherm, model='DSLangmuir', verbose=True)
The original model is therefore reasonably good, even if there are likely microporous filling steps at low pressure which are not represented in the model. It's important to note that the ModelIsotherm has almost all the methods that the PointIsotherm has. For example:
In [3]:
model.print_info(logx=False)
Let's now apply the same model to another isotherm.
In [4]:
isotherm = next(i for i in isotherms_n2_77k if i.material=='SiO2')
try:
model = pygaps.ModelIsotherm.from_pointisotherm(
isotherm, model='DSLangmuir', verbose=True)
except Exception as e:
print(e)
We can increase the number of minimisation iterations manually, by specifying an optimisation_params
dictionary which will be passed to the relevant Scipy routine. However, the model chosen may not fit the data, no matter how much we attempt to minimise the function, as seen below.
In [5]:
isotherm = next(i for i in isotherms_n2_77k if i.material=='SiO2')
try:
model = pygaps.ModelIsotherm.from_pointisotherm(
isotherm, model='DSLangmuir', verbose=True,
optimization_params=dict(max_nfev=1e4))
except Exception as e:
print(e)
In [6]:
isotherm = next(i for i in isotherms_n2_77k if i.material=='SiO2')
model = pygaps.ModelIsotherm.from_pointisotherm(isotherm,
guess_model='all',
verbose=True)
We can see that most models failed or have a poor fit, but the BET model has been correctly identified as the best fitting one.
We can also attempt to model the desorption branch of an isotherm, and provide a manual list of models to attempt to guess, including specialised models which are not usually included in the guessing routine.
In [7]:
isotherm = next(i for i in isotherms_n2_77k if i.material=='Takeda 5A')
model = pygaps.ModelIsotherm.from_pointisotherm(
isotherm, guess_model=['GAB', 'BET', 'Langmuir'],
branch='des', verbose=True)
Just because a the minimisation has successfully produced a model that does NOT mean that the model is accurate. For example, trying to model the MCM-41 sample with a Langmuir model does not throw any errors but it is obvious that the model is not representative of the mesoporous condensation in the pores.
In [8]:
isotherm = next(i for i in isotherms_n2_77k if i.material=='MCM-41')
model = pygaps.ModelIsotherm.from_pointisotherm(isotherm,
model="DSLangmuir", verbose=True)
More info can be found in the manual section.