This page was generated from docs/examples/import.ipynb. To start an interactive version: Binder badge

Reading isotherms#

The first thing to do is to read previously created isotherms. Example data can be found in the data directory, saved in the pyGAPS JSON format, which we will now open. First, we'll do the necessary top-level imports for the session.

[1]:
from pathlib import Path
import pygaps.parsing as pgp

json_path = Path.cwd() / 'data'

Then we'll import the json files, by using the isotherm_from_json method which reads an isotherm from a file (or a string). There are four folders:

  • One containing nitrogen adsorption data at 77 kelvin

[2]:
# Get the nitrogen data at 77 kelvin
isotherms_n2_77k_paths = Path(json_path / 'characterisation').rglob("*.json")
isotherms_n2_77k = [
    pgp.isotherm_from_json(filepath)
    for filepath in isotherms_n2_77k_paths
]
print('Selected', len(isotherms_n2_77k), 'isotherms with nitrogen at 77K')
Selected 5 isotherms with nitrogen at 77K
  • Another with room-temperature adsorption of \(CO_2\) combined with microcalorimetry

[3]:
# Get the combined isotherm-calorimetry data
isotherms_calorimetry_paths = Path(json_path / 'calorimetry').rglob("*.json")
isotherms_calorimetry = [
    pgp.isotherm_from_json(filepath)
    for filepath in isotherms_calorimetry_paths
]
print('Selected', len(isotherms_calorimetry), 'room temperature calorimetry isotherms')
Selected 2 room temperature calorimetry isotherms
  • Some room-temperature isotherms which we will use for IAST calculations

[4]:
# Get the isotherms for IAST calculations
isotherms_iast_paths = Path(json_path / 'iast').rglob("*.json")
isotherms_iast = [
    pgp.isotherm_from_json(filepath)
    for filepath in isotherms_iast_paths
]
print('Selected', len(isotherms_iast), 'isotherms for IAST calculation')
Selected 2 isotherms for IAST calculation
  • Finally a set of isotherms with \(C_4H_{10}\) at different temperature, for isosteric enthalpy calculations

[5]:
# Get the isotherms for isosteric enthalpy calculations
isotherms_isosteric_paths = list(Path(json_path / 'isosteric').rglob("*.json"))
isotherms_isosteric = [
    pgp.isotherm_from_json(filepath)
    for filepath in isotherms_isosteric_paths
]
print('Selected', len(isotherms_isosteric), 'isotherms for isosteric enthalpy calculation')
Selected 3 isotherms for isosteric enthalpy calculation
[ ]:
isotherms_enth_whittaker_paths = list(Path(json_path / 'whittaker').rglob("*.aiff"))
isotherms_enth_whittaker = [
    pgp.isotherm_from_aif(filepath)
    for filepath in isotherms_enth_whittaker_paths
]