# ๐งช Python Thermodynamics Databook

    
PyThermoDB is a lightweight and user-friendly Python package designed to provide quick access to essential thermodynamic data. Whether you're a student, researcher, or engineer, this package serves as a valuable resource for retrieving thermodynamic properties, equations, and constants from your `custom thermodynamic database` (csv files).
## โจ Key Features:
- ๐ **Handbook Data**: The package sources its data from well-established thermodynamics handbooks, ensuring accuracy and reliability (*updated regularly*).
- ๐ง **Custom Thermodynamic Database**: It is possible to builtin your own thermodynamic databook for your project.
- ๐งฉ **Minimal Dependencies**: Built with simplicity in mind, the package has minimal external dependencies, making it easy to integrate into your projects.
- ๐ **Open Source**: Feel free to explore, contribute, and customize the package according to your needs.
## ๐ Interactive Notebooks with Binder
Try PyThermoDB directly in your browser without any installation using Binder. You can find examples regarding the following contents:
- **Import Libraries**: Import the necessary libraries including pyThermoDB and rich.
- **Check Versions**: Print the version of pyThermoDB.
- **App Initialization**: Initialize the pyThermoDB application.
- **Databook List**: List all available databooks.
- **Table List**: List all tables in a specific databook.
- **Table Info**: Get information about a specific table.
- **Load Tables**: Load and display data and equations from tables.
- **Check Component Availability**: Check if a component is available in a specific table.
- **Build Data**: Build data for a specific component from a table.
- **Build Equation**: Build an equation for a specific component from a table.
Click on any of the following links to launch interactive Jupyter notebooks:
* [Basic Usage 1](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fdoc1.ipynb)
* [Custom Reference](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fref-external.ipynb)
* [Check Reference](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Ftable-view.ipynb)
## ๐ ๏ธ Examples
The repository includes an `examples` folder with various sample applications and use cases to help you get started with PyThermoDB. These examples demonstrate different methods and features of the package, including:
- ๐งฐ **Basic Usage Examples**: Learn how to use PyThermoDB for common tasks.
- ๐ **Custom Thermodynamic Databases**: Work with your own thermodynamic data.
- ๐ **Data Manipulation**: Load, search, and manipulate thermodynamic data.
- ๐ **Equations and Calculations**: Use equations for thermodynamic calculations.
Browse through these examples to learn how to use different methods and features of PyThermoDB in your own projects.
## ๐ฌ Google Colab Examples
Try PyThermoDB directly in your browser with these interactive examples:
- ๐ **Search Database**
[](https://colab.research.google.com/drive/1y5GIE4DH73SwOF2JhsTug2_U_h9Fqexx?usp=sharing)
- ๐ **COโ Thermodynamic Data**
[](https://colab.research.google.com/drive/1mzu70kACdvoB_jO6gTGVegGtK_ssOOHq?usp=sharing)
- ๐ **Check Component Availability**
[](https://colab.research.google.com/drive/1HdGHS_uypEf_yzsq7fZyLZH3dWnjYVSg?usp=sharing)
- ๐ **Basic Usage 2**
[](https://colab.research.google.com/drive/1vj84afCy0qKfHZzQdvLiJRiVstiCX0so?usp=sharing)
- ๐ฐ **Basic Usage 1**
[](https://colab.research.google.com/drive/1jWkaSJ280AZFn9t8X7_bqz_pYtY2QKbr?usp=sharing)
## ๐ Streamlit App
Check out `PyThermoDB` live! [๐ PyThermoDB on Streamlit](https://pythermodb.streamlit.app/)
## ๐ฅ Installation
Install PyThermoDB with pip:
```python
import pyThermoDB as ptdb
# check version
print(ptdb.__version__)
```
## ๐ Search a Component Name or Formula
PyThermoDB allows you to search for a specific component by its name or formula within a databook and table. This feature helps you quickly locate the relevant data and makes it easier to build a ThermoDB for the component.

### **๐ Search for a Component**
Use the following method to search for a component:
```python
# Search for a component in a databook and table
# open all tables in the browser
tdb.tables_view()
```
### **๐ Search Results**
The search results will include:
- **๐ Databook Name and ID**: The databook where the component is found.
- **๐ Table Name and ID**: The table containing the component's data.
## ๐ ๏ธ Usage Examples
* **Databook reference initialization**:
```python
# databook reference initialization
tdb = ptdb.init()
```
* **๐ DATABOOK LIST**:
```python
# databook
db_list = tdb.list_databooks()
print(db_list)
```
* **๐ TABLE LIST**:
list_tables(`databook_name or databook_id`)
```python
# table list
tb_lists = tdb.list_tables(1)
print(tb_lists)
```
* **โน๏ธ TABLE INFO**:
table_info(`databook_name or id`, `table_name or id`)
```python
# display a table
tb_info = tdb.table_info(1, 2)
print(tb_info)
```
* **๐ LOAD TABLE DATA/EQUATION**:
table_data(`databook_name or id`, `table_name or id`)
```python
# table load
res_ = tdb.table_data(1, 2)
print(res_)
```
* **๐ VIEW TABLE CONTENT IN THE BROWSER**
table_view(`databook_name or id`, `table_name or id`)
```python
# install Jinja2
pip install Jinja2
# VIEW table CONTENT
tdb.table_view(1, 2)
```
* **๐ฅ LOAD TABLES DATA|EQUATION STRUCTURE** (before building):
equation_load(`databook_name or id`, `table_name or id`)
```python
# load equation to check
vapor_pressure_tb = tdb.equation_load(1, 4)
print(vapor_pressure_tb.eq_structure(1))
# load data to check
data_table = tdb.data_load(1, 2)
print(data_table.data_structure())
```
* **๐ CHECK COMPONENT AVAILABILITY IN A TABLE**:
get_component_data(`component name`, `databook_name or id`, `table_name or id`, ...)
```python
# check component availability in the databook and table
comp1 = "carbon Dioxide"
# method 1
# CO2_check_availability = tdb.check_component(comp1, 1, 2)
# method 2:
comp_data = tdb.get_component_data(comp1, 1, 2, dataframe=True)
print(comp_data)
```
* **๐๏ธ BUILD DATA OBJECT**:
build_data(`component name`, `databook_name or id`, `table_name or id`)
```python
# build data
CO2_data = tdb.build_data(comp1, 1, 2)
print(CO2_data.data_structure())
print(CO2_data.get_property(4))
```
* **๐ BUILD EQUATION OBJECT**:
build_equation(`component name`, `databook_name or id`, `table_name or id`)
```python
# build an equation
eq = tdb.build_equation(comp1, 1, 4)
print(eq.args)
res = eq.cal(T=298.15)
print(res*1e-5)
```
## ๐งฑ Build ThermoDB for Components
DataTable & EquationTable saved as an object in `Carbon Dioxide.pkl`
* **๐จ BUILD THERMODB**:
```python
# build a thermodb
thermo_db = ptdb.build_thermodb()
print(type(thermo_db))
# version
print(thermo_db.build_version)
# thermodb name
print(thermo_db.thermodb_name)
# * add TableData
thermo_db.add_data('general', comp1_data)
# * add TableEquation
thermo_db.add_data('heat-capacity', comp1_eq)
thermo_db.add_data('vapor-pressure', vapor_pressure_eq)
# add string
# thermo_db.add_data('dHf', {'dHf_IG': 152})
# file name
# thermodb_file_path = os.path.join(os.getcwd(), f'{comp1}')
# save
thermo_db.save(
f'{comp1}', file_path='..\\pyThermoDB\\tests')
```
* **๐ CHECK THERMODB**:
```python
# check all properties and functions registered
print(thermo_db.check_properties())
print(thermo_db.check_functions())
```
## ๐ Load a ThermoDB
`Carbon Dioxide.pkl` can be loaded as:
* **๐ค LOAD THERMODB FILE**:
```python
# ref
thermodb_file = 'Carbon Dioxide.pkl'
thermodb_path = os.path.join(os.getcwd(), thermodb_file)
print(thermodb_path)
```
* **๐ฅ LOAD THERMODB**:
```python
# load thermodb
CO2_thermodb = ptdb.load_thermodb(thermodb_path)
print(type(CO2_thermodb))
```
* **โ
CHECK THERMODB**:
```python
# check all properties and functions registered
print(CO2_thermodb.check())
```
## ๐งฎ Custom Integral
* **Step 1**:
Modify `yml file` by adding `CUSTOM-INTEGRAL`.
* **Step 2**:
Add a name for the new integral body.
* **Step 3**:
Add a list containing the integral body.
```yml
CUSTOM-INTEGRAL:
Cp/R:
- A1 = parms['a0']*args['T1']
- B1 = (parms['a1']/2)*(args['T1']**2)
- C1 = (parms['a2']/3)*(args['T1']**3)
- D1 = (parms['a3']/4)*(args['T1']**4)
- E1 = (parms['a4']/5)*(args['T1']**5)
- res1 = A1 + B1 + C1 + D1 + E1
- A2 = parms['a0']*args['T2']
- B2 = (parms['a1']/2)*(args['T2']**2)
- C2 = (parms['a2']/3)*(args['T2']**3)
- D2 = (parms['a3']/4)*(args['T2']**4)
- E2 = (parms['a4']/5)*(args['T2']**5)
- res2 = A2 + B2 + C2 + D2 + E2
- res = res2 - res1
```
* **๐ฌ CHECK AS**:
```python
# check custom integral
print(comp1_eq.custom_integral)
# check body
print(comp1_eq.check_custom_integral_equation_body('Cp/R'))
# Cp/R
Cp_cal_custom_integral_Cp__R = comp1_eq.cal_custom_integral(
'Cp/R', T1=298.15, T2=320)
print(Cp_cal_custom_integral_Cp__R)
```
## ๐ Custom Databook & Table
PyThermoDB allows you to define and use custom databooks and tables for your specific thermodynamic data needs. Here's how you can set up and use a custom databook and table:
* **๐ Define Custom Reference**
Check `csv` and `yml` files to be familiar with the right format!
```python
# Define custom reference
custom_ref = {
'reference': ['nrtl.yml'],
'tables': [
'Non-randomness parameters of the NRTL equation.csv',
'Interaction parameters of the NRTL equation.csv'
]
}
```
* **๐ List Tables in Databook**
```python
# List tables in databook
tb_lists = tdb.list_tables('NRTL', res_format='json')
print(tb_lists)
```
* **๐ Load Table Data**
table_data(`databook_name or id`, `table_name or id`)
```python
# Load table data
tb_data = tdb.table_data(7, 1)
print(tb_data)
```
* **๐๏ธ Build ThermoDB for the Custom Reference**
```python
# Build ThermoDB
thermo_db = ptdb.build_thermodb()
thermo_db.add_data('nrtl_alpha', nrtl_alpha)
thermo_db.add_data('nrtl_tau', nrtl_tau_eq)
thermo_db.save('thermodb_nrtl_0', file_path='notebooks')
```
## ๐ License
This project is licensed under the MIT License. You are free to use, modify, and distribute this software in your own applications or projects. However, if you choose to use this app in another app or software, please ensure that my name, Sina Gilassi, remains credited as the original author. This includes retaining any references to the original repository or documentation where applicable. By doing so, you help acknowledge the effort and time invested in creating this project.
## โ 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": "https://github.com/sinagilassi/PyThermoDB",
"name": "PyThermoDB",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "chemical engineering, thermodynamics, thermodynamic data",
"author": "Sina Gilassi",
"author_email": "<sina.gilassi@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/4f/a8/eb5eb10a388f2eddbaec82c81a80656f36a07aec7227d7156e30d8971393/pythermodb-1.11.6.tar.gz",
"platform": null,
"description": "\r\n# \ud83e\uddea Python Thermodynamics Databook\r\r\n\r\r\n\r\r\n\r\r\n    \r\r\n\r\r\nPyThermoDB is a lightweight and user-friendly Python package designed to provide quick access to essential thermodynamic data. Whether you're a student, researcher, or engineer, this package serves as a valuable resource for retrieving thermodynamic properties, equations, and constants from your `custom thermodynamic database` (csv files).\r\r\n\r\r\n## \u2728 Key Features:\r\r\n\r\r\n- \ud83d\udcda **Handbook Data**: The package sources its data from well-established thermodynamics handbooks, ensuring accuracy and reliability (*updated regularly*).\r\r\n- \ud83d\udd27 **Custom Thermodynamic Database**: It is possible to builtin your own thermodynamic databook for your project.\r\r\n- \ud83e\udde9 **Minimal Dependencies**: Built with simplicity in mind, the package has minimal external dependencies, making it easy to integrate into your projects.\r\r\n- \ud83c\udf10 **Open Source**: Feel free to explore, contribute, and customize the package according to your needs.\r\r\n\r\r\n## \ud83d\udcd3 Interactive Notebooks with Binder\r\r\n\r\r\nTry PyThermoDB directly in your browser without any installation using Binder. You can find examples regarding the following contents:\r\r\n\r\r\n - **Import Libraries**: Import the necessary libraries including pyThermoDB and rich.\r\r\n - **Check Versions**: Print the version of pyThermoDB.\r\r\n - **App Initialization**: Initialize the pyThermoDB application.\r\r\n - **Databook List**: List all available databooks.\r\r\n - **Table List**: List all tables in a specific databook.\r\r\n - **Table Info**: Get information about a specific table.\r\r\n - **Load Tables**: Load and display data and equations from tables.\r\r\n - **Check Component Availability**: Check if a component is available in a specific table.\r\r\n - **Build Data**: Build data for a specific component from a table.\r\r\n - **Build Equation**: Build an equation for a specific component from a table.\r\r\n\r\r\nClick on any of the following links to launch interactive Jupyter notebooks:\r\r\n\r\r\n* [Basic Usage 1](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fdoc1.ipynb)\r\r\n* [Custom Reference](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fref-external.ipynb)\r\r\n* [Check Reference](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Ftable-view.ipynb)\r\r\n\r\r\n## \ud83d\udee0\ufe0f Examples\r\r\n\r\r\nThe repository includes an `examples` folder with various sample applications and use cases to help you get started with PyThermoDB. These examples demonstrate different methods and features of the package, including:\r\r\n\r\r\n- \ud83e\uddf0 **Basic Usage Examples**: Learn how to use PyThermoDB for common tasks.\r\r\n- \ud83d\udcc2 **Custom Thermodynamic Databases**: Work with your own thermodynamic data.\r\r\n- \ud83d\udd0d **Data Manipulation**: Load, search, and manipulate thermodynamic data.\r\r\n- \ud83d\udcd0 **Equations and Calculations**: Use equations for thermodynamic calculations.\r\r\n\r\r\nBrowse through these examples to learn how to use different methods and features of PyThermoDB in your own projects.\r\r\n\r\r\n## \ud83d\udd2c Google Colab Examples\r\r\n\r\r\nTry PyThermoDB directly in your browser with these interactive examples:\r\r\n\r\r\n- \ud83d\udd0d **Search Database**\r\r\n [](https://colab.research.google.com/drive/1y5GIE4DH73SwOF2JhsTug2_U_h9Fqexx?usp=sharing)\r\r\n\r\r\n- \ud83d\udcca **CO\u2082 Thermodynamic Data**\r\r\n [](https://colab.research.google.com/drive/1mzu70kACdvoB_jO6gTGVegGtK_ssOOHq?usp=sharing)\r\r\n\r\r\n- \ud83d\udd0e **Check Component Availability**\r\r\n [](https://colab.research.google.com/drive/1HdGHS_uypEf_yzsq7fZyLZH3dWnjYVSg?usp=sharing)\r\r\n\r\r\n- \ud83d\udcd8 **Basic Usage 2**\r\r\n [](https://colab.research.google.com/drive/1vj84afCy0qKfHZzQdvLiJRiVstiCX0so?usp=sharing)\r\r\n\r\r\n- \ud83d\udd30 **Basic Usage 1**\r\r\n [](https://colab.research.google.com/drive/1jWkaSJ280AZFn9t8X7_bqz_pYtY2QKbr?usp=sharing)\r\r\n\r\r\n## \ud83d\ude80 Streamlit App\r\r\n\r\r\nCheck out `PyThermoDB` live! [\ud83d\udd17 PyThermoDB on Streamlit](https://pythermodb.streamlit.app/)\r\r\n\r\r\n## \ud83d\udce5 Installation\r\r\n\r\r\nInstall PyThermoDB with pip:\r\r\n\r\r\n```python\r\r\nimport pyThermoDB as ptdb\r\r\n# check version\r\r\nprint(ptdb.__version__)\r\r\n```\r\r\n\r\r\n## \ud83d\udd0d Search a Component Name or Formula\r\r\n\r\r\nPyThermoDB allows you to search for a specific component by its name or formula within a databook and table. This feature helps you quickly locate the relevant data and makes it easier to build a ThermoDB for the component.\r\r\n\r\r\n\r\r\n\r\r\n### **\ud83d\udd0e Search for a Component**\r\r\n\r\r\nUse the following method to search for a component:\r\r\n\r\r\n```python\r\r\n# Search for a component in a databook and table\r\r\n# open all tables in the browser\r\r\ntdb.tables_view()\r\r\n```\r\r\n\r\r\n### **\ud83d\udccb Search Results**\r\r\n\r\r\nThe search results will include:\r\r\n\r\r\n- **\ud83d\udcda Databook Name and ID**: The databook where the component is found.\r\r\n- **\ud83d\udccb Table Name and ID**: The table containing the component's data.\r\r\n\r\r\n## \ud83d\udee0\ufe0f Usage Examples\r\r\n\r\r\n* **Databook reference initialization**:\r\r\n\r\r\n```python\r\r\n# databook reference initialization\r\r\ntdb = ptdb.init()\r\r\n```\r\r\n\r\r\n* **\ud83d\udcda DATABOOK LIST**:\r\r\n\r\r\n```python\r\r\n# databook\r\r\ndb_list = tdb.list_databooks()\r\r\nprint(db_list)\r\r\n```\r\r\n\r\r\n* **\ud83d\udccb TABLE LIST**:\r\r\n\r\r\nlist_tables(`databook_name or databook_id`)\r\r\n\r\r\n```python\r\r\n# table list\r\r\ntb_lists = tdb.list_tables(1)\r\r\nprint(tb_lists)\r\r\n```\r\r\n\r\r\n* **\u2139\ufe0f TABLE INFO**:\r\r\n\r\r\ntable_info(`databook_name or id`, `table_name or id`)\r\r\n\r\r\n```python\r\r\n# display a table\r\r\ntb_info = tdb.table_info(1, 2)\r\r\nprint(tb_info)\r\r\n```\r\r\n\r\r\n* **\ud83d\udcca LOAD TABLE DATA/EQUATION**:\r\r\n\r\r\ntable_data(`databook_name or id`, `table_name or id`)\r\r\n\r\r\n```python\r\r\n# table load\r\r\nres_ = tdb.table_data(1, 2)\r\r\nprint(res_)\r\r\n```\r\r\n\r\r\n* **\ud83c\udf10 VIEW TABLE CONTENT IN THE BROWSER**\r\r\n\r\r\n\r\r\ntable_view(`databook_name or id`, `table_name or id`)\r\r\n\r\r\n```python\r\r\n# install Jinja2\r\r\npip install Jinja2\r\r\n\r\r\n# VIEW table CONTENT\r\r\ntdb.table_view(1, 2)\r\r\n```\r\r\n\r\r\n* **\ud83d\udce5 LOAD TABLES DATA|EQUATION STRUCTURE** (before building):\r\r\n\r\r\nequation_load(`databook_name or id`, `table_name or id`)\r\r\n\r\r\n```python\r\r\n# load equation to check\r\r\nvapor_pressure_tb = tdb.equation_load(1, 4)\r\r\nprint(vapor_pressure_tb.eq_structure(1))\r\r\n# load data to check\r\r\ndata_table = tdb.data_load(1, 2)\r\r\nprint(data_table.data_structure())\r\r\n```\r\r\n\r\r\n* **\ud83d\udd0d CHECK COMPONENT AVAILABILITY IN A TABLE**:\r\r\n\r\r\nget_component_data(`component name`, `databook_name or id`, `table_name or id`, ...)\r\r\n\r\r\n```python\r\r\n# check component availability in the databook and table\r\r\ncomp1 = \"carbon Dioxide\"\r\r\n\r\r\n# method 1\r\r\n# CO2_check_availability = tdb.check_component(comp1, 1, 2)\r\r\n\r\r\n# method 2:\r\r\ncomp_data = tdb.get_component_data(comp1, 1, 2, dataframe=True)\r\r\nprint(comp_data)\r\r\n```\r\r\n\r\r\n* **\ud83c\udfd7\ufe0f BUILD DATA OBJECT**:\r\r\n\r\r\nbuild_data(`component name`, `databook_name or id`, `table_name or id`)\r\r\n\r\r\n```python\r\r\n# build data\r\r\nCO2_data = tdb.build_data(comp1, 1, 2)\r\r\nprint(CO2_data.data_structure())\r\r\nprint(CO2_data.get_property(4))\r\r\n```\r\r\n\r\r\n* **\ud83d\udcd0 BUILD EQUATION OBJECT**:\r\r\n\r\r\nbuild_equation(`component name`, `databook_name or id`, `table_name or id`)\r\r\n\r\r\n```python\r\r\n# build an equation\r\r\neq = tdb.build_equation(comp1, 1, 4)\r\r\nprint(eq.args)\r\r\nres = eq.cal(T=298.15)\r\r\nprint(res*1e-5)\r\r\n```\r\r\n\r\r\n## \ud83e\uddf1 Build ThermoDB for Components\r\r\n\r\r\nDataTable & EquationTable saved as an object in `Carbon Dioxide.pkl`\r\r\n\r\r\n* **\ud83d\udd28 BUILD THERMODB**:\r\r\n\r\r\n```python\r\r\n# build a thermodb\r\r\nthermo_db = ptdb.build_thermodb()\r\r\nprint(type(thermo_db))\r\r\n\r\r\n# version\r\r\nprint(thermo_db.build_version)\r\r\n\r\r\n# thermodb name\r\r\nprint(thermo_db.thermodb_name)\r\r\n\r\r\n# * add TableData\r\r\nthermo_db.add_data('general', comp1_data)\r\r\n# * add TableEquation\r\r\nthermo_db.add_data('heat-capacity', comp1_eq)\r\r\nthermo_db.add_data('vapor-pressure', vapor_pressure_eq)\r\r\n# add string\r\r\n# thermo_db.add_data('dHf', {'dHf_IG': 152})\r\r\n# file name\r\r\n# thermodb_file_path = os.path.join(os.getcwd(), f'{comp1}')\r\r\n# save\r\r\nthermo_db.save(\r\r\n f'{comp1}', file_path='..\\\\pyThermoDB\\\\tests')\r\r\n```\r\r\n\r\r\n* **\ud83d\udd0d CHECK THERMODB**:\r\r\n\r\r\n```python\r\r\n# check all properties and functions registered\r\r\nprint(thermo_db.check_properties())\r\r\nprint(thermo_db.check_functions())\r\r\n```\r\r\n\r\r\n## \ud83d\udcc2 Load a ThermoDB\r\r\n\r\r\n`Carbon Dioxide.pkl` can be loaded as:\r\r\n\r\r\n* **\ud83d\udce4 LOAD THERMODB FILE**:\r\r\n\r\r\n```python\r\r\n# ref\r\r\nthermodb_file = 'Carbon Dioxide.pkl'\r\r\nthermodb_path = os.path.join(os.getcwd(), thermodb_file)\r\r\nprint(thermodb_path)\r\r\n```\r\r\n\r\r\n* **\ud83d\udce5 LOAD THERMODB**:\r\r\n\r\r\n```python\r\r\n# load thermodb\r\r\nCO2_thermodb = ptdb.load_thermodb(thermodb_path)\r\r\nprint(type(CO2_thermodb))\r\r\n```\r\r\n\r\r\n* **\u2705 CHECK THERMODB**:\r\r\n\r\r\n```python\r\r\n# check all properties and functions registered\r\r\nprint(CO2_thermodb.check())\r\r\n```\r\r\n\r\r\n## \ud83e\uddee Custom Integral\r\r\n\r\r\n* **Step 1**:\r\r\n\r\r\n Modify `yml file` by adding `CUSTOM-INTEGRAL`.\r\r\n\r\r\n* **Step 2**:\r\r\n\r\r\n Add a name for the new integral body.\r\r\n\r\r\n* **Step 3**:\r\r\n\r\r\n Add a list containing the integral body.\r\r\n\r\r\n```yml\r\r\nCUSTOM-INTEGRAL:\r\r\n Cp/R:\r\r\n - A1 = parms['a0']*args['T1']\r\r\n - B1 = (parms['a1']/2)*(args['T1']**2)\r\r\n - C1 = (parms['a2']/3)*(args['T1']**3)\r\r\n - D1 = (parms['a3']/4)*(args['T1']**4)\r\r\n - E1 = (parms['a4']/5)*(args['T1']**5)\r\r\n - res1 = A1 + B1 + C1 + D1 + E1\r\r\n - A2 = parms['a0']*args['T2']\r\r\n - B2 = (parms['a1']/2)*(args['T2']**2)\r\r\n - C2 = (parms['a2']/3)*(args['T2']**3)\r\r\n - D2 = (parms['a3']/4)*(args['T2']**4)\r\r\n - E2 = (parms['a4']/5)*(args['T2']**5)\r\r\n - res2 = A2 + B2 + C2 + D2 + E2\r\r\n - res = res2 - res1\r\r\n```\r\r\n\r\r\n* **\ud83d\udd2c CHECK AS**:\r\r\n\r\r\n```python\r\r\n# check custom integral\r\r\nprint(comp1_eq.custom_integral)\r\r\n# check body\r\r\nprint(comp1_eq.check_custom_integral_equation_body('Cp/R'))\r\r\n\r\r\n# Cp/R\r\r\nCp_cal_custom_integral_Cp__R = comp1_eq.cal_custom_integral(\r\r\n 'Cp/R', T1=298.15, T2=320)\r\r\nprint(Cp_cal_custom_integral_Cp__R)\r\r\n```\r\r\n\r\r\n## \ud83d\udcda Custom Databook & Table\r\r\n\r\r\nPyThermoDB allows you to define and use custom databooks and tables for your specific thermodynamic data needs. Here's how you can set up and use a custom databook and table:\r\r\n\r\r\n* **\ud83d\udcdd Define Custom Reference**\r\r\n\r\r\nCheck `csv` and `yml` files to be familiar with the right format!\r\r\n\r\r\n```python\r\r\n# Define custom reference\r\r\ncustom_ref = {\r\r\n 'reference': ['nrtl.yml'],\r\r\n 'tables': [\r\r\n 'Non-randomness parameters of the NRTL equation.csv',\r\r\n 'Interaction parameters of the NRTL equation.csv'\r\r\n ]\r\r\n}\r\r\n```\r\r\n\r\r\n* **\ud83d\udccb List Tables in Databook**\r\r\n\r\r\n```python\r\r\n# List tables in databook\r\r\ntb_lists = tdb.list_tables('NRTL', res_format='json')\r\r\nprint(tb_lists)\r\r\n```\r\r\n\r\r\n* **\ud83d\udcc2 Load Table Data**\r\r\n\r\r\ntable_data(`databook_name or id`, `table_name or id`)\r\r\n\r\r\n```python\r\r\n# Load table data\r\r\ntb_data = tdb.table_data(7, 1)\r\r\nprint(tb_data)\r\r\n```\r\r\n\r\r\n* **\ud83c\udfd7\ufe0f Build ThermoDB for the Custom Reference**\r\r\n\r\r\n```python\r\r\n# Build ThermoDB\r\r\nthermo_db = ptdb.build_thermodb()\r\r\nthermo_db.add_data('nrtl_alpha', nrtl_alpha)\r\r\nthermo_db.add_data('nrtl_tau', nrtl_tau_eq)\r\r\nthermo_db.save('thermodb_nrtl_0', file_path='notebooks')\r\r\n```\r\r\n\r\r\n## \ud83d\udcdd License\r\r\n\r\r\nThis project is licensed under the MIT License. You are free to use, modify, and distribute this software in your own applications or projects. However, if you choose to use this app in another app or software, please ensure that my name, Sina Gilassi, remains credited as the original author. This includes retaining any references to the original repository or documentation where applicable. By doing so, you help acknowledge the effort and time invested in creating this project.\r\r\n\r\r\n## \u2753 FAQ\r\r\n\r\r\nFor any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)\r\r\n\r\r\n\r\r\n## \ud83d\udc68\u200d\ud83d\udcbb Authors\r\r\n\r\r\n- [@sinagilassi](https://www.github.com/sinagilassi)\r\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "PyThermoDB is a lightweight and user-friendly Python package designed to provide quick access to essential thermodynamic data.",
"version": "1.11.6",
"project_urls": {
"Documentation": "https://pythermodb.readthedocs.io/en/latest/",
"Homepage": "https://github.com/sinagilassi/PyThermoDB",
"Source": "https://github.com/sinagilassi/PyThermoDB",
"Tracker": "https://github.com/sinagilassi/PyThermoDB/issues"
},
"split_keywords": [
"chemical engineering",
" thermodynamics",
" thermodynamic data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe7635a49df101963c84b87e409ebb66ec109d596eafc8f12dbd806420827c70",
"md5": "d807931fd3a8db400d50a0079dade03c",
"sha256": "35ccfe793effc88f854694e7004f58b0720d05c21d1a721255ccc024b056701c"
},
"downloads": -1,
"filename": "pythermodb-1.11.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d807931fd3a8db400d50a0079dade03c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 354344,
"upload_time": "2025-07-11T06:39:48",
"upload_time_iso_8601": "2025-07-11T06:39:48.752735Z",
"url": "https://files.pythonhosted.org/packages/fe/76/35a49df101963c84b87e409ebb66ec109d596eafc8f12dbd806420827c70/pythermodb-1.11.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4fa8eb5eb10a388f2eddbaec82c81a80656f36a07aec7227d7156e30d8971393",
"md5": "27963c95fe215bece2aeb552a7837ad1",
"sha256": "28fd1b2e8c7b2eaf41fae3197b266bcf72630c559e263070a7c5c32bae53cdda"
},
"downloads": -1,
"filename": "pythermodb-1.11.6.tar.gz",
"has_sig": false,
"md5_digest": "27963c95fe215bece2aeb552a7837ad1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 319196,
"upload_time": "2025-07-11T06:39:50",
"upload_time_iso_8601": "2025-07-11T06:39:50.179690Z",
"url": "https://files.pythonhosted.org/packages/4f/a8/eb5eb10a388f2eddbaec82c81a80656f36a07aec7227d7156e30d8971393/pythermodb-1.11.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-11 06:39:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sinagilassi",
"github_project": "PyThermoDB",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "pythermodb"
}