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
- GALIH RIDHO UTOMO
- g4lihru@students.unnes.ac.id
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mnpbem_misc-0.1.2.tar.gz.
File metadata
- Download URL: mnpbem_misc-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f748266d733a116640fb7a2aefb6f0c92d7259ca454160520cf84e984e1ab08
|
|
| MD5 |
3ddca7eb393e66a1295d8b648f0ea2ad
|
|
| BLAKE2b-256 |
4ca8bc0be31a2988e5a3f619d12d0b13275c3c9c753556b8095ec50b91f7f52a
|
File details
Details for the file mnpbem_misc-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mnpbem_misc-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87314e242ae9b98e232eefd25c352e26bfc5443c63ed6de35e92f5f4a9254e90
|
|
| MD5 |
debc2643b81b15a26f04128c243f0108
|
|
| BLAKE2b-256 |
a77efcf0a68eef78dc498f5de5ed16b87bc52aebf90427d265d700d3fdee4e68
|