Name | simatrix JSON |
Version |
0.0.3
JSON |
| download |
home_page | None |
Summary | A simple way to generate matrix in Python |
upload_time | 2024-10-26 18:13:55 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License Copyright (c) 2024 Piotr Daniel 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 |
matrix
matrice
multidimensional
list
generator
list generator
matrix generator
simatrix
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Simatrix
- - -
## A simple way to generate matrix in Python.
This module provides a simple way to generate a matrix (multidimensional list).
Its shape is similar in design to a cube or numpy ndarray model, with the values
of either integers or floats. The module is based on python's built-in list
and therefore all the list methods are applicable, as well as a few
custom ones, designed for the module.
Some of the common uses are:
- 3D positioning
- Serialised data collection
- An inventory
- - -
## Quick Start
Install the package from pip
```
pip install simatrix
```
Import the matrix module
```
import simatrix.matrix as sim
```
Create your first matrix. Example below has 3 dimensions with 4 rows and 5 columns in each,
and the value of 1 filled in every cell.
```
my_matrix = sim.Matrix(3, 4, 5, 1)
```
The matrix can be navigated through using all three dimensions - `my_matrix[0][0][0]`,
and is zero indexed like a standard python list.
- - -
## Methods
- `my_matrix.inspect()` - Prints the size of the matrix
- `my_matrix.display()` - Prints each dimension and its content
- `my_matrix.zero()` - Replaces all the values with zeros
- `my_matrix.set_values()` - Replaces all the values with a given integer or float
- - -
## Example
Code:
``` python
# Daily temperature log
import simatrix.matrix as sim
from datetime import datetime as dt
# Get current date information and turn into an index
today = dt.today()
month_id = today.month-1
day_id = today.day-1
hour_id = today.hour-1
# Create matrix with a dimension for each month of the year, row for every day of the month and column for each hour
temperatures = sim.Matrix(12, 31, 24)
# Inspect the size
temperatures.inspect()
# Get current temperature reading in Celsius (hardoced value for the example purposes)
current_temp = 28
# Set the temperature value into. In real life you'd have an hourly reading mechanism instead
temperatures[month_id][day_id][hour_id] = current_temp
# Display current month's data
temperatures.display(month_id)
```
Output:
```
Matrix objected has been created
--------------
Dimensions: 12
Rows: 31
Columns: 24
Total number of cells: 8928
--------------
[0, 0, 0, 0, 0, ... 0, 0, 0, 0, 0]
...
[0, 0, 0, 0, 0, ... 0, 0, 0, 28, 0]
...
[0, 0, 0, 0, 0, ... 0, 0, 0, 0, 0]
```
- - -
## License
MIT License. Free to use in all projects. Any credit to my git account would be great and please consider giving this project a star :)
Raw data
{
"_id": null,
"home_page": null,
"name": "simatrix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "matrix, matrice, multidimensional, list, generator, list generator, matrix generator, simatrix",
"author": null,
"author_email": "Piotr Daniel <piotr.daniel4@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/64/2b/cd4d20618ab001d7246031db2d849aca0a64bb57055f60a6003979db5874/simatrix-0.0.3.tar.gz",
"platform": null,
"description": "# Simatrix\r\n- - -\r\n\r\n## A simple way to generate matrix in Python.\r\nThis module provides a simple way to generate a matrix (multidimensional list).\r\nIts shape is similar in design to a cube or numpy ndarray model, with the values\r\nof either integers or floats. The module is based on python's built-in list\r\nand therefore all the list methods are applicable, as well as a few\r\ncustom ones, designed for the module.\r\n\r\nSome of the common uses are:\r\n- 3D positioning\r\n- Serialised data collection\r\n- An inventory\r\n- - -\r\n\r\n## Quick Start\r\nInstall the package from pip\r\n```\r\npip install simatrix\r\n```\r\n\r\nImport the matrix module\r\n```\r\nimport simatrix.matrix as sim\r\n```\r\nCreate your first matrix. Example below has 3 dimensions with 4 rows and 5 columns in each,\r\nand the value of 1 filled in every cell.\r\n```\r\nmy_matrix = sim.Matrix(3, 4, 5, 1)\r\n```\r\nThe matrix can be navigated through using all three dimensions - `my_matrix[0][0][0]`,\r\nand is zero indexed like a standard python list.\r\n- - -\r\n\r\n## Methods\r\n- `my_matrix.inspect()` - Prints the size of the matrix\r\n- `my_matrix.display()` - Prints each dimension and its content\r\n- `my_matrix.zero()` - Replaces all the values with zeros\r\n- `my_matrix.set_values()` - Replaces all the values with a given integer or float\r\n\r\n- - -\r\n## Example\r\nCode:\r\n``` python\r\n# Daily temperature log\r\n\r\nimport simatrix.matrix as sim\r\nfrom datetime import datetime as dt\r\n\r\n\r\n# Get current date information and turn into an index\r\ntoday = dt.today()\r\nmonth_id = today.month-1\r\nday_id = today.day-1\r\nhour_id = today.hour-1\r\n\r\n# Create matrix with a dimension for each month of the year, row for every day of the month and column for each hour\r\ntemperatures = sim.Matrix(12, 31, 24)\r\n\r\n# Inspect the size\r\ntemperatures.inspect()\r\n\r\n# Get current temperature reading in Celsius (hardoced value for the example purposes)\r\ncurrent_temp = 28\r\n\r\n# Set the temperature value into. In real life you'd have an hourly reading mechanism instead \r\ntemperatures[month_id][day_id][hour_id] = current_temp\r\n\r\n# Display current month's data\r\ntemperatures.display(month_id)\r\n```\r\nOutput:\r\n```\r\nMatrix objected has been created\r\n--------------\r\nDimensions: 12 \r\nRows: 31 \r\nColumns: 24\r\nTotal number of cells: 8928\r\n--------------\r\n\r\n[0, 0, 0, 0, 0, ... 0, 0, 0, 0, 0]\r\n...\r\n[0, 0, 0, 0, 0, ... 0, 0, 0, 28, 0]\r\n...\r\n[0, 0, 0, 0, 0, ... 0, 0, 0, 0, 0]\r\n\r\n```\r\n\r\n- - -\r\n## License\r\nMIT License. Free to use in all projects. Any credit to my git account would be great and please consider giving this project a star :)\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Piotr Daniel 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": "A simple way to generate matrix in Python",
"version": "0.0.3",
"project_urls": {
"Issues": "https://github.com/pino888/simatrix/issues",
"Repository": "https://github.com/pino888/simatrix"
},
"split_keywords": [
"matrix",
" matrice",
" multidimensional",
" list",
" generator",
" list generator",
" matrix generator",
" simatrix"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6ec3bc4af5292f6883cbbf4ee136770b31f71a2fc182febf5586ea506248e3a4",
"md5": "5a2559ac24e2dd59de9e2615ce4c93d5",
"sha256": "fa87454d6150d4350865d512e69d31cfc7eccea0dc764e0cc0f74adffd6dd767"
},
"downloads": -1,
"filename": "simatrix-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5a2559ac24e2dd59de9e2615ce4c93d5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5364,
"upload_time": "2024-10-26T18:13:53",
"upload_time_iso_8601": "2024-10-26T18:13:53.727975Z",
"url": "https://files.pythonhosted.org/packages/6e/c3/bc4af5292f6883cbbf4ee136770b31f71a2fc182febf5586ea506248e3a4/simatrix-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "642bcd4d20618ab001d7246031db2d849aca0a64bb57055f60a6003979db5874",
"md5": "e268475457a5c75c73e5a2c5a2dab4cf",
"sha256": "053d96977a66ac3ebef09dc2d3763481f6670059ff05379c50b8100e886d2261"
},
"downloads": -1,
"filename": "simatrix-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "e268475457a5c75c73e5a2c5a2dab4cf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4716,
"upload_time": "2024-10-26T18:13:55",
"upload_time_iso_8601": "2024-10-26T18:13:55.047022Z",
"url": "https://files.pythonhosted.org/packages/64/2b/cd4d20618ab001d7246031db2d849aca0a64bb57055f60a6003979db5874/simatrix-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 18:13:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pino888",
"github_project": "simatrix",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "simatrix"
}