Skip to main content

Shared numerical and vector algebra toolkit for MNPBEM-Python.

Project description

mnpbem-misc

mnpbem-misc provides shared numerical utilities used across MNPBEM-Python submodules.

Features

  • Physical unit conversions between photon energy and wavelength.
  • Vector norms and normalization utilities with MATLAB-compatible behavior.
  • Tensor-aware linear algebra helpers (matmul, matcross, inner, outer, spdiag).

Mathematical Formulations

1. Photon Energy-Wavelength Conversion

The conversion between photon energy and wavelength is:

$$ \lambda_{\mathrm{nm}} = \frac{C_{\mathrm{eV\cdot nm}}}{E_{\mathrm{eV}}}, \qquad C_{\mathrm{eV\cdot nm}} \approx 1239.841984 $$

2. Euclidean Vector Norm

For a vector $\mathbf{v}$:

$$ |\mathbf{v}|_2 = \sqrt{\sum_i |v_i|^2} $$

3. Vector Normalization

Normalized vector:

$$ \tilde{\mathbf{v}} = \frac{\mathbf{v}}{|\mathbf{v}_{\mathrm{ref}}|_2} $$

Implementation

  • Unit conversion utilities: src/mnpbem_misc/units.py
  • Vector operations: src/mnpbem_misc/vector.py
  • Linear algebra helpers: src/mnpbem_misc/linalg.py

Dependencies

Runtime dependencies are installed automatically by pip:

  • numpy>=1.24

Installation

pip install mnpbem-misc

Example Usage

Runnable example:

  • examples/basic_usage.py

Run:

python examples/basic_usage.py

Author

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

mnpbem_misc-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

mnpbem_misc-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file mnpbem_misc-0.1.1.tar.gz.

File metadata

  • Download URL: mnpbem_misc-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mnpbem_misc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ff0fc170a4a62ae9cffff582e6e9c94d6679ea1698371aa72beaa212d6295ed7
MD5 4a15d2d66cb79c9316c69c16e85c44d1
BLAKE2b-256 6c543b91b69c3778481474780fc5ffc3f996d911f2b4a856c92810a0c04748ce

See more details on using hashes here.

File details

Details for the file mnpbem_misc-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mnpbem_misc-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mnpbem_misc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5e956ce65ef4d6c85af1db024b3ea79f82c6ab60c946190e47a2877d5a2a257
MD5 f679036a9c3dc2e54d25f882b1b509c2
BLAKE2b-256 65e9149b6fe54023b7d142cbf3018f522d15e359fd6b00a10560e3bfaa9dacb5

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