property-utils


Nameproperty-utils JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryUtilities for programming that involves physical properties
upload_time2024-09-20 11:55:40
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords physical properties properties
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![image](https://img.shields.io/pypi/v/property-utils.svg)](https://pypi.python.org/pypi/property-utils)
[![image](https://img.shields.io/pypi/l/property-utils.svg)](https://opensource.org/license/mit/)
[![image](https://img.shields.io/pypi/pyversions/property-utils.svg)](https://pypi.python.org/pypi/property-utils)
[![Actions status](https://github.com/Maxcode123/property-utils/actions/workflows/test-package.yml/badge.svg?branch=main)](https://github.com/Maxcode123/property-utils/actions/workflows/test-package.yml?query=branch%3Amain)


---
**Documentation:** https://maxcode123.github.io/property-utils/  
**Source code:** https://github.com/Maxcode123/property-utils  
**PyPI:** https://pypi.org/project/property-utils/  

---

# property-utils
*Utilities for programming that involves physical properties*

## What is property-utils?
property-utils is a python library that aims at making programming with physical properties easier. It was created to be used by scientists and engineers with little programming experience.

***What is provided by property-utils?***

### Unit arithmetics
You can divide and multiply units to create new units. For example you can create velocity units by dividing length units with time units.

### Unit conversions
You can easily convert a property from one unit to another by calling a method.

### Property arithmetics
You can add, subtract, divide and multiply properties to create new properties. For example, you can create a density property by dividing a mass property with a volume property.

## Installation
```
pip install property-utils
```

## Quick usage

A simple example:

```py
import math

from property_utils.properties import p
from property_utils.units import (
    BTU,
    FOOT,
    RANKINE,
    HOUR,
    CENTI_METER,
    METER,
    KELVIN,
    KILO_WATT,
)

tube_radius = p(12, CENTI_METER)
tube_length = p(2.3, METER)
heat_exchange_area = 2 * math.pi * tube_length * tube_radius

heat_transfer_coeff = p(150, BTU / RANKINE / FOOT**2 / HOUR)

cold_in = p(273, KELVIN)
cold_out = p(300, KELVIN)
hot_in = p(520, KELVIN)
hot_out = p(472, KELVIN)
diff_in = hot_in - cold_in
diff_out = hot_out - cold_out
temperature_diff = (diff_in - diff_out) / math.log((diff_in / diff_out).value)

print("Heat transfer coefficient =", heat_transfer_coeff)
print("Heat exchange area =", heat_exchange_area)
print("Temperature difference =", temperature_diff)

heat_duty = heat_transfer_coeff * heat_exchange_area * temperature_diff

print("\nHeat duty =", heat_duty)
print("          =", heat_duty.to_si())
print("          =", heat_duty.to_unit(KILO_WATT))
```

Result:

```
Heat transfer coefficient = 150 Btu / (ft^2) / hr / °R
Heat exchange area = 1.7341591447815656 (m^2)
Logarithmic mean temperature difference = 207.24308513672648 K

Heat duty = 1044588.4611345044 Btu / hr
          = 306122.45180469507 J / s
          = 306.12245180469506 kW
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "property-utils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "physical properties, properties",
    "author": null,
    "author_email": "Maximos Nikiforakis <nikiforos@live.co.uk>",
    "download_url": "https://files.pythonhosted.org/packages/ea/e6/575a8f4397ae3830eb946b4b6d4db8dbca379a4858a811a00c8fff2fe5b2/property_utils-0.3.1.tar.gz",
    "platform": null,
    "description": "[![image](https://img.shields.io/pypi/v/property-utils.svg)](https://pypi.python.org/pypi/property-utils)\n[![image](https://img.shields.io/pypi/l/property-utils.svg)](https://opensource.org/license/mit/)\n[![image](https://img.shields.io/pypi/pyversions/property-utils.svg)](https://pypi.python.org/pypi/property-utils)\n[![Actions status](https://github.com/Maxcode123/property-utils/actions/workflows/test-package.yml/badge.svg?branch=main)](https://github.com/Maxcode123/property-utils/actions/workflows/test-package.yml?query=branch%3Amain)\n\n\n---\n**Documentation:** https://maxcode123.github.io/property-utils/  \n**Source code:** https://github.com/Maxcode123/property-utils  \n**PyPI:** https://pypi.org/project/property-utils/  \n\n---\n\n# property-utils\n*Utilities for programming that involves physical properties*\n\n## What is property-utils?\nproperty-utils is a python library that aims at making programming with physical properties easier. It was created to be used by scientists and engineers with little programming experience.\n\n***What is provided by property-utils?***\n\n### Unit arithmetics\nYou can divide and multiply units to create new units. For example you can create velocity units by dividing length units with time units.\n\n### Unit conversions\nYou can easily convert a property from one unit to another by calling a method.\n\n### Property arithmetics\nYou can add, subtract, divide and multiply properties to create new properties. For example, you can create a density property by dividing a mass property with a volume property.\n\n## Installation\n```\npip install property-utils\n```\n\n## Quick usage\n\nA simple example:\n\n```py\nimport math\n\nfrom property_utils.properties import p\nfrom property_utils.units import (\n    BTU,\n    FOOT,\n    RANKINE,\n    HOUR,\n    CENTI_METER,\n    METER,\n    KELVIN,\n    KILO_WATT,\n)\n\ntube_radius = p(12, CENTI_METER)\ntube_length = p(2.3, METER)\nheat_exchange_area = 2 * math.pi * tube_length * tube_radius\n\nheat_transfer_coeff = p(150, BTU / RANKINE / FOOT**2 / HOUR)\n\ncold_in = p(273, KELVIN)\ncold_out = p(300, KELVIN)\nhot_in = p(520, KELVIN)\nhot_out = p(472, KELVIN)\ndiff_in = hot_in - cold_in\ndiff_out = hot_out - cold_out\ntemperature_diff = (diff_in - diff_out) / math.log((diff_in / diff_out).value)\n\nprint(\"Heat transfer coefficient =\", heat_transfer_coeff)\nprint(\"Heat exchange area =\", heat_exchange_area)\nprint(\"Temperature difference =\", temperature_diff)\n\nheat_duty = heat_transfer_coeff * heat_exchange_area * temperature_diff\n\nprint(\"\\nHeat duty =\", heat_duty)\nprint(\"          =\", heat_duty.to_si())\nprint(\"          =\", heat_duty.to_unit(KILO_WATT))\n```\n\nResult:\n\n```\nHeat transfer coefficient = 150 Btu / (ft^2) / hr / \u00b0R\nHeat exchange area = 1.7341591447815656 (m^2)\nLogarithmic mean temperature difference = 207.24308513672648 K\n\nHeat duty = 1044588.4611345044 Btu / hr\n          = 306122.45180469507 J / s\n          = 306.12245180469506 kW\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Utilities for programming that involves physical properties",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/Maxcode123/property-utils",
        "Issues": "https://github.com/Maxcode123/property-utils/issues"
    },
    "split_keywords": [
        "physical properties",
        " properties"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a99eaf6a00364767692f8c769785460b0b75e5d41fe7c9eb7730eb57625aaf14",
                "md5": "feaec7682e2f6064107137667a8cce26",
                "sha256": "779c5ed38bd23662fd81013b23ee3cab0caff989f539e5ea8e92fd737e581db0"
            },
            "downloads": -1,
            "filename": "property_utils-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "feaec7682e2f6064107137667a8cce26",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 31109,
            "upload_time": "2024-09-20T11:55:39",
            "upload_time_iso_8601": "2024-09-20T11:55:39.242674Z",
            "url": "https://files.pythonhosted.org/packages/a9/9e/af6a00364767692f8c769785460b0b75e5d41fe7c9eb7730eb57625aaf14/property_utils-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eae6575a8f4397ae3830eb946b4b6d4db8dbca379a4858a811a00c8fff2fe5b2",
                "md5": "7c5952d63cfc6a1deaa37e737dc6b22b",
                "sha256": "8bbeb8a55bcf9dac948361c54bf35bad153890ce38a6d6864c5f7908fd40d9bc"
            },
            "downloads": -1,
            "filename": "property_utils-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7c5952d63cfc6a1deaa37e737dc6b22b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 27181,
            "upload_time": "2024-09-20T11:55:40",
            "upload_time_iso_8601": "2024-09-20T11:55:40.564114Z",
            "url": "https://files.pythonhosted.org/packages/ea/e6/575a8f4397ae3830eb946b4b6d4db8dbca379a4858a811a00c8fff2fe5b2/property_utils-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-20 11:55:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Maxcode123",
    "github_project": "property-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "property-utils"
}
        
Elapsed time: 0.35220s