<h1 align="center" style="font-weight: bold;">Metricus</h1>
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![PyPi license](https://badgen.net/pypi/license/pip/)](https://pypi.org/project/pip/)
[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/Naereen/badges/)
<p align="center">
<a href="#started">Getting Started</a> •
<a href="#colab">Collaborators</a> •
<a href="#contribute">Contribute</a> •
<a href="#license">License</a> •
<a href="#preview">Preview</a>
</p>
<p align="center">
<b>This Python-based unit converter is a simple and efficient tool for converting measurements between various units, such as force, length, mass, and others, including complex operations like displacement. It features an intuitive graphical user interface built with Tkinter, allowing users to navigate and perform conversions easily. The converter returns precise results, formatted with or without the unit abbreviation for easy readability.
</b>
</p>
<h2 id="started">🚀 Getting started </h2>
```bash
pip install metricus
```
### Usage Example
```python
from Metricus.gui import MetricusGUI
from Metricus import temperature_converter
from Metricus.utilities import round_number, humanize_input, decomputarize_input, plot_temperature_variation
# ----------------------------
# Temperature Conversion Example
# ----------------------------
temp_celsius = 25
temp_rankine = temperature_converter(temp_celsius, 'celsius', 'rankine')
print(f"{temp_celsius} degrees Celsius equals {temp_rankine} Rankine")
# ----------------------------
# Time Conversion Examples
# ----------------------------
# Example 1: Basic usage
time_seconds = 3600
time_hours = time_converter(time_seconds, 'second', 'hour')
print(f"{time_seconds} seconds equals {time_hours} hours")
# Example 2: Using rounded_result
time_days = 365
time_year = time_converter(time_days, 'day', 'year', rounded_result=True)
print(f"{time_days} days equals {time_year} year")
# Example 3: Using humanized_input
time_years = 100
time_century = time_converter(time_years, 'year', 'century', humanized_input=True)
print(f"{time_years} years equals {time_century} century")
# ----------------------------
# Displacement Calculation Example
# ----------------------------
length_kilometers = 100
speed_kmh = 100
time_unit = 'minute'
result = calculate_displacement(length=length_kilometers, speed=speed_kmh, time_unit=time_unit)
print(f"Covering {length_kilometers} km at a speed of {speed_kmh} km/h takes {result} minutes.")
# ----------------------------
# Number Rounding Example
# ----------------------------
# Rounding a numeric result
time_days = 365
time_result = time_converter(time_days, 'day', 'year')
rounded_number = round_number(time_result)
print(f"The number {time_result} rounded is {rounded_number}")
# Rounding a string result
time_result_with_unit = time_converter(time_days, 'day', 'year', with_unit=True)
rounded_number_with_unit = round_number(time_result_with_unit)
print(f"The number {time_result_with_unit} rounded is {rounded_number_with_unit}")
# ----------------------------
# Humanizing and Decomputadorizing Input
# ----------------------------
from_acceleration = 'Meter per second squared'
to_acceleration = 'Foot per second squared'
# Humanizing input
acceleration_result = acceleration_converter(
100,
humanize_input(from_acceleration),
humanize_input(to_acceleration)
)
print(f"The conversion result from {from_acceleration} to {to_acceleration} is {acceleration_result}")
# Decomputadorizing input
decomputarized_from = decomputarize_input(humanize_input(from_acceleration))
decomputarized_to = decomputarize_input(humanize_input(to_acceleration))
print(f"The decomputarized input from '{humanize_input(from_acceleration)}' is '{decomputarized_from}'")
print(f"The decomputarized input to '{humanize_input(to_acceleration)}' is '{decomputarized_to}'")
# ----------------------------
# Temperature Variation Plotting Examples
# ----------------------------
# Daily temperatures for 30 days (based on the provided list)
temperatures = [
15.3, 16.1, 14.8, 13.5, 12.4, 11.8, 13.0, 15.5, 16.2, 14.9,
13.0, 12.5, 11.6, 13.4, 15.1, 11.0, 17.2, 18.5, 19.0, 18.3,
17.8, 16.4, 15.0, 14.2, 13.6, 12.7, 13.8, 14.5, 15.2, 16.0
]
# Example 1: Basic usage - Plot in Celsius with statistical info
plot_temperature_variation(
temperatures=temperatures,
temperature_unit='celsius'
)
# Example 2: Convert temperatures to Fahrenheit
plot_temperature_variation(
temperatures=temperatures,
temperature_unit='celsius',
convert_to='fahrenheit'
)
# Example 3: Disable statistical information
plot_temperature_variation(
temperatures=temperatures,
temperature_unit='celsius',
convert_to='fahrenheit',
with_info=False
)
# Example 4: Save the graph to a file
plot_temperature_variation(
temperatures=temperatures,
temperature_unit='celsius',
convert_to='fahrenheit',
save_path='temperature_variation.png'
)
# Example 5: Save graph in Kelvin with statistics
plot_temperature_variation(
temperatures=temperatures,
temperature_unit='celsius',
convert_to='kelvin',
save_path='temperature_variation_kelvin.pdf',
with_info=True
)
# ----------------------------
# Launching the Graphical Interface
# ----------------------------
MetricusGUI()
```
<h2 id="preview">🌟 Preview</h2>
Below is a preview of the Metricus graphical user interface (GUI):
<p align="center">Simple Conversions:</p>
<p align="center">
<img src="assets/metricus.gif" alt="Metricus GUI" width="60%">
</p>
<p align="center">Complex Conversions:</p>
<p align="center">
<img src="assets/metricus_complex.gif" alt="Metricus GUI" width="60%">
</p>
The GUI is built with Tkinter and provides an intuitive way to perform unit conversions quickly and accurately.
<h3>Prerequisites</h3>
- Python 3.8+
- Matplotlib
<h3>Cloning</h3>
```bash
git clone https://github.com/guifreschi/Metricus
```
<h3>Starting</h3>
Clone the repository
git clone https://github.com/guifreschi/Metricus
Navigate into the project directory
cd Metricus
Create a virtual environment
python -m venv venv
Activate the virtual environment
- On Windows
venv\Scripts\activate
- On Unix or MacOS
source venv/bin/activate
Install Metricus
pip install -e .
<h2 id="colab">🤝 Collaborators</h2>
This project is maintained and created by:
<table>
<tr>
<td align="center">
<a href="https://github.com/guifreschi">
<img src="https://avatars.githubusercontent.com/u/181294670?v=4" width="100px;" alt="Guilherme Freschi Profile Picture"/><br>
<sub>
<b>Guilherme Freschi</b>
</sub>
</a>
</td>
<td align="center">
<a href="https://github.com/YaronBuchler">
<img src="https://avatars.githubusercontent.com/u/185246229?v=4" width="100px;" alt="Yaron Buchler Profile Picture"/><br>
<sub>
<b>Yaron Buchler</b>
</sub>
</a>
</td>
</tr>
</table>
<h2 id="contribute">📫 Contribute</h2>
1. `git clone https://github.com/guifreschi/Metricus`
2. `git checkout -b feature/NAME`
3. Follow commit patterns
4. Open a Pull Request explaining the problem solved or feature made, if exists, append screenshot of visual modifications and wait for the review!
<h3>Documentations that might help</h3>
[📝 How to create a Pull Request](https://www.atlassian.com/br/git/tutorials/making-a-pull-request)
[💾 Commit pattern](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)
<h2 id="license">📝 License</h2>
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/guifreschi/Metricus",
"name": "metricus",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "conversion, units, temperature, weight, length, distance, energy, volume, mass, pressure, speed, time, metric, imperial, unit converter",
"author": "Guilherme Freschi, Yaron Buchler",
"author_email": "guilhermefreschix@gmail.com, buchleryaron@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cf/2b/b84597bb5292a7e8d1d02ce7ff38a5801c0578807e021287e3052bc095df/metricus-1.0.0.tar.gz",
"platform": null,
"description": "<h1 align=\"center\" style=\"font-weight: bold;\">Metricus</h1>\r\n\r\n[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)\r\n[![PyPi license](https://badgen.net/pypi/license/pip/)](https://pypi.org/project/pip/)\r\n[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/Naereen/badges/)\r\n\r\n<p align=\"center\">\r\n <a href=\"#started\">Getting Started</a> \u2022 \r\n <a href=\"#colab\">Collaborators</a> \u2022\r\n <a href=\"#contribute\">Contribute</a> \u2022\r\n <a href=\"#license\">License</a> \u2022\r\n <a href=\"#preview\">Preview</a>\r\n</p>\r\n\r\n<p align=\"center\">\r\n <b>This Python-based unit converter is a simple and efficient tool for converting measurements between various units, such as force, length, mass, and others, including complex operations like displacement. It features an intuitive graphical user interface built with Tkinter, allowing users to navigate and perform conversions easily. The converter returns precise results, formatted with or without the unit abbreviation for easy readability.\r\n </b>\r\n</p>\r\n\r\n<h2 id=\"started\">\ud83d\ude80 Getting started </h2>\r\n\r\n```bash\r\npip install metricus\r\n```\r\n\r\n### Usage Example\r\n```python\r\nfrom Metricus.gui import MetricusGUI\r\nfrom Metricus import temperature_converter\r\nfrom Metricus.utilities import round_number, humanize_input, decomputarize_input, plot_temperature_variation\r\n\r\n# ----------------------------\r\n# Temperature Conversion Example\r\n# ----------------------------\r\ntemp_celsius = 25\r\ntemp_rankine = temperature_converter(temp_celsius, 'celsius', 'rankine')\r\nprint(f\"{temp_celsius} degrees Celsius equals {temp_rankine} Rankine\")\r\n\r\n# ----------------------------\r\n# Time Conversion Examples\r\n# ----------------------------\r\n\r\n# Example 1: Basic usage\r\ntime_seconds = 3600\r\ntime_hours = time_converter(time_seconds, 'second', 'hour')\r\nprint(f\"{time_seconds} seconds equals {time_hours} hours\")\r\n\r\n# Example 2: Using rounded_result\r\ntime_days = 365\r\ntime_year = time_converter(time_days, 'day', 'year', rounded_result=True)\r\nprint(f\"{time_days} days equals {time_year} year\")\r\n\r\n# Example 3: Using humanized_input\r\ntime_years = 100\r\ntime_century = time_converter(time_years, 'year', 'century', humanized_input=True)\r\nprint(f\"{time_years} years equals {time_century} century\")\r\n\r\n# ----------------------------\r\n# Displacement Calculation Example\r\n# ----------------------------\r\nlength_kilometers = 100\r\nspeed_kmh = 100\r\ntime_unit = 'minute'\r\nresult = calculate_displacement(length=length_kilometers, speed=speed_kmh, time_unit=time_unit)\r\nprint(f\"Covering {length_kilometers} km at a speed of {speed_kmh} km/h takes {result} minutes.\")\r\n\r\n# ----------------------------\r\n# Number Rounding Example\r\n# ----------------------------\r\n# Rounding a numeric result\r\ntime_days = 365\r\ntime_result = time_converter(time_days, 'day', 'year')\r\nrounded_number = round_number(time_result)\r\nprint(f\"The number {time_result} rounded is {rounded_number}\")\r\n\r\n# Rounding a string result\r\ntime_result_with_unit = time_converter(time_days, 'day', 'year', with_unit=True)\r\nrounded_number_with_unit = round_number(time_result_with_unit)\r\nprint(f\"The number {time_result_with_unit} rounded is {rounded_number_with_unit}\")\r\n\r\n# ----------------------------\r\n# Humanizing and Decomputadorizing Input\r\n# ----------------------------\r\nfrom_acceleration = 'Meter per second squared'\r\nto_acceleration = 'Foot per second squared'\r\n\r\n# Humanizing input\r\nacceleration_result = acceleration_converter(\r\n 100,\r\n humanize_input(from_acceleration),\r\n humanize_input(to_acceleration)\r\n)\r\nprint(f\"The conversion result from {from_acceleration} to {to_acceleration} is {acceleration_result}\")\r\n\r\n# Decomputadorizing input\r\ndecomputarized_from = decomputarize_input(humanize_input(from_acceleration))\r\ndecomputarized_to = decomputarize_input(humanize_input(to_acceleration))\r\nprint(f\"The decomputarized input from '{humanize_input(from_acceleration)}' is '{decomputarized_from}'\")\r\nprint(f\"The decomputarized input to '{humanize_input(to_acceleration)}' is '{decomputarized_to}'\")\r\n\r\n# ----------------------------\r\n# Temperature Variation Plotting Examples\r\n# ----------------------------\r\n# Daily temperatures for 30 days (based on the provided list)\r\ntemperatures = [\r\n 15.3, 16.1, 14.8, 13.5, 12.4, 11.8, 13.0, 15.5, 16.2, 14.9,\r\n 13.0, 12.5, 11.6, 13.4, 15.1, 11.0, 17.2, 18.5, 19.0, 18.3,\r\n 17.8, 16.4, 15.0, 14.2, 13.6, 12.7, 13.8, 14.5, 15.2, 16.0\r\n]\r\n\r\n# Example 1: Basic usage - Plot in Celsius with statistical info\r\nplot_temperature_variation(\r\n temperatures=temperatures,\r\n temperature_unit='celsius'\r\n)\r\n\r\n# Example 2: Convert temperatures to Fahrenheit\r\nplot_temperature_variation(\r\n temperatures=temperatures,\r\n temperature_unit='celsius',\r\n convert_to='fahrenheit'\r\n)\r\n\r\n# Example 3: Disable statistical information\r\nplot_temperature_variation(\r\n temperatures=temperatures,\r\n temperature_unit='celsius',\r\n convert_to='fahrenheit',\r\n with_info=False\r\n)\r\n\r\n# Example 4: Save the graph to a file\r\nplot_temperature_variation(\r\n temperatures=temperatures,\r\n temperature_unit='celsius',\r\n convert_to='fahrenheit',\r\n save_path='temperature_variation.png'\r\n)\r\n\r\n# Example 5: Save graph in Kelvin with statistics\r\nplot_temperature_variation(\r\n temperatures=temperatures,\r\n temperature_unit='celsius',\r\n convert_to='kelvin',\r\n save_path='temperature_variation_kelvin.pdf',\r\n with_info=True\r\n)\r\n\r\n# ----------------------------\r\n# Launching the Graphical Interface\r\n# ----------------------------\r\nMetricusGUI()\r\n```\r\n\r\n<h2 id=\"preview\">\ud83c\udf1f Preview</h2>\r\n\r\nBelow is a preview of the Metricus graphical user interface (GUI):\r\n<p align=\"center\">Simple Conversions:</p>\r\n<p align=\"center\">\r\n <img src=\"assets/metricus.gif\" alt=\"Metricus GUI\" width=\"60%\">\r\n</p>\r\n<p align=\"center\">Complex Conversions:</p>\r\n<p align=\"center\">\r\n <img src=\"assets/metricus_complex.gif\" alt=\"Metricus GUI\" width=\"60%\">\r\n</p>\r\n\r\nThe GUI is built with Tkinter and provides an intuitive way to perform unit conversions quickly and accurately.\r\n\r\n<h3>Prerequisites</h3>\r\n\r\n- Python 3.8+\r\n- Matplotlib\r\n\r\n<h3>Cloning</h3>\r\n\r\n```bash\r\ngit clone https://github.com/guifreschi/Metricus\r\n```\r\n\r\n<h3>Starting</h3>\r\n\r\nClone the repository\r\ngit clone https://github.com/guifreschi/Metricus\r\n\r\nNavigate into the project directory\r\ncd Metricus\r\n\r\nCreate a virtual environment\r\npython -m venv venv\r\n\r\nActivate the virtual environment\r\n- On Windows\r\nvenv\\Scripts\\activate\r\n- On Unix or MacOS\r\nsource venv/bin/activate\r\n\r\nInstall Metricus\r\npip install -e .\r\n\r\n<h2 id=\"colab\">\ud83e\udd1d Collaborators</h2>\r\n\r\nThis project is maintained and created by:\r\n\r\n<table>\r\n <tr>\r\n <td align=\"center\">\r\n <a href=\"https://github.com/guifreschi\">\r\n <img src=\"https://avatars.githubusercontent.com/u/181294670?v=4\" width=\"100px;\" alt=\"Guilherme Freschi Profile Picture\"/><br>\r\n <sub>\r\n <b>Guilherme Freschi</b>\r\n </sub>\r\n </a>\r\n </td>\r\n <td align=\"center\">\r\n <a href=\"https://github.com/YaronBuchler\">\r\n <img src=\"https://avatars.githubusercontent.com/u/185246229?v=4\" width=\"100px;\" alt=\"Yaron Buchler Profile Picture\"/><br>\r\n <sub>\r\n <b>Yaron Buchler</b>\r\n </sub>\r\n </a>\r\n </td>\r\n </tr>\r\n</table>\r\n\r\n<h2 id=\"contribute\">\ud83d\udceb Contribute</h2>\r\n\r\n1. `git clone https://github.com/guifreschi/Metricus`\r\n2. `git checkout -b feature/NAME`\r\n3. Follow commit patterns\r\n4. Open a Pull Request explaining the problem solved or feature made, if exists, append screenshot of visual modifications and wait for the review!\r\n\r\n<h3>Documentations that might help</h3>\r\n\r\n[\ud83d\udcdd How to create a Pull Request](https://www.atlassian.com/br/git/tutorials/making-a-pull-request)\r\n\r\n[\ud83d\udcbe Commit pattern](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)\r\n\r\n<h2 id=\"license\">\ud83d\udcdd License</h2>\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python unit converter with a Tkinter interface for easy and precise conversions across various measurements such as force, length, and mass",
"version": "1.0.0",
"project_urls": {
"Guilherme Freschi's GitHub": "https://github.com/guifreschi",
"Homepage": "https://github.com/guifreschi/Metricus",
"Project on GitHub": "https://github.com/guifreschi/Metricus",
"Yaron Buchler's GitHub": "https://github.com/YaronBuchler"
},
"split_keywords": [
"conversion",
" units",
" temperature",
" weight",
" length",
" distance",
" energy",
" volume",
" mass",
" pressure",
" speed",
" time",
" metric",
" imperial",
" unit converter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "030926bc13eab87790f1efd8282e253435d2ffb64bc6deb85ff7434b75ca43e3",
"md5": "aefa0354b0c992696b6ac3f9689bf525",
"sha256": "bd33553ddc86dece7e7c47748803464a88963c99b5493f84c677ff99138dbce6"
},
"downloads": -1,
"filename": "metricus-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aefa0354b0c992696b6ac3f9689bf525",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 108784,
"upload_time": "2024-12-11T18:38:26",
"upload_time_iso_8601": "2024-12-11T18:38:26.041476Z",
"url": "https://files.pythonhosted.org/packages/03/09/26bc13eab87790f1efd8282e253435d2ffb64bc6deb85ff7434b75ca43e3/metricus-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cf2bb84597bb5292a7e8d1d02ce7ff38a5801c0578807e021287e3052bc095df",
"md5": "540ad6c774ff43e2ea8673a22030e107",
"sha256": "360950335d8cc9142486e9dd8e0c78541bd630149dac7410b66bf312b22c63b3"
},
"downloads": -1,
"filename": "metricus-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "540ad6c774ff43e2ea8673a22030e107",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 48660,
"upload_time": "2024-12-11T18:38:29",
"upload_time_iso_8601": "2024-12-11T18:38:29.057297Z",
"url": "https://files.pythonhosted.org/packages/cf/2b/b84597bb5292a7e8d1d02ce7ff38a5801c0578807e021287e3052bc095df/metricus-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 18:38:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "guifreschi",
"github_project": "Metricus",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "matplotlib",
"specs": [
[
"==",
"3.9.3"
]
]
}
],
"lcname": "metricus"
}