Name | spyral-utils JSON |
Version |
1.2.0
JSON |
| download |
home_page | None |
Summary | A collection of useful utilities for the Spyral analysis framework |
upload_time | 2024-12-06 17:38:06 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <3.13,>=3.10 |
license | GPLv3 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# spyral-utils
![testing workflow](https://github.com/ATTPC/spyral-utils/actions/workflows/test-actions.yml/badge.svg)
[![PyPI version shields.io](https://img.shields.io/pypi/v/spyral-utils.svg)](https://pypi.python.org/pypi/spyral-utils/)
[![PyPI license](https://img.shields.io/pypi/l/spyral-utils.svg)](https://pypi.python.org/pypi/spyral-utils/)
spyral-utils is a utility library that contains some of the core functionality of [Spyral](https://github.com/ATTPC/Spyral.git). These utilities were found to be useful not just within Spyral but also continuing analysis after using Spyral. Some key utilities include:
- Nuclear masses from the AMDC AME 2020 masses
- Some histogramming and gating/cuting tools that are plotting backend agnostic
- Energy loss analysis for gas and solid targets using pycatima
- 4-vector analysis through the vector package
See the [documentation](https://attpc.github.io/spyral-utils/) for more details.
## Installation
spyral-utils can be installed using `pip install spyral-utils`
## System requirements
spyral-utils requires Python >= 3.10 and < 3.13
spyral-utils is cross-platform and tested for MacOS 14, Windows 11, and Ubuntu 22.04.
## Formats
Several parts of the utilities allow for saving and creating objects from JSON. Below is an outline of the expected formats for each of these
### Targets
For a gas target:
```json
{
"compound": [
[1, 1, 2]
],
"pressure(Torr)": 300.0
}
```
For a solid target:
```json
{
"compound": [
[6, 12, 1]
],
"thickness(ug/cm^2)": 50.0
}
```
For a gas mixture:
```json
{
"components": [
[
[6, 12, 1],
[1, 1, 4],
],
[
[18, 40, 1]
]
],
"volume_fractions": [0.1, 0.9],
"pressure(Torr)": 50.0
}
```
Compound specifications are lists of elements where each element is an array of `[Z, A, S]`. `S` is the
stoichiometry of that particular element in the compound. spyral-utils does not support target layers at
this time (but layered targets can be built from the building blocks provided by spyral-utils). In the above examples the
gas target is for <sup>1</sup>H<sub>2</sub> gas at 300 Torr pressure and the solid target is for
<sup>12</sup>C<sub>1</sub> foil with a thickness of 50 μg/cm<sup>2</sup>. The gas mixutre example is for
P10 gas (10% methane in argon) at 50 Torr.
### 2D-Cuts
The JSON description of a 2D-Cut (or 2D-gate) on data is as follows:
```json
{
"name": "test_cut",
"vertices": [
[0.0, 0.0],
[1.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
[0.0, 0.0]
]
}
```
`name` is a identifier given for that particular cut. `verticies` is a list of `[x,y]` coordinates which define the polygon. Note that the polygon must be closed (the final vertex must be the same as the first vertex). You can also add the `xaxis` and `yaxis` keywords to specify the names of the axes of the cut (i.e. the column names of a dataframe).
```json
{
"name": "test_cut",
"xaxis": "my_x",
"yaxis": "my_y",
"vertices": [
[0.0, 0.0],
[1.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
[0.0, 0.0]
]
}
```
### Particle ID
The JSON description of a particle ID gate is as follows:
```json
{
"name": "test_cut",
"vertices": [
[0.0, 0.0],
[1.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
[0.0, 0.0]
],
"Z": 6,
"A": 12
}
```
The `name` and `vertices` fields are the same as those used by a Cut2D. The particle ID has the additional data `Z` and `A` which are the element and mass number of the associated nucleus. Like in a Cut2D you can also specify the axis names of the cut
```json
{
"name": "test_cut",
"xaxis": "my_x",
"yaxis": "my_y",
"vertices": [
[0.0, 0.0],
[1.0, 0.0],
[1.0, 1.0],
[0.0, 1.0],
[0.0, 0.0]
],
"Z": 6,
"A": 12
}
```
## References
- [CAtima](https://github.com/hrosiak/catima)/[pycatima](https://github.com/hrosiak/pycatima)
- [AMDC Mass Evaluation](https://www-nds.iaea.org/amdc/): W.J. Huang et al 2021 Chinese Phys. C 45 030002
- [scipy](https://scipy.org/)
- [numpy](https://numpy.org/)
- [shapely](https://shapely.readthedocs.io/)
- [polars](https://www.pola.rs/)
- [vector](https://vector.readthedocs.io/)
For documentation we use
- [mkdocs](https://www.mkdocs.org)
- [mkdocs-material](https://squidfunk.github.io/mkdocs-material/)
- [mkdocstrings](https://mkdocstrings.github.io/)
For testing we use
- [pytest](https://docs.pytest.org/)
## Authors
- Gordon McCann
- Nathan Turi
Raw data
{
"_id": null,
"home_page": null,
"name": "spyral-utils",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Gordon McCann <mccann@frib.msu.edu>, Nathan Turi <turi@frib.msu.edu>",
"download_url": "https://files.pythonhosted.org/packages/eb/cb/f008929c049599c393b3372ec40781954ba2162c6b93fc5fcbac969caa9d/spyral_utils-1.2.0.tar.gz",
"platform": null,
"description": "# spyral-utils\n\n![testing workflow](https://github.com/ATTPC/spyral-utils/actions/workflows/test-actions.yml/badge.svg)\n[![PyPI version shields.io](https://img.shields.io/pypi/v/spyral-utils.svg)](https://pypi.python.org/pypi/spyral-utils/)\n[![PyPI license](https://img.shields.io/pypi/l/spyral-utils.svg)](https://pypi.python.org/pypi/spyral-utils/)\n\nspyral-utils is a utility library that contains some of the core functionality of [Spyral](https://github.com/ATTPC/Spyral.git). These utilities were found to be useful not just within Spyral but also continuing analysis after using Spyral. Some key utilities include:\n\n- Nuclear masses from the AMDC AME 2020 masses\n- Some histogramming and gating/cuting tools that are plotting backend agnostic\n- Energy loss analysis for gas and solid targets using pycatima\n- 4-vector analysis through the vector package\n\nSee the [documentation](https://attpc.github.io/spyral-utils/) for more details.\n\n## Installation\n\nspyral-utils can be installed using `pip install spyral-utils`\n\n## System requirements\n\nspyral-utils requires Python >= 3.10 and < 3.13\n\nspyral-utils is cross-platform and tested for MacOS 14, Windows 11, and Ubuntu 22.04.\n\n## Formats\n\nSeveral parts of the utilities allow for saving and creating objects from JSON. Below is an outline of the expected formats for each of these\n\n### Targets\n\nFor a gas target:\n\n```json\n{\n \"compound\": [\n [1, 1, 2]\n ],\n \"pressure(Torr)\": 300.0\n}\n```\n\nFor a solid target:\n\n```json\n{\n \"compound\": [\n [6, 12, 1]\n ],\n \"thickness(ug/cm^2)\": 50.0\n}\n```\n\nFor a gas mixture:\n\n```json\n{\n \"components\": [\n [\n [6, 12, 1],\n [1, 1, 4],\n ],\n [\n [18, 40, 1]\n ]\n ],\n \"volume_fractions\": [0.1, 0.9],\n \"pressure(Torr)\": 50.0\n}\n```\n\nCompound specifications are lists of elements where each element is an array of `[Z, A, S]`. `S` is the \nstoichiometry of that particular element in the compound. spyral-utils does not support target layers at \nthis time (but layered targets can be built from the building blocks provided by spyral-utils). In the above examples the \ngas target is for <sup>1</sup>H<sub>2</sub> gas at 300 Torr pressure and the solid target is for\n<sup>12</sup>C<sub>1</sub> foil with a thickness of 50 μg/cm<sup>2</sup>. The gas mixutre example is for\nP10 gas (10% methane in argon) at 50 Torr.\n\n### 2D-Cuts\n\nThe JSON description of a 2D-Cut (or 2D-gate) on data is as follows:\n\n```json\n{\n \"name\": \"test_cut\",\n \"vertices\": [\n [0.0, 0.0],\n [1.0, 0.0],\n [1.0, 1.0],\n [0.0, 1.0],\n [0.0, 0.0]\n ]\n}\n```\n\n`name` is a identifier given for that particular cut. `verticies` is a list of `[x,y]` coordinates which define the polygon. Note that the polygon must be closed (the final vertex must be the same as the first vertex). You can also add the `xaxis` and `yaxis` keywords to specify the names of the axes of the cut (i.e. the column names of a dataframe).\n\n```json\n{\n \"name\": \"test_cut\",\n \"xaxis\": \"my_x\",\n \"yaxis\": \"my_y\",\n \"vertices\": [\n [0.0, 0.0],\n [1.0, 0.0],\n [1.0, 1.0],\n [0.0, 1.0],\n [0.0, 0.0]\n ]\n}\n```\n\n### Particle ID\n\nThe JSON description of a particle ID gate is as follows:\n\n```json\n{\n \"name\": \"test_cut\",\n \"vertices\": [\n [0.0, 0.0],\n [1.0, 0.0],\n [1.0, 1.0],\n [0.0, 1.0],\n [0.0, 0.0]\n ],\n \"Z\": 6,\n \"A\": 12\n}\n```\n\nThe `name` and `vertices` fields are the same as those used by a Cut2D. The particle ID has the additional data `Z` and `A` which are the element and mass number of the associated nucleus. Like in a Cut2D you can also specify the axis names of the cut\n\n```json\n{\n \"name\": \"test_cut\",\n \"xaxis\": \"my_x\",\n \"yaxis\": \"my_y\",\n \"vertices\": [\n [0.0, 0.0],\n [1.0, 0.0],\n [1.0, 1.0],\n [0.0, 1.0],\n [0.0, 0.0]\n ],\n \"Z\": 6,\n \"A\": 12\n}\n```\n\n## References\n\n- [CAtima](https://github.com/hrosiak/catima)/[pycatima](https://github.com/hrosiak/pycatima)\n- [AMDC Mass Evaluation](https://www-nds.iaea.org/amdc/): W.J. Huang et al 2021 Chinese Phys. C 45 030002\n- [scipy](https://scipy.org/)\n- [numpy](https://numpy.org/)\n- [shapely](https://shapely.readthedocs.io/)\n- [polars](https://www.pola.rs/)\n- [vector](https://vector.readthedocs.io/)\n\nFor documentation we use\n\n- [mkdocs](https://www.mkdocs.org)\n- [mkdocs-material](https://squidfunk.github.io/mkdocs-material/)\n- [mkdocstrings](https://mkdocstrings.github.io/)\n\nFor testing we use\n\n- [pytest](https://docs.pytest.org/)\n\n## Authors\n\n- Gordon McCann\n- Nathan Turi\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "A collection of useful utilities for the Spyral analysis framework",
"version": "1.2.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "da7f99efc26355fd3ce10bfae5c4fe594793140576612a4661e6ca5a888672c6",
"md5": "951d175f36fb5b684080215be5a26c4a",
"sha256": "50c9f482b15fb2d0bd59f7202d5dcb5910217b555d69352d65dc27a8e4f8d90a"
},
"downloads": -1,
"filename": "spyral_utils-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "951d175f36fb5b684080215be5a26c4a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 54654,
"upload_time": "2024-12-06T17:38:04",
"upload_time_iso_8601": "2024-12-06T17:38:04.412001Z",
"url": "https://files.pythonhosted.org/packages/da/7f/99efc26355fd3ce10bfae5c4fe594793140576612a4661e6ca5a888672c6/spyral_utils-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ebcbf008929c049599c393b3372ec40781954ba2162c6b93fc5fcbac969caa9d",
"md5": "e3bb149c50f80883cf34e75ddf6ef345",
"sha256": "a5c8672bdb91cbe108331761eef7691bec5f0833f0242053ac1a2a85517c5e90"
},
"downloads": -1,
"filename": "spyral_utils-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "e3bb149c50f80883cf34e75ddf6ef345",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 56632,
"upload_time": "2024-12-06T17:38:06",
"upload_time_iso_8601": "2024-12-06T17:38:06.052306Z",
"url": "https://files.pythonhosted.org/packages/eb/cb/f008929c049599c393b3372ec40781954ba2162c6b93fc5fcbac969caa9d/spyral_utils-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 17:38:06",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "spyral-utils"
}