pdg_database_sgl¶
-
class
reactions.pdg_database_sgl¶ Bases:
objectObject 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
Access an element of the database by name or PDG ID
Extract all the elements to a list.
Get the charge-conjugate of an element.
Clear the internal cache, removing also user-registered elements
Disable the internal cache
Enable the internal cache.
Get the path to the database file
Register a new element in the database.
Set the path to the database file.
Methods Documentation
-
__call__()¶ Access an element of the database by name or PDG ID
- Parameters
- Returns
corresponding element
- Return type
- 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
-
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
-
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
-
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.
-