Skip to main content

philsol

Modes for the Masses (Massless?)

Fed up with relying on expensive proprietary software for your electromagnetic waveguide research? philsol might just be the package for you. In a world where high performance hardware is cheaper than specialist software, philsol throws elegance and sophistication out of the window and replaces them with brute force.

This is a fully vectorial finite-difference waveguide mode solver and a direct Python implementation of the algorithm found in the paper: 'Full-vectorial finite-difference analysis of microstructured optical fibres', by Zhu and Brown.

Warning: I haven't thoroughly tested so be wary and check the results are sensible...

New Warning: The original paper by Zhu and Brown is in Gaussian rather than SI units. To correct this, use the conversion table here.

Installation

  • Install using pip with the command pip install philsol
  • If you can't be bothered, the important part is the function eigen_build in core.py.

Examples

  • Commented example projects can be found in the examples directory.
  • To run the examples, first install philsol in your Python environment (see above).

Features

Solver

  • Solves vector Maxwell (Helmholtz) equations in 2-D for arbitrary refractive-index profiles.
  • Returns the x and y components of the electric field.
  • philsol can handle anisotropic refractive indices with diagonal tensor.
  • Choice of solving routines: the default scipy.sparse solver or SLEPc (slepc4py and petsc4py). These libraries can be fiddly to set up but are very heavily featured, including some limited GPU support.
  • Additional field components Ez, Hx, Hy, Hz can be calculated from the construct module.
  • Perfect electric conductor, periodic and absorbing boundary conditions.

Geometry building

  • The quickest way of importing geometry is with a bitmap image.
  • See examples/example_image.py and examples/Hollow_Core_Fibre.ipynb for examples loading .bmp images.
  • See examples/example_build.py for an example in building geometry using PIL/Pillow.
  • See examples/Boundary Interpolation Example.ipynb for an attempt to handle curved boundaries with Pillow's anti-aliasing capabilities.

Final Note

I wrote this code a while ago during my PhD but sometimes I get nostalgic about photonics, so if you are doing anything cool with philsol I would love to know about it.

Metadata

Release files for philsol 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for philsol 1.0
File Size Uploaded Provenance Actions
philsol-1.0.tar.gz 6.8 kB Without provenance Details for philsol-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for philsol 1.0
File Interpreter ABI Platform Actions
philsol-1.0-py3-none-any.whl Python 3 none any Details for philsol-1.0-py3-none-any.whl

Total release size: 15.2 kB

Release files / philsol-1.0.tar.gz

Download URL philsol-1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
407447b86ed2342b300c75e599613c7836741ad4677597213625d64f746548c6
BLAKE2b-256 checksum
How to use checksums
886b20fc59d89401207f9838ce421b4dd72bdf6de5639ca4e9eb3ba536c2b369
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.9 Windows/10

Release files / philsol-1.0-py3-none-any.whl

Download URL philsol-1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80bbb847baae7b9923ef3a51354ab68319c2f06a1c3da33d1e29624352269926
BLAKE2b-256 checksum
How to use checksums
ca45ed039566e87c8dceea601df5ca30cba5dfc4b1b63e77d3aeecbaf693cfef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.9 Windows/10

Security for philsol 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page