PyThermoDB


NamePyThermoDB JSON
Version 1.7.2 PyPI version JSON
download
home_pageNone
SummaryPyThermoDB is a lightweight and user-friendly Python package designed to provide quick access to essential thermodynamic data.
upload_time2024-12-18 21:58:41
maintainerNone
docs_urlNone
authorSina Gilassi
requires_python>=3.10
licenseMIT
keywords python chemical engineering thermodynamics pythermodb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
![PyThermoDB](https://drive.google.com/uc?export=view&id=1-yWNEkK4tL1qvi8FE_4OwcLYuTF2AkPP)



![Downloads](https://img.shields.io/pypi/dm/PyThermoDB) ![PyPI](https://img.shields.io/pypi/v/PyThermoDB) ![Python Version](https://img.shields.io/pypi/pyversions/PyThermoDB.svg) ![License](https://img.shields.io/pypi/l/PyThermoDB) ![Read the Docs](https://img.shields.io/readthedocs/pythermodb)



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.





## Google Colab



You can use the following code to run `PyThermoDB` in Google Colab:



| Version | Scripts |

|---------|---------|

| 1.6.0 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1vj84afCy0qKfHZzQdvLiJRiVstiCX0so?usp=sharing) |

| 1.5.0 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1jWkaSJ280AZFn9t8X7_bqz_pYtY2QKbr?usp=sharing) |



**Examples on Google Colab**



| Example | Scripts |

|---------|---------|

| CO₂ Thermodynamic Data | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1mzu70kACdvoB_jO6gTGVegGtK_ssOOHq?usp=sharing) |

| Check Component Availability | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1HdGHS_uypEf_yzsq7fZyLZH3dWnjYVSg?usp=sharing) |



## Installation



Install PyThermoDB with pip



```python

import pyThermoDB as ptdb

# check version

print(ptdb.__version__)

```



## Usage Example



* databook reference initialization:



```python

# databook reference initialization

tdb = ptdb.init()

```



* DATABOOK LIST:



```python

# databook

db_list = tdb.list_databooks()

print(db_list)

```



* TABLE LIST:



```python

# table list

tb_lists = tdb.list_tables(1)

print(tb_lists)

```



* TABLE INFO:



```python

# display a table

tb_info = tdb.table_info(1, 2)

print(tb_info)

```



* LOAD TABLES (before building):



```python

# load equation to check

vapor_pressure_tb = tdb.equation_load(1, 4)

pp(vapor_pressure_tb.eq_structure(1))

# load data to check

data_table = tdb.data_load(1, 2)

pp(data_table.data_structure())

```



* CHECK COMPONENT AVAILABILITY IN A TABLE:



```python

# check component availability in the databook and table

comp1 = "carbon Dioxide"

# CO2_check_availability = tdb.check_component(comp1, 1, 2)



# load comp data

# comp_data = tdb.get_component_data(comp1, 1, 2, dataframe=True)

# pp(comp_data)

```



* BUILD DATA OBJECT:



```python

# build data

CO2_data = tdb.build_data(comp1, 1, 2)

pp(CO2_data.data_structure())

pp(CO2_data.get_property(4))

```



* BUILD EQUATION OBJECT:



```python

# build an equation

eq = tdb.build_equation(comp1, 1, 4)

pp(eq.args)

res = eq.cal(T=298.15)

pp(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()

pp(type(thermo_db))



# * 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='E:\\Python Projects\\pyThermoDB\\tests')

```



* CHECK THERMODB:



```python

# check all properties and functions registered

pp(thermo_db.check_properties())

pp(thermo_db.check_functions())

```



### Load a ThermoDB



`Carbon Dioxide.pkl` can be loaded as:



* LOAD THERMODB



```python

# ref

thermodb_file = 'Carbon Dioxide.pkl'

thermodb_path = os.path.join(os.getcwd(), thermodb_file)

pp(thermodb_path)

```



* LOAD THERMODB



```python

# load thermodb

CO2_thermodb = ptdb.load_thermodb(thermodb_path)

pp(type(CO2_thermodb))

```



* CHECK THERMODB



```python

# check all properties and functions registered

pp(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

pp(comp1_eq.custom_integral)

# check body

pp(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)

pp(Cp_cal_custom_integral_Cp__R)

```



## 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": "PyThermoDB",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "python, chemical engineering, thermodynamics, PyThermoDB",
    "author": "Sina Gilassi",
    "author_email": "<sina.gilassi@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f6/d6/f8363213f0d27f77b56456f8b8246ab766591070cdd058f69fee452aefec/pythermodb-1.7.2.tar.gz",
    "platform": null,
    "description": "\r\n![PyThermoDB](https://drive.google.com/uc?export=view&id=1-yWNEkK4tL1qvi8FE_4OwcLYuTF2AkPP)\r\r\n\r\r\n![Downloads](https://img.shields.io/pypi/dm/PyThermoDB) ![PyPI](https://img.shields.io/pypi/v/PyThermoDB) ![Python Version](https://img.shields.io/pypi/pyversions/PyThermoDB.svg) ![License](https://img.shields.io/pypi/l/PyThermoDB) ![Read the Docs](https://img.shields.io/readthedocs/pythermodb)\r\r\n\r\r\nPython Thermodynamics Databook\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\nKey Features:\r\r\n\r\r\n- **Handbook Data**: The package sources its data from well-established thermodynamics handbooks, ensuring accuracy and reliability (*updated regularly*).\r\r\n- **Custom Thermodynamic Database**: It is possible to builtin your own thermodynamic databook for your project.\r\r\n- **Minimal Dependencies**: Built with simplicity in mind, the package has minimal external dependencies, making it easy to integrate into your projects.\r\r\n- **Open Source**: Feel free to explore, contribute, and customize the package according to your needs.\r\r\n\r\r\n\r\r\n## Google Colab\r\r\n\r\r\nYou can use the following code to run `PyThermoDB` in Google Colab:\r\r\n\r\r\n| Version | Scripts |\r\r\n|---------|---------|\r\r\n| 1.6.0 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1vj84afCy0qKfHZzQdvLiJRiVstiCX0so?usp=sharing) |\r\r\n| 1.5.0 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1jWkaSJ280AZFn9t8X7_bqz_pYtY2QKbr?usp=sharing) |\r\r\n\r\r\n**Examples on Google Colab**\r\r\n\r\r\n| Example | Scripts |\r\r\n|---------|---------|\r\r\n| CO\u2082 Thermodynamic Data | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1mzu70kACdvoB_jO6gTGVegGtK_ssOOHq?usp=sharing) |\r\r\n| Check Component Availability | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1HdGHS_uypEf_yzsq7fZyLZH3dWnjYVSg?usp=sharing) |\r\r\n\r\r\n## 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## Usage Example\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* 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* TABLE LIST:\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* TABLE INFO:\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* LOAD TABLES (before building):\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\npp(vapor_pressure_tb.eq_structure(1))\r\r\n# load data to check\r\r\ndata_table = tdb.data_load(1, 2)\r\r\npp(data_table.data_structure())\r\r\n```\r\r\n\r\r\n* CHECK COMPONENT AVAILABILITY IN A TABLE:\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# CO2_check_availability = tdb.check_component(comp1, 1, 2)\r\r\n\r\r\n# load comp data\r\r\n# comp_data = tdb.get_component_data(comp1, 1, 2, dataframe=True)\r\r\n# pp(comp_data)\r\r\n```\r\r\n\r\r\n* BUILD DATA OBJECT:\r\r\n\r\r\n```python\r\r\n# build data\r\r\nCO2_data = tdb.build_data(comp1, 1, 2)\r\r\npp(CO2_data.data_structure())\r\r\npp(CO2_data.get_property(4))\r\r\n```\r\r\n\r\r\n* BUILD EQUATION OBJECT:\r\r\n\r\r\n```python\r\r\n# build an equation\r\r\neq = tdb.build_equation(comp1, 1, 4)\r\r\npp(eq.args)\r\r\nres = eq.cal(T=298.15)\r\r\npp(res*1e-5)\r\r\n```\r\r\n\r\r\n### 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* BUILD THERMODB:\r\r\n\r\r\n```python\r\r\n# build a thermodb\r\r\nthermo_db = ptdb.build_thermodb()\r\r\npp(type(thermo_db))\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='E:\\\\Python Projects\\\\pyThermoDB\\\\tests')\r\r\n```\r\r\n\r\r\n* CHECK THERMODB:\r\r\n\r\r\n```python\r\r\n# check all properties and functions registered\r\r\npp(thermo_db.check_properties())\r\r\npp(thermo_db.check_functions())\r\r\n```\r\r\n\r\r\n### Load a ThermoDB\r\r\n\r\r\n`Carbon Dioxide.pkl` can be loaded as:\r\r\n\r\r\n* LOAD THERMODB\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\npp(thermodb_path)\r\r\n```\r\r\n\r\r\n* 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\npp(type(CO2_thermodb))\r\r\n```\r\r\n\r\r\n* CHECK THERMODB\r\r\n\r\r\n```python\r\r\n# check all properties and functions registered\r\r\npp(CO2_thermodb.check())\r\r\n```\r\r\n\r\r\n### Custom Integral\r\r\n\r\r\n* Step 1:\r\r\n\r\r\nModify `yml file` by adding `CUSTOM-INTEGRAL`.\r\r\n\r\r\n* Step 2:\r\r\n\r\r\nAdd a name for the new integral body.\r\r\n\r\r\n* Step 3:\r\r\n\r\r\nAdd 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* CHECK AS:\r\r\n\r\r\n```python\r\r\n# check custom integral\r\r\npp(comp1_eq.custom_integral)\r\r\n# check body\r\r\npp(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\npp(Cp_cal_custom_integral_Cp__R)\r\r\n```\r\r\n\r\r\n## 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## 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.7.2",
    "project_urls": null,
    "split_keywords": [
        "python",
        " chemical engineering",
        " thermodynamics",
        " pythermodb"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2148b82ae89f3c1e3739f8ec15a7b613d3f1c11c807edf8b88a03ea14618717",
                "md5": "0e840ebfe27859c98dade4f7c2e714d8",
                "sha256": "6ba4806da7f05ce2a8355fe47254e8a5d03d5407cc7ebe440f1c9c0b83850f4d"
            },
            "downloads": -1,
            "filename": "PyThermoDB-1.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0e840ebfe27859c98dade4f7c2e714d8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 118862,
            "upload_time": "2024-12-18T21:58:32",
            "upload_time_iso_8601": "2024-12-18T21:58:32.114879Z",
            "url": "https://files.pythonhosted.org/packages/e2/14/8b82ae89f3c1e3739f8ec15a7b613d3f1c11c807edf8b88a03ea14618717/PyThermoDB-1.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f6d6f8363213f0d27f77b56456f8b8246ab766591070cdd058f69fee452aefec",
                "md5": "203b17726fef862caa354a9f2275b2b7",
                "sha256": "6d1802116fcc053462dd4c08edaf5a120bfc6f5f1c1f1056a8f9c94ca803e53a"
            },
            "downloads": -1,
            "filename": "pythermodb-1.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "203b17726fef862caa354a9f2275b2b7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 103835,
            "upload_time": "2024-12-18T21:58:41",
            "upload_time_iso_8601": "2024-12-18T21:58:41.108414Z",
            "url": "https://files.pythonhosted.org/packages/f6/d6/f8363213f0d27f77b56456f8b8246ab766591070cdd058f69fee452aefec/pythermodb-1.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 21:58:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pythermodb"
}
        
Elapsed time: 0.41953s