Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/mnishida/PyMWM

Pymwm is a metallic waveguide mode solver witten in Python
https://github.com/mnishida/PyMWM

Last synced: 2 months ago
JSON representation

Pymwm is a metallic waveguide mode solver witten in Python

Lists

README

        

# PyMWM

[![PyPI version][pypi-image]][pypi-link]
[![Anaconda Version][anaconda-v-image]][anaconda-v-link]
[![Lint and Test][github-workflow-image]][github-workflow-link]

[pypi-image]: https://badge.fury.io/py/pymwm.svg
[pypi-link]: https://pypi.org/project/pymwm
[anaconda-v-image]: https://anaconda.org/mnishida/pymwm/badges/version.svg
[anaconda-v-link]: https://anaconda.org/mnishida/pymwm
[github-workflow-image]: https://github.com/mnishida/PyMWM/actions/workflows/pythonapp.yml/badge.svg
[github-workflow-link]: https://github.com/mnishida/PyMWM/actions/workflows/pythonapp.yml

PyMWM is a metallic waveguide mode solver written in Python.

It provides the dispersion relation, i.e. the relation between propagation constant β = α + iγ (with phase constant α and attenuation constant γ) and angular frequency ω, for cylindrical waveguide, coaxial waveguide, and planer waveguide (slits). It also provides the distribution of mode fields.

## Version
0.5.6

## Install
#### Install and update using pip
```
$ pip install -U pymwm
```
#### Install using conda
```
$ conda create -n pymwm python=3.8
$ conda activate pymwm
$ conda install -c mnishida pymwm
$ pip install "ray[default]"
```

## Dependencies
- python 3
- numpy
- scipy
- pandas
- pytables
- ray
- matplotlib
- riip
## Uninstall
```
$ pip uninstall pymwm
```
or
```
$ conda deactivate
$ conda remove -n pymwm --all
```

## Usage
Let's consider a cylindrical waveguide whose radius is 0.15μm filled with water (refractive index : 1.333) surrounded by gold.
You can specify the materials by the parameters for [RII_Pandas](https://github.com/mnishida/RII_Pandas).
Wavelength range is set by the parameters 'wl_min' (which is set 0.5 μm here) and 'wl_max' (1.0 μm).
PyMWM compute the dispersion relation the two complex values, ω (complex angular frequency) and β (propagation constant).
The range of the imaginary part of ω is set from -2π/wl_imag to 0 with the parameter 'wl_imag'.
Usually, the cylindrical waveguide mode is specified by two integers, n and m.
The number of sets indexed by n and m are indicated by the parameters 'num_n' and 'num_m', respectively.
```
>>> import pymwm
>>> params = {
'core': {'shape': 'cylinder', 'size': 0.15, 'fill': {'RI': 1.333}},
'clad': {'book': 'Au', 'page': 'Stewart-DLF'},
'bounds': {'wl_max': 1.0, 'wl_min': 0.5, 'wl_imag': 10.0},
'modes': {'num_n': 6, 'num_m': 2}
}
>>> wg = pymwm.create(params)
```
If the parameters are set for the first time, the creation of waveguide-mode object will take a quite long time, because a sampling survey of βs in the complex plane of ω will be conducted and the obtained data is registered in the database.
The second and subsequent creations are done instantly.
You can check the obtained waveguide modes in the specified range by showing the attribute 'modes';
```
>>> wg.modes
{'h': [('E', 1, 1),
('E', 2, 1),
('E', 3, 1),
('E', 4, 1),
('M', 0, 1),
('M', 1, 1)],
'v': [('E', 0, 1),
('E', 1, 1),
('E', 2, 1),
('E', 3, 1),
('E', 4, 1),
('M', 1, 1)]}
```
where 'h' ('v') means that the modes have horizontally (vertically) oriented electric fields on the x axis. The tuple (pol, n, m) with pol being 'E' or 'M' indicates TE-like or TM-like mode indexed by n and m.
You can get β at ω=8.0 rad/μm for TM-like mode with n=0 and m=1 by
```
>>> wg.beta(8.0, ('M', 0, 1))
(0.06187318716518497+10.363105296313996j)
```
and for TE-like mode with n=1 and m=2 by
```
>>> wg.beta(8.0, ('E', 1, 2))
(0.14261514314942403+19.094726281995463j)
```
For more information, see the [tutorial notebook](https://github.com/mnishida/PyMWM/blob/master/docs/notebooks/00_tutorial.ipynb) and [User's Guide](https://pymwm.readthedocs.io/en/latest/).

## Examples
### Cylindrical waveguide
#### Propagation constants
phase constant
attenuation constant

#### Electric field and magnetic field distributions
* TE01
TE01 electric field
TE01 magnetic field
* HE11
HE11 electric field
HE11 magnetic field
* HE12
HE12 electric field
HE12 magnetic field
* HE21
HE21 electric field
HE21 magnetic field
* HE31
HE31 electric field
HE31 magnetic field
* TM01
TM01 electric field
TM01 magnetic field
* TM02
TM02 electric field
TM02 magnetic field
* EH11
EH11 electric field
EH11 magnetic field
* EH21
EH21 electric field
EH21 magnetic field

### Slit waveguide
#### Propagation constants
phase constant (slit)
attenuation constant (slit)

#### Electric field and magnetic field distributions
* TE1
TE1 electric field
TE1 magnetic field
* TE2
TE2 electric field
TE2 magnetic field
* TE3
TE3 electric field
TE3 magnetic field
* TE4
TE4 electric field
TE4 magnetic field
* TM0
TM0 electric field
TM0 magnetic field
* TM1
TM1 electric field
TM1 magnetic field
* TM2
TM2 electric field
TM2 magnetic field
* TM3
TM3 electric field
TM3 magnetic field