Skip to main content

A package for interacting with CollisionDB

Project description

PyPI version PyPI pyversions Code style

Introduction to PyCollisionDB

PyCollisionDB is a Python package for interacting with the CollisionDB database of plasma collisional cross sections and rate coefficients.

Datasets in these collisional databases can be retrieved in a standardized way and compared, aggregated, and assessed using a set of predefined Python methods.

Installation

The PyCollisionDB package can be installed either from PYPI using pip

python3 -m pip install pycollisiondb

or from the source by running (one of the two) from the project source directory.

# either
python setup.py install

# or
python3 -m pip install .

PyCollision

The PyCollision object represents the main instance of the PyCollisionDB package for interacting with collisional databases, and datasets may be compared, output in various formats, and manipulated using the methods object as described below:

>>> from pycollisiondb.pycollisiondb import PyCollision

Convert Units

The PyCollision method convert_units can be used to change the units of datasets.

>>> pycoll.datasets[102737].x
array([  1000.,   4000.,   9000.,  16000.,  25000.,  36000.,  49000.,
     64000.,  81000., 100000.])
>>> # The units of all datasets are changed,
>>> # Energy is changed from eV.u-1 (default) to keV.u-1 and sigma from cm2 (default) to a02 (atomic units).
>>> # This accesses the pyqn library.
 >>> pycoll.convert_units({'E': 'keV.u-1', 'sigma': 'a02'})
 >>> pycoll.datasets[102737].x
 array([  1.,   4.,   9.,  16.,  25.,  36.,  49.,  64.,  81., 100.])
>>> # Change the units of a single dataset,
>>> # provide the column name followed by units as arguments.
>>> pycoll.datasets[102737].convert_units('sigma', 'm2')

Visualization tools

The PyCollision method plot_all_datasets can be used to create plots using the pyplot submodule of the Matplotlib library as the visualization utility.

>>> import matplotlib.pyplot as plt
>>> %matplotlib notebook
>>> # Make a plot, indicating how the data should be labelled.
>>> fig, ax = plt.subplots()
>>> # The default legend consists of qid/pk and reaction labels,
>>> # it can be customized to include refs and process_types or either of these lables.
>>> pycoll.plot_all_datasets(ax, label=('reaction', 'qid', 'refs', 'process_types'))
>>> plt.legend()
figure

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

pycollisiondb-0.1.6.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

pycollisiondb-0.1.6-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file pycollisiondb-0.1.6.tar.gz.

File metadata

  • Download URL: pycollisiondb-0.1.6.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pycollisiondb-0.1.6.tar.gz
Algorithm Hash digest
SHA256 74218ead85a8421bd37de509127f4891bbd343000065f543a0a79bd6760f5ecc
MD5 ec8230912c6d1d75e45229f05ea87925
BLAKE2b-256 cb05e2477bed521205306af76177c9359e3fb62b1dedc8692de7838f302223b5

See more details on using hashes here.

File details

Details for the file pycollisiondb-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pycollisiondb-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pycollisiondb-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2d7389897a921236143dd26d3c0331b3cec6b8b325e4e56d69c12d88e7cf11ae
MD5 154997345e2a6f08b73b7bc6ab38f700
BLAKE2b-256 ba9baffa5aa5b3cdd7c9e23d6d8caa7e7a1a99be188dadba1cb89075a519501f

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