User guide¶
The user guide documents every public name in chemhelper, one module per page. Each function has its signature, its arguments, what it returns, the errors it can raise, the formula behind it, and runnable examples.
-
The
Elementclass and four ways to reach the periodic table data. -
parse_formula,mass,composition,percent_compositionand their_stepstwins. -
grams_to_moles,moles_to_grams,molarity,molarity_to_moles,molarity_to_gramsand their_stepstwins. -
ideal_gasandideal_gas_steps, with unit options.
Everything at a glance¶
elements¶
| Name | Kind | Description |
|---|---|---|
Element |
class | One element: symbol, name, atomic number, mass |
H, He, … U |
Element objects |
One per element, named by symbol |
elements |
pandas Series | Element objects indexed by symbol |
element_index |
list | Symbols in order of atomic number |
element_objects |
list | Element objects in order of atomic number |
element_table |
pandas DataFrame | Symbol, name and mass indexed by atomic number |
compounds¶
| Function | Returns | Description |
|---|---|---|
parse_formula(chemical) |
OrderedDict |
Atom counts in a formula |
mass(chemical) |
float |
Molar mass in g/mol |
mass_steps(chemical) |
prints | Molar mass, worked |
composition(chemical) |
Series | Grams of each element per mole |
composition_steps(chemical) |
prints | Composition, worked |
percent_composition(chemical) |
Series | Percent by mass of each element |
percent_composition_steps(chemical) |
prints | Percent composition, worked |
conversions¶
| Function | Returns | Description |
|---|---|---|
grams_to_moles(mass, chemical) |
float |
Grams → moles |
moles_to_grams(moles, chemical) |
float |
Moles → grams |
molarity(volume, mass, chemical, moles) |
float |
Molarity from moles, or from mass |
molarity_to_moles(M, volume) |
float |
Moles of solute in a solution |
molarity_to_grams(molarity, volume, chemical) |
float |
Grams of solute in a solution |
Each has a _steps twin with the same arguments.
ideal_gas¶
| Name | Returns | Description |
|---|---|---|
ideal_gas(solve_for, ...) |
float |
Solve PV = nRT for P, V, n or T |
ideal_gas_steps(solve_for, ...) |
prints | The same, worked |
R |
float |
The gas constant, 0.0821 L·atm/(mol·K) |
Conventions used in the guide¶
- Examples start from the imports shown at the top of each page.
- Lines beginning with
>>>are what you type. The lines below them are what Python prints. - "Returns" means the function gives a value back. "Prints" means it writes
to the screen and returns
None. See Answers and worked solutions.
For the same information in compact, generated form, see the API reference.