In [1]:
import os
import matplotlib.pyplot as plt
import pygaps
json_path = os.path.join(os.getcwd(), 'data')
Then we'll import the json files. To do this, we need to find all the files with the .json extension and open them for reading. We can use the pygaps.util_get_file_paths function to get all the file paths in a folder.
Then we'll open the files and create the isotherms with the isotherm_from_json method which converts a string, or simply by using the isotherm_from_jsonf method which reads a file directly. There are three folders:
In [2]:
# Get the nitrogen data at 77 kelvin
isotherms_n2_77k_paths = pygaps.util_get_file_paths(
os.path.join(json_path, 'characterisation'), '.json')
isotherms_n2_77k = []
for filepath in isotherms_n2_77k_paths:
with open(filepath, 'r') as text_file:
isotherms_n2_77k.append(pygaps.isotherm_from_json(text_file.read()))
print('Selected', len(isotherms_n2_77k), 'isotherms with nitrogen at 77K')
In [3]:
# Get the combined isotherm-calorimetry data
isotherms_calorimetry_paths = pygaps.util_get_file_paths(
os.path.join(json_path, 'calorimetry'), '.json')
isotherms_calorimetry = []
for filepath in isotherms_calorimetry_paths:
isotherms_calorimetry.append(pygaps.isotherm_from_jsonf(filepath))
print('Selected', len(isotherms_calorimetry), 'room temperature calorimetry isotherms')
In [4]:
# Get the isotherms for IAST calculations
isotherms_iast_paths = pygaps.util_get_file_paths(
os.path.join(json_path, 'iast'), '.json')
isotherms_iast = []
for filepath in isotherms_iast_paths:
isotherms_iast.append(pygaps.isotherm_from_jsonf(filepath))
print('Selected', len(isotherms_iast), 'isotherms for IAST calculation')
In [5]:
# Get the isotherms for isosteric enthalpy calculations
isotherms_isosteric_paths = pygaps.util_get_file_paths(
os.path.join(json_path, 'isosteric'), '.json')
isotherms_isosteric = []
for filepath in isotherms_isosteric_paths:
isotherms_isosteric.append(pygaps.isotherm_from_jsonf(filepath))
print('Selected', len(isotherms_isosteric), 'isotherms for isosteric enthalpy calculation')