ph_diagrams package

Submodules

ph_diagrams.ph_diagrams module

class ph_diagrams.ph_diagrams.Acid(pKa, acid_concentration)[source]

Bases: object

A class used to represent an acid

pKa

array with each pKa of the acid

Type

np.array

Ka

array with each Ka of the acid

Type

np.array

Ca

analytical concentration of the acid

Type

float

alpha

alpha values for each acid form

Type

list

log_concentrations

log ci for each acid form

Type

list

formulas(ouput)[source]

generates formulas for each acid form in raw string, LaTeX, or HTML

plot(plot_type, backend, output_plotly, ax, legend, title)[source]

plots the distribution diagram or logc diagram using as backend Matplotlib or Plotly

property alpha

returns: alpha values for each acid form :rtype: list

formulas(output)[source]

Generates formulas for each acid form in raw string, LaTeX, or HTML

Parameters

output (str) – Raw string if ‘raw’; LaTeX if ‘latex’; HTML if ‘html’

Raises

ValueError – If no valid output.

Returns

List of strings in the chosen output type

Return type

list

property log_concentrations

returns: log ci values for each acid form :rtype: list

plot(plot_type='distribution', backend='matplotlib', output_plotly=False, ax=None, legend=True, title='')[source]

Method to select the plot type and backend

Parameters
  • plot_type (str, optional) – ‘distribution’ or ‘pC’ (default is distribution)

  • backend (str, optional) – ‘matplotlib’ or ‘plotly’ (default is matplotlib)

  • output_plotly (bool, optional) – If backend is plotly, generates a html file with the chosen plot type. Ignored if backend is matplotlib. If false, the function returns a plotly figure (default is False).

  • ax (None, optional) – If a Matplotlib axes object is passed, the plot will be shown in it. If None, a figure with an axis will be created (default is None)

  • legend (bool, optional) – Show legend when backend is Matplotlib (default is True)

  • title (str, optional) – Title to be shown above the plot (default is ‘’)

Raises

ValueError – If invalid type or invalid backend

Return type

A plotly figure or a matplotlib axis.

plot_params(ylabel, ax=None, xlabel='pH')[source]

Matplotlib plot parameters

Parameters
  • ylabel (str) –

  • ax (Matplotlib axes) –

  • xlabel (str) –

Return type

Matplotlib axes

Module contents