{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Reading isotherms\n", "\n", "The first thing to do is to read previously created isotherms. Example data can\n", "be found in the\n", "[data](https://github.com/pauliacomi/pyGAPS/tree/master/docs/examples/data)\n", "directory, saved in the pyGAPS JSON format, which we will now open. First, we'll\n", "do the necessary top-level imports for the session." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "import pygaps.parsing as pgp\n", "\n", "json_path = Path.cwd() / 'data'" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Then we'll import the json files, by using the `isotherm_from_json` method which\n", "reads an isotherm from a file (or a string). There are four folders:\n", "\n", "- One containing nitrogen adsorption data at 77 kelvin" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Selected 5 isotherms with nitrogen at 77K\n" ] } ], "source": [ "# Get the nitrogen data at 77 kelvin\n", "isotherms_n2_77k_paths = Path(json_path / 'characterisation').rglob(\"*.json\")\n", "isotherms_n2_77k = [pgp.isotherm_from_json(filepath) for filepath in isotherms_n2_77k_paths]\n", "print('Selected', len(isotherms_n2_77k), 'isotherms with nitrogen at 77K')" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "- Another with room-temperature adsorption of $CO_2$ combined with microcalorimetry" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Selected 2 room temperature calorimetry isotherms\n" ] } ], "source": [ "# Get the combined isotherm-calorimetry data\n", "isotherms_calorimetry_paths = Path(json_path / 'calorimetry').rglob(\"*.json\")\n", "isotherms_calorimetry = [\n", " pgp.isotherm_from_json(filepath) for filepath in isotherms_calorimetry_paths\n", "]\n", "print('Selected', len(isotherms_calorimetry), 'room temperature calorimetry isotherms')" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "- Some room-temperature isotherms which we will use for IAST calculations" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Selected 2 isotherms for IAST calculation\n" ] } ], "source": [ "# Get the isotherms for IAST calculations\n", "isotherms_iast_paths = Path(json_path / 'iast').rglob(\"*.json\")\n", "isotherms_iast = [pgp.isotherm_from_json(filepath) for filepath in isotherms_iast_paths]\n", "print('Selected', len(isotherms_iast), 'isotherms for IAST calculation')" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "- A set of isotherms with $C_4H_{10}$ at different temperature, for isosteric enthalpy calculations" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Selected 3 isotherms for isosteric enthalpy calculation\n" ] } ], "source": [ "# Get the isotherms for isosteric enthalpy calculations\n", "isotherms_isosteric_paths = list(Path(json_path / 'enth_isosteric').rglob(\"*.json\"))\n", "isotherms_isosteric = [pgp.isotherm_from_json(filepath) for filepath in isotherms_isosteric_paths]\n", "print('Selected', len(isotherms_isosteric), 'isotherms for isosteric enthalpy calculation')" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "- Isotherms used for Whittaker enthalpy calculations" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "isotherms_enth_whittaker_paths = list(Path(json_path / 'enth_whittaker').rglob(\"*.aiff\"))\n", "isotherms_enth_whittaker = [\n", " pgp.isotherm_from_aif(filepath) for filepath in isotherms_enth_whittaker_paths\n", "]" ] } ], "metadata": { "kernelspec": { "display_name": "sci", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.16" }, "vscode": { "interpreter": { "hash": "bb92cfc77ebe3751b7fb3df8620ceb006227daaf69256df93b17635e0b7c66c1" } } }, "nbformat": 4, "nbformat_minor": 2 }