pdg_database_sgl

class reactions.pdg_database_sgl

Bases: object

Object to serve as an interface with the PDG database. This object is declared as a singleton, using a single database file that can be modified using the set_database_path() function. This ensures that reactions are composed of PDG elements from the same file. The database can make use of an internal cache to avoid reading from the file many times.

Methods Summary

__call__

Access an element of the database by name or PDG ID

all_elements

Extract all the elements to a list.

charge_conjugate

Get the charge-conjugate of an element.

clear_cache

Clear the internal cache, removing also user-registered elements

disable_cache

Disable the internal cache

enable_cache

Enable the internal cache.

get_database_path

Get the path to the database file

register_element

Register a new element in the database.

set_database_path

Set the path to the database file.

Methods Documentation

__call__()

Access an element of the database by name or PDG ID

Parameters

arg (str or int) – element name or PDG ID

Returns

corresponding element

Return type

pdg_element

Raises

reactions.LookupError – if the element is not found

all_elements()

Extract all the elements to a list. This includes all those elements registered by the user.

Returns

all the elements

Return type

list(pdg_element)

charge_conjugate()

Get the charge-conjugate of an element.

Parameters

element (pdg_element) – element to calculate the charge-conjugate

Returns

charge-conjugate of the given element

Return type

pdg_element

clear_cache()

Clear the internal cache, removing also user-registered elements

disable_cache()

Disable the internal cache

enable_cache()

Enable the internal cache. All the elements will be loaded in memory.

get_database_path()

Get the path to the database file

Returns

path to the database file

Return type

str

register_element()

Register a new element in the database. Arguments can be either a single PDG element object or the arguments to the constructor of reactions.pdg_element.

set_database_path()

Set the path to the database file. If the cache is enabled, reloads the data. If the cache is enabled, elements are reloaded in memory.

Parameters

path (str) – path to the database file