Name | DiaModality JSON |
Version |
0.1.6
JSON |
| download |
home_page | None |
Summary | Tool to plot modality vector diagrams |
upload_time | 2024-11-04 09:29:48 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License Copyright (c) 2024 konung-yaropolk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
visualization
plotting
matplotlib
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# DiaModality - The Modality Diagram
Simple tool to plot vector modality diagram
[![pypi_version](https://img.shields.io/pypi/v/diamodality?label=PyPI&color=green)](https://pypi.org/project/diamodality)
[![PyPI - License](https://img.shields.io/pypi/l/diamodality)](https://pypi.org/project/diamodality)
[![Python](https://img.shields.io/badge/Python-v3.10%5E-green?logo=python)](https://pypi.org/project/diamodality)
### To install package run the command:
```bash
pip install diamodality
```
### Example of use:
See the /demo directory on Git repo or
create and run the following two files:
*(file names don't matter)*
---
``generate_sample_data.py``:
```python
import csv
import random
import os
num_rows = 1500
output_file = 'modality_data.csv'
# locate working directory
script_dir = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(script_dir, output_file)
# Open a new CSV file to write the data
with open(file_path, mode='w', newline='') as file:
writer = csv.writer(file)
# Generate the data
signal_treshold = 1.5
for _ in range(num_rows):
# generate data columns:
col1 = random.uniform(0, 2.7)
col2 = random.uniform(0, 3.3)
col3 = random.uniform(0, 7.3)
# generate binarization columns:
col4 = 1 if col1 > signal_treshold else ''
col5 = 1 if col2 > signal_treshold else ''
col6 = 1 if col3 > signal_treshold else ''
writer.writerow([col1, col2, col3, col4, col5, col6])
```
---
``plot_sample_data.py``:
```python
import DiaModality.CsvParser as csv
import DiaModality.ModalityPlot as plt
import os
# input files:
files = ['modality_data.csv']
# Get full path
script_dir = os.path.dirname(os.path.realpath(__file__))
for file in files:
# Get full path of input files
file_path = os.path.join(script_dir, file)
# Parse data from csv file
new_csv = csv.LoadCsv(file_path)
data, binarization = new_csv.ParseCsv(3, 3)
# Make figure:
plot = plt.ModalityPlot(
data,
binarization,
modalities=['Set 1', 'Set 2', 'Set 3'],
angles=[210, 90, 330],
labels=False,
scalecircle=0.5, # Scale circle radius
scalecircle_linestyle=':',
scalecircle_linewidth=0.75,
marker='', # vector endpoints marker
linestyle='-',
linewidth=0.5,
alpha=0.5,
same_scale=False, # Draw all the subplots in the same scale
full_center=True, # Draw all vectors in the central subplot,
# else draw trimodal vectors only
whole_sum=True, # Calculate all three modality vectors despite binarization
figsize=(10, 10),
title='Modality Diagram Example',
colors=(
'tab:green', # Set 1 color
'navy', # Set 2 color
'tab:red', # Set 3 color
'#1E88E5', # Sets 1 & 2 intersection color
'#FF9933', # Sets 1 & 3 intersection color
'#9900FF', # Sets 2 & 3 intersection color
'black', # All sets intersection color
),
)
plot.save(file_path, type='png', transparent=False)
plot.show()
```
Source page:
https://github.com/konung-yaropolk/DiaModality
![modality_data csv](https://github.com/user-attachments/assets/eb77b4d7-281f-45b0-a5ce-4c2442fc9a75)
Raw data
{
"_id": null,
"home_page": null,
"name": "DiaModality",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "Visualization, Plotting, Matplotlib",
"author": null,
"author_email": "konung-yaropolk <yaropolk1995@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/b5/d7/a0faf0746f82bde47a7734639238e744fe81501aeb04bbde584765b93a20/diamodality-0.1.6.tar.gz",
"platform": null,
"description": "# DiaModality - The Modality Diagram\n\nSimple tool to plot vector modality diagram \n\n[![pypi_version](https://img.shields.io/pypi/v/diamodality?label=PyPI&color=green)](https://pypi.org/project/diamodality)\n[![PyPI - License](https://img.shields.io/pypi/l/diamodality)](https://pypi.org/project/diamodality)\n[![Python](https://img.shields.io/badge/Python-v3.10%5E-green?logo=python)](https://pypi.org/project/diamodality) \n\n\n### To install package run the command:\n```bash\npip install diamodality\n```\n\n\n### Example of use:\nSee the /demo directory on Git repo or \ncreate and run the following two files: \n*(file names don't matter)*\n\n---\n``generate_sample_data.py``:\n```python\nimport csv\nimport random\nimport os\n\nnum_rows = 1500\noutput_file = 'modality_data.csv'\n\n# locate working directory\nscript_dir = os.path.dirname(os.path.realpath(__file__))\nfile_path = os.path.join(script_dir, output_file)\n\n# Open a new CSV file to write the data\nwith open(file_path, mode='w', newline='') as file:\n writer = csv.writer(file)\n\n # Generate the data\n signal_treshold = 1.5\n for _ in range(num_rows):\n\n # generate data columns:\n col1 = random.uniform(0, 2.7)\n col2 = random.uniform(0, 3.3)\n col3 = random.uniform(0, 7.3)\n\n # generate binarization columns:\n col4 = 1 if col1 > signal_treshold else ''\n col5 = 1 if col2 > signal_treshold else ''\n col6 = 1 if col3 > signal_treshold else ''\n\n writer.writerow([col1, col2, col3, col4, col5, col6])\n\n```\n\n\n---\n``plot_sample_data.py``:\n```python\nimport DiaModality.CsvParser as csv\nimport DiaModality.ModalityPlot as plt\nimport os\n\n# input files:\nfiles = ['modality_data.csv']\n\n# Get full path\nscript_dir = os.path.dirname(os.path.realpath(__file__))\n\nfor file in files:\n\n # Get full path of input files\n file_path = os.path.join(script_dir, file)\n\n # Parse data from csv file\n new_csv = csv.LoadCsv(file_path)\n data, binarization = new_csv.ParseCsv(3, 3)\n\n # Make figure:\n plot = plt.ModalityPlot(\n data,\n binarization,\n modalities=['Set 1', 'Set 2', 'Set 3'],\n angles=[210, 90, 330],\n labels=False,\n scalecircle=0.5, # Scale circle radius\n scalecircle_linestyle=':',\n scalecircle_linewidth=0.75,\n marker='', # vector endpoints marker\n linestyle='-',\n linewidth=0.5,\n alpha=0.5,\n same_scale=False, # Draw all the subplots in the same scale\n full_center=True, # Draw all vectors in the central subplot,\n # else draw trimodal vectors only\n whole_sum=True, # Calculate all three modality vectors despite binarization\n figsize=(10, 10),\n title='Modality Diagram Example',\n colors=(\n 'tab:green', # Set 1 color\n 'navy', # Set 2 color\n 'tab:red', # Set 3 color\n '#1E88E5', # Sets 1 & 2 intersection color\n '#FF9933', # Sets 1 & 3 intersection color\n '#9900FF', # Sets 2 & 3 intersection color\n 'black', # All sets intersection color\n ), \n )\n\n plot.save(file_path, type='png', transparent=False)\n plot.show()\n```\n\nSource page: \nhttps://github.com/konung-yaropolk/DiaModality\n\n\n![modality_data csv](https://github.com/user-attachments/assets/eb77b4d7-281f-45b0-a5ce-4c2442fc9a75)\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 konung-yaropolk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Tool to plot modality vector diagrams",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/konung-yaropolk/DiaModality",
"Issues": "https://github.com/konung-yaropolk/DiaModality/issues"
},
"split_keywords": [
"visualization",
" plotting",
" matplotlib"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9b22499dcb8d83d02ad95ee99941cf96d9bd7ec0eb36a79f14ffd0f7e964deed",
"md5": "83f8faaccb6a605f924ae62c695a39bc",
"sha256": "e79fc1bc9f493bee479fc9954c1de98926e16c95f4d72ee3c760639d119a23a5"
},
"downloads": -1,
"filename": "DiaModality-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "83f8faaccb6a605f924ae62c695a39bc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 9161,
"upload_time": "2024-11-04T09:29:48",
"upload_time_iso_8601": "2024-11-04T09:29:48.032456Z",
"url": "https://files.pythonhosted.org/packages/9b/22/499dcb8d83d02ad95ee99941cf96d9bd7ec0eb36a79f14ffd0f7e964deed/DiaModality-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b5d7a0faf0746f82bde47a7734639238e744fe81501aeb04bbde584765b93a20",
"md5": "305986a9250875a6631067f8ec91e301",
"sha256": "2359af3c0de814634c0d6ed2478122c5da2f5e8f290832524beadb79c092ab18"
},
"downloads": -1,
"filename": "diamodality-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "305986a9250875a6631067f8ec91e301",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9704,
"upload_time": "2024-11-04T09:29:48",
"upload_time_iso_8601": "2024-11-04T09:29:48.953774Z",
"url": "https://files.pythonhosted.org/packages/b5/d7/a0faf0746f82bde47a7734639238e744fe81501aeb04bbde584765b93a20/diamodality-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-04 09:29:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "konung-yaropolk",
"github_project": "DiaModality",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "diamodality"
}