Skip to main content

A collection of useful utilities for the Spyral analysis framework

Project description

spyral-utils

testing workflow PyPI version shields.io PyPI license

spyral-utils is a utility library that contains some of the core functionality of Spyral. 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 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:

{
    "compound": [
        [1, 1, 2]
    ],
    "pressure(Torr)": 300.0
}

For a solid target:

{
    "compound": [
        [6, 12, 1]
    ],
    "thickness(ug/cm^2)": 50.0
}

For a gas mixture:

{
    "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 1H2 gas at 300 Torr pressure and the solid target is for 12C1 foil with a thickness of 50 μg/cm2. 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:

{
    "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).

{
    "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:

{
    "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

{
    "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

For documentation we use

For testing we use

Authors

  • Gordon McCann
  • Nathan Turi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spyral_utils-2.0.0.tar.gz (56.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spyral_utils-2.0.0-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

Details for the file spyral_utils-2.0.0.tar.gz.

File metadata

  • Download URL: spyral_utils-2.0.0.tar.gz
  • Upload date:
  • Size: 56.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure

File hashes

Hashes for spyral_utils-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ba44c93a2d91bb54fd7f81c34780d2bffb5a345715e9b0ba1c4eb20122025a69
MD5 8c92403569a95240aaeb2f4207419a58
BLAKE2b-256 b67cafd2bfdc899b8fb64e08060f9bb66cffbae416d2a0bee8ed70fa09e623fa

See more details on using hashes here.

File details

Details for the file spyral_utils-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: spyral_utils-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure

File hashes

Hashes for spyral_utils-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5a00eea3f6db672fe28b359d750f301be309c789fede9bb520a40f322141f93
MD5 e56d5ec318c1d502cc63c2f6964dbd58
BLAKE2b-256 b6a382299bf45af5f47f0d7148eff9be0f3702d35acd2719f8999a894640c335

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page