Metadata-Version: 2.2
Name: SuPyMode
Version: 2.2.2
Summary: A package for light propagation in fiber optics.
Keywords: coupled-mode theory,waveguide
Author-Email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
License: MIT License
         
         Copyright (c) 2020 Martin de Sivry
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
         
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Development Status :: 4 - Beta
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.11
Requires-Dist: setuptools_scm[toml]>=8.0
Requires-Dist: numpy>=2.0.0
Requires-Dist: MPSPlots
Requires-Dist: pydantic
Requires-Dist: PyFinitDiff
Requires-Dist: FiberFusing
Requires-Dist: pyvista
Requires-Dist: PyFiberModes
Requires-Dist: pathvalidate
Provides-Extra: testing
Requires-Dist: pytest>=0.6; extra == "testing"
Requires-Dist: pytest-cov>=2.0; extra == "testing"
Requires-Dist: pytest-json-report==1.5.0; extra == "testing"
Requires-Dist: coverage==7.13.4; extra == "testing"
Provides-Extra: documentation
Requires-Dist: PyFiberModes; extra == "documentation"
Requires-Dist: numpydoc==1.10.0; extra == "documentation"
Requires-Dist: sphinx>=5.1.1; extra == "documentation"
Requires-Dist: sphinx-rtd-theme==3.1.0; extra == "documentation"
Requires-Dist: sphinx-gallery==0.20.0; extra == "documentation"
Requires-Dist: sphinx_design==0.6.1; extra == "documentation"
Requires-Dist: pydata-sphinx-theme==0.16.1; extra == "documentation"
Provides-Extra: dev
Requires-Dist: flake8==7.3.0; extra == "dev"
Description-Content-Type: text/x-rst

..  figure:: https://github.com/MartinPdeS/SuPyMode/blob/master/docs/images/mode_propagation.gif?raw=true
   :alt: Propagation of mode in an adiabatic 2x1 modally-specific photonic lantern.
   :class: with-shadow float-left
   :width: 800px

.. list-table::
   :widths: 10 25 25 25
   :header-rows: 0

   * - Meta
     - |python|
     - |docs|
     - |zenodo|
   * - Testing
     - |ci/cd|
     - |coverage|
     - |colab|
   * - PyPI
     - |PyPI|
     - |PyPI_download|
     -
   * - Anaconda
     - |anaconda|
     - |anaconda_download|
     - |anaconda_date|

SuPyMode
========

This project aims to develop an useful tool design and optimize fiber optic tapered component.
SuPyMode is a Python library linked to a c++ core allowing for a flexible interface and fast computing core.
The library also aims to offer the end-user a great vizual tools for data analysis.
To this day, SuPyMode as been proven a useful tool to develop very-short 2x1 and 3x1 modally specific photonic lantern with very low loss and cross-talk.

Features
--------
- Fast and efficient simulation of fiber optic tapered components.
- User-friendly interface for easy integration into existing workflows.
- Comprehensive visualization tools for data analysis and interpretation.

Installation
------------
**SuPyMode** is available on PyPI and Anaconda.  Install it with:

.. code-block:: bash

   pip install SuPyMode
   conda install SuPyMode

See the `online documentation <https://supymode.readthedocs.io/>`_ for detailed
usage and additional examples.


Quick example
-------------
Below is a short example computing the mode propgation in a simple fiber.

.. code-block:: python

   from SuPyMode.workflow import Workflow, fiber_loader, Boundaries, BoundaryValue, DomainAlignment

   wavelength = 1550e-9

   fiber = fiber_loader.load_fiber('SMF28', clad_refractive_index=1.4444, remove_cladding=False)

   boundaries = [
      Boundaries(right=BoundaryValue.SYMMETRIC, top=BoundaryValue.SYMMETRIC),
      Boundaries(right=BoundaryValue.SYMMETRIC, top=BoundaryValue.ANTI_SYMMETRIC)
   ]


   workflow = Workflow(
      fiber_list=[fiber],             # List of fiber to be added in the mesh, the order matters.
      wavelength=wavelength,          # Wavelength used for the mode computation.
      resolution=80,                  # Number of point in the x and y axis [is divided by half if symmetric or anti-symmetric boundaries].
      x_bounds=DomainAlignment.LEFT,  # Mesh x-boundary structure.
      y_bounds=DomainAlignment.BOTTOM,# Mesh y-boundary structure.
      boundaries=boundaries,          # Set of symmetries to be evaluated, each symmetry add a round of simulation
      n_sorted_mode=3,                # Total computed and sorted mode.
      n_added_mode=2,                 # Additional computed mode that are not considered later except for field comparison [the higher the better but the slower].
      plot_geometry=True,             # Plot the geometry mesh before computation.
      auto_label=True,                # Auto labeling the mode. Label are not always correct and should be verified afterwards.
      itr_final=0.05,                 # Final value of inverse taper ratio to simulate
      index_scrambling=0              # Scrambling of refractive index value in order to lift mode degeneracy [useful for some analysis]
   )

   workflow.superset.plot(plot_type='field', itr_list=[1.0, 0.1])

   workflow.superset.plot(plot_type='index')

   workflow.superset.plot(plot_type='normalized-coupling')

   workflow.superset.plot(plot_type='adiabatic')


Building from source
--------------------
For development or manual compilation, clone the repository and run:

.. code-block:: bash

   git submodule update --init
   mkdir build && cd build
   cmake ../ -G"Unix Makefiles"
   sudo make install
   cd ..
   python -m pip install .

Testing
-------
Run the unit tests with:

.. code-block:: bash

   pip install SuPyMode[testing]
   pytest

Citing SuPyMode
---------------
If you use SuPyMode in academic work, please cite:

.. code-block:: none

   @article{de2024supymode,
      title={SuPyMode: an open-source library for design and optimization of fiber optic components},
      author={de Sivry-Houle, Martin Poinsinet and Becerra Deana, Rodrigo Itzamna and Virally, St{\'e}phane and Godbout, Nicolas and Boudoux, Caroline},
      journal={Optics Continuum},
      volume={3},
      number={2},
      pages={242--255},
      year={2024},
      publisher={Optica Publishing Group}
   }

Contact
-------
For questions or contributions, contact `martin.poinsinet.de.sivry@gmail.com <mailto:martin.poinsinet.de.sivry@gmail.com>`_.

.. |python| image:: https://img.shields.io/badge/Made%20with-Python-1f425f.svg
    :alt: Python
    :target: https://www.python.org/
.. |zenodo| image:: https://zenodo.org/badge/366930899.svg
   :target: https://opg.optica.org/optcon/viewmedia.cfm?uri=optcon-3-2-242&html=true
   :alt: Scientific article
.. |colab| image:: https://colab.research.google.com/assets/colab-badge.svg
   :alt: Google Colab
   :target: https://colab.research.google.com/github/MartinPdeS/SuPyMode/blob/master/notebook.ipynb
.. |docs| image:: https://github.com/martinpdes/supymode/actions/workflows/deploy_documentation.yml/badge.svg
   :target: https://martinpdes.github.io/SuPyMode/
   :alt: Documentation Status
.. |PyPi| image:: https://badge.fury.io/py/SuPyMode.svg
   :alt: PyPI version
   :target: https://pypi.org/project/SuPyMode/
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/supymode.svg
   :alt: PyPI downloads
   :target: https://pypistats.org/packages/supymode
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/SuPyMode/python-coverage-comment-action-data/badge.svg
   :alt: Unittest coverage
   :target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/SuPyMode/blob/python-coverage-comment-action-data/htmlcov/index.html
.. |ci/cd| image:: https://github.com/martinpdes/supymode/actions/workflows/deploy_coverage.yml/badge.svg
    :alt: Unittest Status
.. |anaconda| image:: https://anaconda.org/martinpdes/supymode/badges/version.svg
    :alt: Anaconda version
    :target: https://anaconda.org/martinpdes/supymode
.. |anaconda_download| image:: https://anaconda.org/martinpdes/supymode/badges/downloads.svg
    :alt: Anaconda downloads
    :target: https://anaconda.org/martinpdes/supymode
.. |anaconda_date| image:: https://anaconda.org/martinpdes/supymode/badges/latest_release_relative_date.svg
    :alt: Latest release date
    :target: https://anaconda.org/martinpdes/supymode




