property-utils


Nameproperty-utils JSON
Version 0.2.3 PyPI version JSON
download
home_pageNone
SummaryUtilities for programming that involves physical properties
upload_time2024-04-23 06:53:12
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/16/98/aeeab4895e58f078159a91848f2ed92699dd4d42a921f515c14e5deea3fc/property_utils-0.2.3.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.2.3",
    "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": "d091fa653d2863bf75b5ad4a04081da1e07531addeb5c9f3b382e7c7482f4980",
                "md5": "b737400e4dd0bd38464b634137dc96bd",
                "sha256": "5c9a0fb9e66f5806c17fb9db5fe61e413c7d91a05ab86c271539eb3b8829b712"
            },
            "downloads": -1,
            "filename": "property_utils-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b737400e4dd0bd38464b634137dc96bd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 30590,
            "upload_time": "2024-04-23T06:53:09",
            "upload_time_iso_8601": "2024-04-23T06:53:09.226774Z",
            "url": "https://files.pythonhosted.org/packages/d0/91/fa653d2863bf75b5ad4a04081da1e07531addeb5c9f3b382e7c7482f4980/property_utils-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1698aeeab4895e58f078159a91848f2ed92699dd4d42a921f515c14e5deea3fc",
                "md5": "c09f51b1c81dc0800d8db3329c5ca43f",
                "sha256": "bddcd19a34264e2ecc0e7e97609c90a5ace4f7e23c3ee607585e85bc4c97105a"
            },
            "downloads": -1,
            "filename": "property_utils-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c09f51b1c81dc0800d8db3329c5ca43f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 26890,
            "upload_time": "2024-04-23T06:53:12",
            "upload_time_iso_8601": "2024-04-23T06:53:12.092593Z",
            "url": "https://files.pythonhosted.org/packages/16/98/aeeab4895e58f078159a91848f2ed92699dd4d42a921f515c14e5deea3fc/property_utils-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-23 06:53:12",
    "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.23349s