Name | PyThermoLinkDB JSON |
Version |
1.3.7
JSON |
| download |
home_page | None |
Summary | PyThermoLinkDB is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications. |
upload_time | 2025-07-13 02:16:29 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
chemical engineering
thermodynamics
pythermodb
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# PyThermoLinkDB

   
`PyThermoLinkDB` is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications. It enables seamless thermodynamic data exchange, integration, and analysis. With PyThermoLinkDB, developers can easily link PyThermoDB to various tools, frameworks, and databases, streamlining thermodynamic workflows.
## ✨ **Key Features**
- 🔹 Simple and intuitive API
- ⚡ Efficient data transfer and integration
- 📂 Compatible with multiple data formats
- 📚 Extensive documentation and examples
Ideal for researchers, engineers, and developers working with thermodynamic data, PyThermoLinkDB simplifies data integration and analysis, accelerating scientific discoveries and industrial applications.
## 🌐 **Google Colab**
You can run `PyThermoLinkDB` in Google Colab:
- Basic Usage 1 [](https://colab.research.google.com/drive/1JU1ljkHgKcBNe_CuSh2Bg7hoKwQUJti0?usp=sharing)
## 📥 **Installation**
Install `pyThermoLinkDB` and `PyThermoDB` with pip
```python
pip install pyThermoLinkDB
pip install PyThermoDB
```
## 🛠️ **Usage Example**
### 🔄 **Load ThermoDB**
This section demonstrates how to load thermodynamic data files from `PyThermoDB`.
Multiple thermodynamic databases are imported: one for CO2, one for methanol, and one for NRTL interaction parameters. Each database is loaded from a pickle file using the `load_thermodb` function, and then verified with the `check()` method to ensure data integrity.
```python
# import packages/modules
import os
from rich import print
import pyThermoLinkDB as ptdblink
import pyThermoDB as ptdb
# SECTION CO2
CO2_thermodb_file = os.path.join(
os.getcwd(), 'test', 'carbon dioxide-1.pkl')
# load
CO2_thermodb = ptdb.load_thermodb(CO2_thermodb_file)
print(type(CO2_thermodb))
# check
print(CO2_thermodb.check())
# SECTION methanol
# thermodb file name
MeOH_thermodb_file = os.path.join(os.getcwd(), 'test', 'methanol-1.pkl')
print(f"thermodb file: {MeOH_thermodb_file}")
# load
MeOH_thermodb = ptdb.load_thermodb(MeOH_thermodb_file)
print(type(MeOH_thermodb))
MeOH_thermodb
# check
print(MeOH_thermodb.check())
# SECTION nrtl
# thermodb file name
nrtl_thermodb_file = os.path.join(
os.getcwd(), 'test', 'thermodb_nrtl_1.pkl')
print(f"thermodb file: {nrtl_thermodb_file}")
# load
nrtl_thermodb = ptdb.load_thermodb(nrtl_thermodb_file)
print(type(nrtl_thermodb))
# check
print(nrtl_thermodb.check())
```
### 🔌 **Initialize Thermodb Hub**
This section demonstrates how to initialize a ThermoDB hub using the `init()` function, which creates a central repository for thermodynamic data.
The code shows adding different component databases (methanol, CO2) as well as interaction parameter data (NRTL) to the hub. The `items()` method is used to list all components currently stored in the hub.
```python
# init thermodb hub
thub1 = ptdblink.init()
print(type(thub1))
# add component thermodb
thub1.add_thermodb('MeOH', MeOH_thermodb)
thub1.add_thermodb('CO2', CO2_thermodb)
# matrix data
thub1.add_thermodb('NRTL', nrtl_thermodb)
# get components
print(thub1.items())
```
### ⚙️ **ThermoDB Link Configuration**
This section shows the format of the YAML configuration file used to define thermodynamic properties and equations for different compounds. Each component has a `DATA` section for properties (like critical pressure, temperature) and an `EQUATIONS` section for thermodynamic relationships. The configuration file structure helps maintain consistent property mapping across the database.
You can use markdown (`.md`), YAML (`.yml`), or text (`.txt`) files to set the ThermoDB configuration. It is also possible to define a variable directly in your code and add the content of a `.yml`, `.txt`, or `.md` file as a string, as long as the format is correct and parsable.
Thermodb rule format (`thermodb_config.yml`):
```yml
CO2:
DATA:
Pc: Pc
Tc: Tc
AcFa: AcFa
EQUATIONS:
vapor-pressure: VaPr
heat-capacity: Cp_IG
acetylene:
DATA:
Pc: Pc
Tc: Tc
AcFa: AcFa
EQUATIONS:
vapor-pressure: VaPr
```
```markdown
## CO2
- DATA:
Pc: Pc
Tc: Tc
AcFa: AcFa
- EQUATIONS:
vapor-pressure: VaPr
heat-capacity: Cp_IG
```
```txt
# CO2
- DATA:
Pc: Pc
Tc: Tc
AcFa: AcFa
- EQUATIONS:
vapor-pressure: VaPr
heat-capacity: Cp_IG
```
```python
# add thermodb rule
thermodb_config_file = os.path.join(os.getcwd(), 'test', 'thermodb_config.yml')
# all components
res_ = thub1.config_thermodb_rule(thermodb_config_file)
# selected components
#res_ = thub1.config_thermodb_rule(thermodb_config_file, names=["MeOH", "CO2"])
print(res_)
```
### 🔧 **Add/Update ThermoDB Rule**
This section demonstrates how to add or update a ThermoDB rule for a specific chemical compound (e.g., CO2). The rule includes critical data properties and equations related to the compound, which are then added to the ThermoDB using the `add_thermodb_rule` method.
```python
# update thermodb rule
thermodb_rule_CO2 = {
'DATA': {
'Pc': 'Pc1',
'Tc': 'Tc1',
'AcFa': 'AcFa1'
},
'EQUATIONS': {
'vapor-pressure': 'VaPr1',
'heat-capacity': 'Cp_IG1'
}
}
# add thermodb rule for CO2
thub1.add_thermodb_rule('CO2', thermodb_rule_CO2)
```
### 🗑️ **Delete ThermoDB Rule**
This section demonstrates how to delete a specific ThermoDB rule using the `delete_thermodb_rule` method. In this example, the rule associated with 'CO2' is being removed.
```python
# delete thermodb rule for CO2
thub1.delete_thermodb_rule('CO2')
```
### 🔨 **Build ThermoDB Hub**
This section demonstrates the process of building data sources and equation sources using the `build` method, and then prints the resulting objects. Additionally, it showcases accessing and printing the `hub` attribute.
```python
# build
datasource, equationsource = thub1.build()
print(datasource)
print(equationsource)
# hub
print(thub1.hub)
```
### 📊 **Retrieve Data/Equation**
This section demonstrates how to access various thermodynamic data and equations from the built ThermoDB hub. Examples include retrieving critical properties (Pc, Tc) for different components, NRTL interaction parameters, and calculating values using vapor pressure and activity coefficient equations at specified conditions.
```python
# CO2 data
dt1_ = datasource['CO2']['Pc']
print(type(dt1_))
print(dt1_)
# MeOH data
dt2_ = datasource['MeOH']['Tc']
print(type(dt2_))
print(dt2_)
# NRTL data
dt3_ = datasource['NRTL']['alpha_i_j']
print(type(dt3_))
print(dt3_.ij("Alpha_methanol_ethanol"))
# CO2 equation
eq1_ = equationsource['CO2']['VaPr']
print(type(eq1_))
print(eq1_)
print(eq1_.args)
print(eq1_.cal(T=298.15))
# nrtl equation
eq2_ = equationsource['NRTL']['tau_i_j']
print(type(eq2_))
print(eq2_)
print(eq2_.args)
print(eq2_.cal(T=298.15))
```
## ❓ **FAQ**
For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)
## 👨💻 **Authors**
- [@sinagilassi](https://www.github.com/sinagilassi)
Raw data
{
"_id": null,
"home_page": null,
"name": "PyThermoLinkDB",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "chemical engineering, thermodynamics, PyThermoDB",
"author": null,
"author_email": "Sina Gilassi <sina.gilassi@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a7/b2/8a704d5c4924af0040932ce13d23f8d4d0473c6e1810730cf19180f793bf/pythermolinkdb-1.3.7.tar.gz",
"platform": null,
"description": "# PyThermoLinkDB\r\n\r\n\r\n\r\n   \r\n\r\n`PyThermoLinkDB` is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications. It enables seamless thermodynamic data exchange, integration, and analysis. With PyThermoLinkDB, developers can easily link PyThermoDB to various tools, frameworks, and databases, streamlining thermodynamic workflows.\r\n\r\n## \u2728 **Key Features**\r\n\r\n- \ud83d\udd39 Simple and intuitive API\r\n- \u26a1 Efficient data transfer and integration\r\n- \ud83d\udcc2 Compatible with multiple data formats\r\n- \ud83d\udcda Extensive documentation and examples\r\n\r\nIdeal for researchers, engineers, and developers working with thermodynamic data, PyThermoLinkDB simplifies data integration and analysis, accelerating scientific discoveries and industrial applications.\r\n\r\n\r\n## \ud83c\udf10 **Google Colab**\r\n\r\nYou can run `PyThermoLinkDB` in Google Colab:\r\n\r\n- Basic Usage 1 [](https://colab.research.google.com/drive/1JU1ljkHgKcBNe_CuSh2Bg7hoKwQUJti0?usp=sharing)\r\n\r\n\r\n## \ud83d\udce5 **Installation**\r\n\r\nInstall `pyThermoLinkDB` and `PyThermoDB` with pip\r\n\r\n```python\r\npip install pyThermoLinkDB\r\npip install PyThermoDB\r\n```\r\n\r\n## \ud83d\udee0\ufe0f **Usage Example**\r\n\r\n### \ud83d\udd04 **Load ThermoDB**\r\n\r\nThis section demonstrates how to load thermodynamic data files from `PyThermoDB`.\r\n\r\nMultiple thermodynamic databases are imported: one for CO2, one for methanol, and one for NRTL interaction parameters. Each database is loaded from a pickle file using the `load_thermodb` function, and then verified with the `check()` method to ensure data integrity.\r\n\r\n```python\r\n# import packages/modules\r\nimport os\r\nfrom rich import print\r\nimport pyThermoLinkDB as ptdblink\r\nimport pyThermoDB as ptdb\r\n\r\n# SECTION CO2\r\nCO2_thermodb_file = os.path.join(\r\n os.getcwd(), 'test', 'carbon dioxide-1.pkl')\r\n# load\r\nCO2_thermodb = ptdb.load_thermodb(CO2_thermodb_file)\r\nprint(type(CO2_thermodb))\r\n\r\n# check\r\nprint(CO2_thermodb.check())\r\n\r\n# SECTION methanol\r\n# thermodb file name\r\nMeOH_thermodb_file = os.path.join(os.getcwd(), 'test', 'methanol-1.pkl')\r\nprint(f\"thermodb file: {MeOH_thermodb_file}\")\r\n# load\r\nMeOH_thermodb = ptdb.load_thermodb(MeOH_thermodb_file)\r\nprint(type(MeOH_thermodb))\r\n\r\nMeOH_thermodb\r\n\r\n# check\r\nprint(MeOH_thermodb.check())\r\n\r\n# SECTION nrtl\r\n# thermodb file name\r\nnrtl_thermodb_file = os.path.join(\r\n os.getcwd(), 'test', 'thermodb_nrtl_1.pkl')\r\nprint(f\"thermodb file: {nrtl_thermodb_file}\")\r\n# load\r\nnrtl_thermodb = ptdb.load_thermodb(nrtl_thermodb_file)\r\nprint(type(nrtl_thermodb))\r\n\r\n# check\r\nprint(nrtl_thermodb.check())\r\n```\r\n\r\n### \ud83d\udd0c **Initialize Thermodb Hub**\r\n\r\nThis section demonstrates how to initialize a ThermoDB hub using the `init()` function, which creates a central repository for thermodynamic data.\r\n\r\nThe code shows adding different component databases (methanol, CO2) as well as interaction parameter data (NRTL) to the hub. The `items()` method is used to list all components currently stored in the hub.\r\n\r\n```python\r\n# init thermodb hub\r\nthub1 = ptdblink.init()\r\nprint(type(thub1))\r\n\r\n# add component thermodb\r\nthub1.add_thermodb('MeOH', MeOH_thermodb)\r\nthub1.add_thermodb('CO2', CO2_thermodb)\r\n# matrix data\r\nthub1.add_thermodb('NRTL', nrtl_thermodb)\r\n\r\n# get components\r\nprint(thub1.items())\r\n```\r\n\r\n### \u2699\ufe0f **ThermoDB Link Configuration**\r\n\r\nThis section shows the format of the YAML configuration file used to define thermodynamic properties and equations for different compounds. Each component has a `DATA` section for properties (like critical pressure, temperature) and an `EQUATIONS` section for thermodynamic relationships. The configuration file structure helps maintain consistent property mapping across the database.\r\n\r\nYou can use markdown (`.md`), YAML (`.yml`), or text (`.txt`) files to set the ThermoDB configuration. It is also possible to define a variable directly in your code and add the content of a `.yml`, `.txt`, or `.md` file as a string, as long as the format is correct and parsable.\r\n\r\nThermodb rule format (`thermodb_config.yml`):\r\n\r\n```yml\r\nCO2:\r\n DATA:\r\n Pc: Pc\r\n Tc: Tc\r\n AcFa: AcFa\r\n EQUATIONS:\r\n vapor-pressure: VaPr\r\n heat-capacity: Cp_IG\r\nacetylene:\r\n DATA:\r\n Pc: Pc\r\n Tc: Tc\r\n AcFa: AcFa\r\n EQUATIONS:\r\n vapor-pressure: VaPr\r\n```\r\n\r\n```markdown\r\n## CO2\r\n\r\n - DATA:\r\n Pc: Pc\r\n Tc: Tc\r\n AcFa: AcFa\r\n - EQUATIONS:\r\n vapor-pressure: VaPr\r\n heat-capacity: Cp_IG\r\n```\r\n\r\n```txt\r\n# CO2\r\n- DATA:\r\nPc: Pc\r\nTc: Tc\r\nAcFa: AcFa\r\n- EQUATIONS:\r\nvapor-pressure: VaPr\r\nheat-capacity: Cp_IG\r\n```\r\n\r\n```python\r\n# add thermodb rule\r\nthermodb_config_file = os.path.join(os.getcwd(), 'test', 'thermodb_config.yml')\r\n\r\n# all components\r\nres_ = thub1.config_thermodb_rule(thermodb_config_file)\r\n# selected components\r\n#res_ = thub1.config_thermodb_rule(thermodb_config_file, names=[\"MeOH\", \"CO2\"])\r\nprint(res_)\r\n```\r\n\r\n### \ud83d\udd27 **Add/Update ThermoDB Rule**\r\n\r\nThis section demonstrates how to add or update a ThermoDB rule for a specific chemical compound (e.g., CO2). The rule includes critical data properties and equations related to the compound, which are then added to the ThermoDB using the `add_thermodb_rule` method.\r\n\r\n```python\r\n# update thermodb rule\r\nthermodb_rule_CO2 = {\r\n 'DATA': {\r\n 'Pc': 'Pc1',\r\n 'Tc': 'Tc1',\r\n 'AcFa': 'AcFa1'\r\n },\r\n 'EQUATIONS': {\r\n 'vapor-pressure': 'VaPr1',\r\n 'heat-capacity': 'Cp_IG1'\r\n }\r\n}\r\n\r\n# add thermodb rule for CO2\r\nthub1.add_thermodb_rule('CO2', thermodb_rule_CO2)\r\n```\r\n\r\n### \ud83d\uddd1\ufe0f **Delete ThermoDB Rule**\r\n\r\nThis section demonstrates how to delete a specific ThermoDB rule using the `delete_thermodb_rule` method. In this example, the rule associated with 'CO2' is being removed.\r\n\r\n```python\r\n# delete thermodb rule for CO2\r\nthub1.delete_thermodb_rule('CO2')\r\n```\r\n\r\n### \ud83d\udd28 **Build ThermoDB Hub**\r\n\r\nThis section demonstrates the process of building data sources and equation sources using the `build` method, and then prints the resulting objects. Additionally, it showcases accessing and printing the `hub` attribute.\r\n\r\n```python\r\n# build\r\ndatasource, equationsource = thub1.build()\r\nprint(datasource)\r\nprint(equationsource)\r\n\r\n# hub\r\nprint(thub1.hub)\r\n```\r\n\r\n### \ud83d\udcca **Retrieve Data/Equation**\r\n\r\nThis section demonstrates how to access various thermodynamic data and equations from the built ThermoDB hub. Examples include retrieving critical properties (Pc, Tc) for different components, NRTL interaction parameters, and calculating values using vapor pressure and activity coefficient equations at specified conditions.\r\n\r\n```python\r\n# CO2 data\r\ndt1_ = datasource['CO2']['Pc']\r\nprint(type(dt1_))\r\nprint(dt1_)\r\n\r\n# MeOH data\r\ndt2_ = datasource['MeOH']['Tc']\r\nprint(type(dt2_))\r\nprint(dt2_)\r\n\r\n# NRTL data\r\ndt3_ = datasource['NRTL']['alpha_i_j']\r\nprint(type(dt3_))\r\nprint(dt3_.ij(\"Alpha_methanol_ethanol\"))\r\n\r\n# CO2 equation\r\neq1_ = equationsource['CO2']['VaPr']\r\nprint(type(eq1_))\r\nprint(eq1_)\r\nprint(eq1_.args)\r\nprint(eq1_.cal(T=298.15))\r\n\r\n# nrtl equation\r\neq2_ = equationsource['NRTL']['tau_i_j']\r\nprint(type(eq2_))\r\nprint(eq2_)\r\nprint(eq2_.args)\r\nprint(eq2_.cal(T=298.15))\r\n```\r\n\r\n## \u2753 **FAQ**\r\n\r\nFor any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)\r\n\r\n\r\n## \ud83d\udc68\u200d\ud83d\udcbb **Authors**\r\n\r\n- [@sinagilassi](https://www.github.com/sinagilassi)\r\n",
"bugtrack_url": null,
"license": null,
"summary": "PyThermoLinkDB is a Python package providing a robust and efficient interface between `PyThermoDB` and other applications.",
"version": "1.3.7",
"project_urls": {
"Documentation": "https://pythermolinkdb.readthedocs.io/en/latest/",
"Homepage": "https://github.com/sinagilassi/PyThermoLinkDB",
"Issue Tracker": "https://github.com/sinagilassi/PyThermoLinkDB/issues",
"Source": "https://github.com/sinagilassi/PyThermoLinkDB"
},
"split_keywords": [
"chemical engineering",
" thermodynamics",
" pythermodb"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "edd987bebdd1a98813c67547226811815f261ec84eaa5dcbf09b870cbf1d15da",
"md5": "3ac6e593cd85d22d98e4e23ce28113fc",
"sha256": "bfa772612bc7a7aa3910adde5153f12f245df0cde4adfd9dc3e11263a76ca50f"
},
"downloads": -1,
"filename": "pythermolinkdb-1.3.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3ac6e593cd85d22d98e4e23ce28113fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 14153,
"upload_time": "2025-07-13T02:16:28",
"upload_time_iso_8601": "2025-07-13T02:16:28.378112Z",
"url": "https://files.pythonhosted.org/packages/ed/d9/87bebdd1a98813c67547226811815f261ec84eaa5dcbf09b870cbf1d15da/pythermolinkdb-1.3.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a7b28a704d5c4924af0040932ce13d23f8d4d0473c6e1810730cf19180f793bf",
"md5": "19a5572010b74b52bc0bf59f2e04f252",
"sha256": "aa7284ce2de53676108046225958fa8cb80de7fa9fd6214f91f807d20a3f9a49"
},
"downloads": -1,
"filename": "pythermolinkdb-1.3.7.tar.gz",
"has_sig": false,
"md5_digest": "19a5572010b74b52bc0bf59f2e04f252",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 15109,
"upload_time": "2025-07-13T02:16:29",
"upload_time_iso_8601": "2025-07-13T02:16:29.533390Z",
"url": "https://files.pythonhosted.org/packages/a7/b2/8a704d5c4924af0040932ce13d23f8d4d0473c6e1810730cf19180f793bf/pythermolinkdb-1.3.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-13 02:16:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sinagilassi",
"github_project": "PyThermoLinkDB",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "pythermolinkdb"
}