Element#

class pymeasurement.util.chem.element.Element(string, protons=None, neutrons=None, mass=None)[source]#

A class to represent an chemical element.

Parameters:

string – The name of the element. :type string: str :param protons: The number of protons in the element. :type protons: int or None :param neutrons: The number of neutrons in the element. :type neutrons: int or None :param mass: The mass of the element. :type mass: int or None

__eq__(other)[source]#

Check if two elements are equal.

Parameters:

other (Element) – The other element to compare to.

Returns:

True if the elements are equal, False otherwise.

Return type:

bool

__hash__()[source]#

Get the hash of the element.

Returns:

The hash of the element.

Return type:

int

__init__(string, protons=None, neutrons=None, mass=None)[source]#

Element Constructor

__repr__()[source]#

Get the string representation of the element.

Returns:

The string representation of the element.

Return type:

str

__str__()[source]#

Get the string representation of the element.

Returns:

The string representation of the element.

Return type:

str

__weakref__#

list of weak references to the object (if defined)

atomicWeights()[source]#

Get a dictionary of all atomic weights.

Returns:

A dictionary of all atomic weights.

Return type:

dict

elements()[source]#

Get a list of all elements.

Returns:

A list of all elements.

Return type:

list

fromAtomicNumber()[source]#

Create an element from an atomic number.

Parameters:

num (int) – The atomic number of the element.

Returns:

The element with the given atomic number.

setLatexPrint()[source]#

Set whether to print the element in latex format.

Parameters:

value (bool) – Whether to print the element in latex format.