Name | imodmodel JSON |
Version |
0.0.14
JSON |
| download |
home_page | None |
Summary | IMOD model files as pandas DataFrames in Python. |
upload_time | 2024-12-06 01:16:02 |
maintainer | None |
docs_url | None |
author | Alister Burt |
requires_python | >=3.8 |
license | BSD 3-Clause License |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# imodmodel
[![License](https://img.shields.io/pypi/l/imodmodel.svg?color=green)](https://github.com/alisterburt/imodmodel/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/imodmodel.svg?color=green)](https://pypi.org/project/imodmodel)
[![Python Version](https://img.shields.io/pypi/pyversions/imodmodel.svg?color=green)](https://python.org)
[![CI](https://github.com/alisterburt/imodmodel/actions/workflows/test_and_deploy.yml/badge.svg)](https://github.com/alisterburt/imodmodel/actions/workflows/test_and_deploy.yml)
Read [IMOD model files](https://bio3d.colorado.edu/imod/doc/binspec.html)
as [pandas dataframes](https://pandas.pydata.org/)
in Python.
## Usage
### As pandas DataFrame
```python
import imodmodel
df = imodmodel.read('my_model_file.mod')
```
```ipython
In [3]: df.head()
Out[3]:
object_id contour_id x y z
0 0 0 64.333336 64.666664 80.0
1 0 0 47.000000 77.333336 80.0
2 0 0 51.333332 45.666668 80.0
3 0 0 87.333336 49.666668 80.0
4 0 0 76.000000 82.000000 80.0
```
### As ImodModel object
```python
from imodmodel import ImodModel
model = ImodModel.from_file("my_model_file.mod")
```
```ipython
In [3]: model.objects[0].contours[0].points
Out[3]:
array([[ 6.875, 62.875, 124. ], ...])
In [4]: model.objects[0].meshes[0].vertices
Out[4]:
array([[ 6.87500000e+00, 6.28750000e+01, 1.24000000e+02], ...])
In [5]: model.objects[0].meshes[0].indices
Out[5]:
array([[156, 18, 152], ...])
In [6]: model.objects[0].meshes[0].face_values
Out[6]:
array([0., 0., 35.22094345, ...])
```
That's it!
## Installation
`imodmodel` can be installed from the [Python Package Index](https://pypi.org/) (PyPI)
```shell
pip install imodmodel
```
We recommend installing into a clean virtual environment.
Raw data
{
"_id": null,
"home_page": null,
"name": "imodmodel",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Alister Burt",
"author_email": "alisterburt@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/42/56/92b83719d850ecfd0fd230c98ccce2de88597d883cc00cb8ac1fed46c538/imodmodel-0.0.14.tar.gz",
"platform": null,
"description": "# imodmodel\n\n[![License](https://img.shields.io/pypi/l/imodmodel.svg?color=green)](https://github.com/alisterburt/imodmodel/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/imodmodel.svg?color=green)](https://pypi.org/project/imodmodel)\n[![Python Version](https://img.shields.io/pypi/pyversions/imodmodel.svg?color=green)](https://python.org)\n[![CI](https://github.com/alisterburt/imodmodel/actions/workflows/test_and_deploy.yml/badge.svg)](https://github.com/alisterburt/imodmodel/actions/workflows/test_and_deploy.yml)\n\nRead [IMOD model files](https://bio3d.colorado.edu/imod/doc/binspec.html) \nas [pandas dataframes](https://pandas.pydata.org/) \nin Python.\n\n\n## Usage\n\n### As pandas DataFrame\n\n```python\nimport imodmodel\n\ndf = imodmodel.read('my_model_file.mod')\n```\n\n```ipython\nIn [3]: df.head()\nOut[3]: \n object_id contour_id x y z\n0 0 0 64.333336 64.666664 80.0\n1 0 0 47.000000 77.333336 80.0\n2 0 0 51.333332 45.666668 80.0\n3 0 0 87.333336 49.666668 80.0\n4 0 0 76.000000 82.000000 80.0\n\n\n```\n\n### As ImodModel object\n\n```python\nfrom imodmodel import ImodModel\nmodel = ImodModel.from_file(\"my_model_file.mod\")\n```\n\n```ipython\nIn [3]: model.objects[0].contours[0].points\nOut[3]: \narray([[ 6.875, 62.875, 124. ], ...])\n\nIn [4]: model.objects[0].meshes[0].vertices\nOut[4]: \narray([[ 6.87500000e+00, 6.28750000e+01, 1.24000000e+02], ...])\n\nIn [5]: model.objects[0].meshes[0].indices\nOut[5]: \narray([[156, 18, 152], ...])\n\nIn [6]: model.objects[0].meshes[0].face_values\nOut[6]: \narray([0., 0., 35.22094345, ...])\n```\n\nThat's it!\n\n## Installation\n`imodmodel` can be installed from the [Python Package Index](https://pypi.org/) (PyPI)\n\n```shell\npip install imodmodel\n```\n\nWe recommend installing into a clean virtual environment.\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "IMOD model files as pandas DataFrames in Python.",
"version": "0.0.14",
"project_urls": {
"homepage": "https://github.com/teamtomo/imodmodel",
"repository": "https://github.com/teamtomo/imodmodel"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "349fa25c317d6c36a1b78231cfbce979880215155d033c7427e76c4979c4cbad",
"md5": "9142d8aa8f89ba1f21d0d6ecf446f8e2",
"sha256": "bcf70b81c65bc25909fc3580bab81ab2ca784479cda0f26faf9ed2a59a446da3"
},
"downloads": -1,
"filename": "imodmodel-0.0.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9142d8aa8f89ba1f21d0d6ecf446f8e2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9254,
"upload_time": "2024-12-06T01:16:00",
"upload_time_iso_8601": "2024-12-06T01:16:00.266169Z",
"url": "https://files.pythonhosted.org/packages/34/9f/a25c317d6c36a1b78231cfbce979880215155d033c7427e76c4979c4cbad/imodmodel-0.0.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "425692b83719d850ecfd0fd230c98ccce2de88597d883cc00cb8ac1fed46c538",
"md5": "d4b76d31d65d989374d57922eb614c7f",
"sha256": "8d170802e708d9a4f49b2452fb0cbc8b92c5b21b8414c3ddcff5b9fb02eb6ffd"
},
"downloads": -1,
"filename": "imodmodel-0.0.14.tar.gz",
"has_sig": false,
"md5_digest": "d4b76d31d65d989374d57922eb614c7f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 235147,
"upload_time": "2024-12-06T01:16:02",
"upload_time_iso_8601": "2024-12-06T01:16:02.500791Z",
"url": "https://files.pythonhosted.org/packages/42/56/92b83719d850ecfd0fd230c98ccce2de88597d883cc00cb8ac1fed46c538/imodmodel-0.0.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 01:16:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "teamtomo",
"github_project": "imodmodel",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "imodmodel"
}