Skip to main content

Electrolyte database manager

Project description

electrolytes

CI Codecov Pydantic v2 Ruff ty uv Publish PyPI PyPI - Python Version Docker Docker image

electrolytes provides command-line and programmatic access to a database of electrolytes and their properties. It includes 518 components by default (see credits). The package covers basic management of the database, including support for storing user-defined electrolytes.

electroMicroTransport

electrolytes is primarily developed as a utility to assist in preparing simulation cases for the electroMicroTransport toolbox for electromigrative separations. However, it is an independent package and can be installed and used separately.

Installation

Install with pip:

$ python3 -m pip install electrolytes

Command-line usage

Invoke the electrolytes command-line application to search the database, find the details of a particular component, or to add/remove user-defined components. In your terminal, run:

$ electrolytes

or, alternatively:

$ python3 -m electrolytes

Add the --help flag to learn what options are available.

Python API

The Python API is provided for electroMicroTransport case initialization scripts.

from electrolytes import database, Constituent

You can look up components in the database as you would with dict (with component names as keys), and also add user-defined components with the add method (as if database were a set). Components are instances of the Constituent class. Extra methods are also defined for database:

    def user_defined(self) -> Iterable[str]: ...

    def is_user_defined(self, name: str) -> bool: ...

The database object is also usable as a context manager (i.e. with database:), which allows multiple operations to be performed with exclusive access to the database (locking out any other processes for the duration).

Constituent names are case insensitive and will be automatically converted to all uppercase. Any instances added to (or removed from) the database will be saved for the current operating system user. Default components cannot be changed or removed (expect a ValueError if you try).

The public interface of the Constituent class is:

class Constituent:
    name: str
    u_neg: Sequence[float] = []  # mobilities for [..., -3, -2, -1], SI units*1e-9
    u_pos: Sequence[float] = []  # mobilities for [+1, +2, +3, ...], SI units*1e-9
    pkas_neg: Sequence[float] = []  # pKas for [..., -3, -2, -1]
    pkas_pos: Sequence[float] = []  # pKas for [+1, +2, +3, ...]

    # Interface for electroMicroTransport
    def mobilities(self) -> Sequence[float]: ...  # for [..., +3, +2, +1, -1, -2, -3, ...], SI units
    def pkas(self) -> Sequence[float]: ...  # for [..., +3, +2, +1, -1, -2, -3, ...]
    # NOTE: the above are padded if needed so that +3 and -3 are always present (len >= 6)
    def diffusivity(self) -> float: ...  # SI units

Data credits

Electrolyte data taken from the Simul 6 application[^simul6] (homepage, GitHub). The dataset of different electrolytes was originally compiled by Prof. Hirokawa[^Hirokawa].

[^simul6]: GAŠ, Bohuslav; BRAVENEC, Petr. Simul 6: A fast dynamic simulator of electromigration. Electrophoresis, 2021, vol. 42, no. 12-13, pp. 1291-1299. DOI: 10.1002/elps.202100048

[^Hirokawa]: HIROKAWA, Takeshi, et al. Table of isotachophoretic indices: I. Simulated qualitative and quantitative indices of 287 anionic substances in the range ph 3–10. Journal of Chromatography A, 1983, vol. 271, no. 2, pp. D1-D106. DOI: 10.1016/S0021-9673(00)80225-3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

electrolytes-0.4.10.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

electrolytes-0.4.10-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file electrolytes-0.4.10.tar.gz.

File metadata

  • Download URL: electrolytes-0.4.10.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for electrolytes-0.4.10.tar.gz
Algorithm Hash digest
SHA256 f181b5ae54364d8071e06d2bb90cb57d87a66824b497cf3567f67aedab98e3db
MD5 29ae9be4d743346a64e1c17b4ff380ed
BLAKE2b-256 f01057b41bfcd61907761106da07107aa10f07d9ee78551b4762af4d2adaf37f

See more details on using hashes here.

File details

Details for the file electrolytes-0.4.10-py3-none-any.whl.

File metadata

  • Download URL: electrolytes-0.4.10-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for electrolytes-0.4.10-py3-none-any.whl
Algorithm Hash digest
SHA256 31dc6079074c8c673857f892f60507f6ed411ebec425dcf4249fea19700e4f8a
MD5 43ae9578ae654f928e2a23605d7ff412
BLAKE2b-256 e1783e8bae21e9ea355d1cdecf2d96cf9fee9908133c32ca0466a7dc364ad686

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page