pycroxe#
PyCroXe#
Python API for CroXe: a relational database of cross-sections and rate coefficients for atomic processes and alike. If you are lookig for the database itself, see CroXe.
Classes#
|
Thin wrapper around a SQLAlchemy |
Functions#
|
If used outside of a |
Generic data retrieval#
|
Return properties of selected species by |
Usage#
This root module provides, through the function pycroxe.connect() and
the class pycroxe.CroXeConnection, the basic interface to manage
connections with any instance of CroXe.
While pycroxe.CroXeConnection is provided mainly for type hinting,
the recommended usage of pycroxe.connect() is within a with
statement:
from pycroxe import connect
with connect() as conn:
...
which will return a pycroxe.CroXeConnection instance acting as a
context manager (i.e. will take care of opening and closing connections
automatically).
You can change the default connection URL
(mariadb+mariadbconnector://croxe-guest@localhost/CroXe) by, in order of
decreasing precedence:
passing a valid URL as an argument to
pycroxe.connect()setting the environment variable
CROXE_DBto a valid URLchanging specific parts of the default URL with
pycroxe.connect()keyword arguments
You get also access to some
generic data retrieval functions, such as
pycroxe.get_species_properties().
See pycroxe.beam for full documentation of more specialized queries
and cross-section retrieval, and pycroxe.fitfunctions for the fit
function registry.
Notes#
PyCroXe URLs follow the
SQLAlchemy pattern
(dialect+driver://username@host:port/database)
It is also possible, but not advisable, to get direct access to the
pycroxe.CroXeConnection class. In this case, the caller will be
responsible for closing the connection:
from pycroxe import CroXeConnection
conn = CroXeConnection()
conn.open()
...
conn.close()