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 CollisionDB or ALADDIN2, databases 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

Connection to the ALADDIN2 API

>>> #By default, PyCollisionDB interacts with the API to the CollisionDB server
>>> pycoll.API_URL
'https://db-amdis.org/collisiondb/api/'

>>> #API_URL can be directed to ALADDIN2 server by passing argument DB_URL
>>> DB_URL = 'https://db-amdis.org/aladdin2'
>>> pycoll = PyCollision.get_datasets(query=query,DB_URL=DB_URL)
>>> pycoll.API_URL
'https://db-amdis.org/aladdin2/api/'

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.5.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycollisiondb-0.1.5.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pycollisiondb-0.1.5.tar.gz
Algorithm Hash digest
SHA256 084452d6cd700e3f205c31769f9f6856dd5a7e148834d380ff2dae9fb2aa7f59
MD5 76eef832e5104d56fe501317f7811146
BLAKE2b-256 fef320099542db76dd4a9adaec30088dea8e402c700e71ddf957f474434df7c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pycollisiondb-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2c6598394becfb5fede549d0e1ee0318eeae47ae9614068c8beaf29bcb869388
MD5 5d4e884c4b11f4f8c4f0c6a8ed6c9bef
BLAKE2b-256 cbd9a02eb266ab8f29227673cbf5f4b78396fa89616b81b3895343c22fcc46ec

See more details on using hashes here.

Supported by

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