SuPyMode 2.4.3__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- SuPyMode/__init__.py +9 -0
- SuPyMode/_version.py +24 -0
- SuPyMode/boundaries.cp313-win_amd64.pyd +0 -0
- SuPyMode/directories.py +51 -0
- SuPyMode/eigensolver.cp313-win_amd64.pyd +0 -0
- SuPyMode/mesh.cp313-win_amd64.pyd +0 -0
- SuPyMode/model_parameters.cp313-win_amd64.pyd +0 -0
- SuPyMode/plotter.py +325 -0
- SuPyMode/propagation.py +202 -0
- SuPyMode/representation/__init__.py +23 -0
- SuPyMode/representation/adiabatic.py +111 -0
- SuPyMode/representation/beating_length.py +95 -0
- SuPyMode/representation/beta.py +78 -0
- SuPyMode/representation/eigen_value.py +79 -0
- SuPyMode/representation/field.py +486 -0
- SuPyMode/representation/index.py +80 -0
- SuPyMode/representation/normalized_coupling.py +98 -0
- SuPyMode/solver.py +203 -0
- SuPyMode/supermode.cp313-win_amd64.pyd +0 -0
- SuPyMode/superset.py +701 -0
- SuPyMode/superset_plots.py +497 -0
- SuPyMode/taper.cp313-win_amd64.pyd +0 -0
- SuPyMode/utils.py +196 -0
- SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP02.csv +98 -0
- SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP21.csv +88 -0
- SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP41.csv +86 -0
- SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP12.csv +82 -0
- SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP31.csv +95 -0
- SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP51.csv +81 -0
- SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP02.csv +285 -0
- SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP21.csv +75 -0
- SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP41.csv +237 -0
- SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP12.csv +126 -0
- SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP31.csv +156 -0
- SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP51.csv +224 -0
- SuPyMode/workflow.py +253 -0
- supymode-2.4.3.dist-info/METADATA +241 -0
- supymode-2.4.3.dist-info/RECORD +40 -0
- supymode-2.4.3.dist-info/WHEEL +5 -0
- supymode-2.4.3.dist-info/licenses/LICENSE +21 -0
SuPyMode/workflow.py
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
from FiberFusing.fiber import FiberLoader
|
|
5
|
+
from FiberFusing.profile import Profile, StructureType # noqa: F401
|
|
6
|
+
from FiberFusing.graded_index import GradedIndex # noqa: F401
|
|
7
|
+
from PyFinitDiff import BoundaryValue # noqa: F401
|
|
8
|
+
from SuPyMode.taper import AlphaProfile # noqa: F401
|
|
9
|
+
|
|
10
|
+
from FiberFusing import DomainAlignment
|
|
11
|
+
from typing import List, Union, Optional, Tuple
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from FiberFusing import Geometry, BackGround
|
|
14
|
+
from FiberFusing.fiber.generic_fiber import GenericFiber
|
|
15
|
+
from SuPyMode.solver import SuPySolver
|
|
16
|
+
from PyFinitDiff.finite_difference_2D import Boundaries
|
|
17
|
+
from pydantic.dataclasses import dataclass
|
|
18
|
+
from pydantic import ConfigDict
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
fiber_loader = FiberLoader()
|
|
22
|
+
|
|
23
|
+
config_dict = ConfigDict(
|
|
24
|
+
extra="forbid",
|
|
25
|
+
strict=True,
|
|
26
|
+
arbitrary_types_allowed=True,
|
|
27
|
+
kw_only=True,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(config=config_dict)
|
|
32
|
+
class Workflow:
|
|
33
|
+
"""
|
|
34
|
+
Configures and executes optical simulations using finite difference methods on specified fiber geometries.
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
wavelength : float
|
|
39
|
+
Wavelength at which the simulation is evaluated.
|
|
40
|
+
resolution : int
|
|
41
|
+
Resolution of the simulation mesh.
|
|
42
|
+
n_sorted_mode : int
|
|
43
|
+
Number of modes that are computed and sorted.
|
|
44
|
+
n_added_mode : int
|
|
45
|
+
Additional modes computed beyond the sorted modes for increased accuracy.
|
|
46
|
+
itr_final : float
|
|
47
|
+
Final Inverse Taper Ratio (ITR) for mode evaluation.
|
|
48
|
+
itr_initial : float
|
|
49
|
+
Initial ITR for mode evaluation.
|
|
50
|
+
n_step : int
|
|
51
|
+
Number of steps to iterate through the ITR section.
|
|
52
|
+
clad_rotation : float
|
|
53
|
+
Rotation of the clad structure in degrees.
|
|
54
|
+
accuracy : int
|
|
55
|
+
Accuracy level of the finite difference method.
|
|
56
|
+
debug_mode : int
|
|
57
|
+
Debug mode level for verbose output during computations.
|
|
58
|
+
auto_label : bool
|
|
59
|
+
If True, automatically labels supermodes.
|
|
60
|
+
generate_report : bool
|
|
61
|
+
If True, generates a PDF report of the simulation results.
|
|
62
|
+
save_superset : bool
|
|
63
|
+
If True, saves the computed superset instance for later use.
|
|
64
|
+
fiber_list : List[GenericFiber])
|
|
65
|
+
List of fibers included in the optical structure.
|
|
66
|
+
boundaries : List[Boundaries]
|
|
67
|
+
Boundary conditions applied to the simulation.
|
|
68
|
+
capillary_tube : Optional[object]
|
|
69
|
+
Additional capillary structure to include in the simulation.
|
|
70
|
+
clad_structure : Optional[object]
|
|
71
|
+
Initial optical structure used for the simulation.
|
|
72
|
+
x_bounds : Union[DomainAlignment, List[float]])
|
|
73
|
+
Boundary conditions along the x-axis.
|
|
74
|
+
y_bounds : Union[DomainAlignment, List[float]])
|
|
75
|
+
Boundary conditions along the y-axis.
|
|
76
|
+
air_padding_factor : float
|
|
77
|
+
Factor for padding the structure with air to prevent boundary effects.
|
|
78
|
+
gaussian_filter_factor : Optional[float]
|
|
79
|
+
Gaussian blurring factor applied to the structure for smoothing.
|
|
80
|
+
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
# Geometry attributes
|
|
84
|
+
wavelength: float
|
|
85
|
+
boundaries: List[Boundaries]
|
|
86
|
+
resolution: int
|
|
87
|
+
clad_rotation: Optional[float] = 0
|
|
88
|
+
capillary_tube: Optional[object] = None
|
|
89
|
+
clad_structure: Optional[object] = None
|
|
90
|
+
background_index: Optional[float] = 1.0
|
|
91
|
+
fiber_list: Optional[List[GenericFiber]] = ()
|
|
92
|
+
x_bounds: Union[DomainAlignment, Tuple[float, float]] = DomainAlignment.CENTERING
|
|
93
|
+
y_bounds: Union[DomainAlignment, Tuple[float, float]] = DomainAlignment.CENTERING
|
|
94
|
+
air_padding_factor: Optional[float] = 1.2
|
|
95
|
+
gaussian_filter_factor: Optional[float] = None
|
|
96
|
+
|
|
97
|
+
# Solver attributes
|
|
98
|
+
n_sorted_mode: int = 4
|
|
99
|
+
n_step: int = 500
|
|
100
|
+
itr_final: float = 0.05
|
|
101
|
+
n_added_mode: Optional[int] = 4
|
|
102
|
+
itr_initial: Optional[float] = 1.0
|
|
103
|
+
extrapolation_order: Optional[int] = 2
|
|
104
|
+
core_position_scrambling: Optional[float] = 0
|
|
105
|
+
index_scrambling: Optional[float] = 0.0
|
|
106
|
+
accuracy: Optional[int] = 2
|
|
107
|
+
|
|
108
|
+
# Extra attributes
|
|
109
|
+
debug_mode: Optional[int] = 1
|
|
110
|
+
auto_label: Optional[bool] = False
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def superset(self):
|
|
114
|
+
return self.solver.superset
|
|
115
|
+
|
|
116
|
+
def run_solver(self):
|
|
117
|
+
"""Initializes the solver with the set geometry and starts the mode computation process."""
|
|
118
|
+
self.solver = SuPySolver(
|
|
119
|
+
mesh=self.geometry.mesh,
|
|
120
|
+
x=self.geometry.coordinate_system.x_vector,
|
|
121
|
+
y=self.geometry.coordinate_system.y_vector,
|
|
122
|
+
tolerance=1e-20,
|
|
123
|
+
max_iteration=5000,
|
|
124
|
+
accuracy=self.accuracy,
|
|
125
|
+
debug_mode=self.debug_mode,
|
|
126
|
+
extrapolation_order=self.extrapolation_order,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
self.solver.init_superset(
|
|
130
|
+
wavelength=self.wavelength,
|
|
131
|
+
n_step=self.n_step,
|
|
132
|
+
itr_initial=self.itr_initial,
|
|
133
|
+
itr_final=self.itr_final,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
for boundary in self.boundaries:
|
|
137
|
+
self.solver.add_modes(
|
|
138
|
+
n_added_mode=self.n_added_mode,
|
|
139
|
+
n_sorted_mode=self.n_sorted_mode,
|
|
140
|
+
boundaries=boundary,
|
|
141
|
+
auto_label=self.auto_label,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
def plot(self, *args, **kwargs):
|
|
145
|
+
"""Plots various types of data from the simulation based on the specified plot type."""
|
|
146
|
+
return self.solver.superset.plot(*args, **kwargs)
|
|
147
|
+
|
|
148
|
+
def save_superset_instance(
|
|
149
|
+
self, filename: str = "auto", directory: str = "auto"
|
|
150
|
+
) -> Path:
|
|
151
|
+
"""
|
|
152
|
+
Saves the superset instance to a file, defaulting to an auto-generated filename if not specified.
|
|
153
|
+
|
|
154
|
+
Parameters
|
|
155
|
+
----------
|
|
156
|
+
filename : str
|
|
157
|
+
The name of the file to save the report as. Defaults to 'auto', which generates a timestamped filename.
|
|
158
|
+
directory : str
|
|
159
|
+
The directory where the report will be saved. Defaults to 'auto', which uses the current
|
|
160
|
+
|
|
161
|
+
Returns
|
|
162
|
+
-------
|
|
163
|
+
Path: Path to the saved file.
|
|
164
|
+
"""
|
|
165
|
+
self.solver.superset.save_instance(filename=filename, directory=directory)
|
|
166
|
+
|
|
167
|
+
return filename
|
|
168
|
+
|
|
169
|
+
def generate_pdf_report(
|
|
170
|
+
self, filename: str = "auto", directory: str = "auto", **kwargs
|
|
171
|
+
) -> Path:
|
|
172
|
+
"""
|
|
173
|
+
Generates a PDF report of all relevant simulation data and results.
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
filename : str
|
|
178
|
+
The name of the file to save the report as. Defaults to 'auto', which generates a timestamped filename.
|
|
179
|
+
directory : str
|
|
180
|
+
The directory where the report will be saved. Defaults to 'auto', which uses the current
|
|
181
|
+
|
|
182
|
+
Returns
|
|
183
|
+
-------
|
|
184
|
+
Path: Path to the generated PDF report.
|
|
185
|
+
"""
|
|
186
|
+
self.solver.superset.generate_pdf_report(
|
|
187
|
+
filename=filename, directory=directory, **kwargs
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
return filename
|
|
191
|
+
|
|
192
|
+
def initialize_geometry(self, plot: bool = False) -> Geometry:
|
|
193
|
+
"""
|
|
194
|
+
Prepares and returns the simulation geometry for optical fiber configurations,
|
|
195
|
+
incorporating fused structures, optional capillary tubes, and specific boundary conditions.
|
|
196
|
+
|
|
197
|
+
Parameters
|
|
198
|
+
----------
|
|
199
|
+
plot_geometry : bool
|
|
200
|
+
Flag indicating whether to plot the geometry after initialization.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
Geometry: Configured geometry object ready for simulation.
|
|
205
|
+
"""
|
|
206
|
+
background = BackGround(refractive_index=self.background_index)
|
|
207
|
+
|
|
208
|
+
self.prepare_fused_structure()
|
|
209
|
+
|
|
210
|
+
structures = []
|
|
211
|
+
if self.capillary_tube is not None:
|
|
212
|
+
structures.append(self.capillary_tube)
|
|
213
|
+
if self.clad_structure is not None:
|
|
214
|
+
structures.append(self.clad_structure)
|
|
215
|
+
|
|
216
|
+
if self.index_scrambling != 0.0:
|
|
217
|
+
for fiber in self.fiber_list:
|
|
218
|
+
fiber.randomize_refractive_index(factor=self.index_scrambling)
|
|
219
|
+
|
|
220
|
+
structures.extend(self.fiber_list)
|
|
221
|
+
|
|
222
|
+
self.geometry = Geometry(
|
|
223
|
+
x_bounds=self.x_bounds,
|
|
224
|
+
y_bounds=self.y_bounds,
|
|
225
|
+
resolution=self.resolution,
|
|
226
|
+
index_scrambling=self.index_scrambling,
|
|
227
|
+
boundary_pad_factor=self.air_padding_factor,
|
|
228
|
+
gaussian_filter=self.gaussian_filter_factor,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
self.geometry.add_structure(background, *structures)
|
|
232
|
+
|
|
233
|
+
self.geometry.initialize()
|
|
234
|
+
|
|
235
|
+
if plot:
|
|
236
|
+
self.geometry.plot()
|
|
237
|
+
|
|
238
|
+
def prepare_fused_structure(self) -> None:
|
|
239
|
+
"""
|
|
240
|
+
Prepares and returns a clad instance according to the provided clad class and configuration parameters.
|
|
241
|
+
"""
|
|
242
|
+
if self.clad_structure is None:
|
|
243
|
+
return
|
|
244
|
+
|
|
245
|
+
self.clad_structure.randomize_core_positions(
|
|
246
|
+
random_factor=self.core_position_scrambling
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
if self.clad_rotation != 0:
|
|
250
|
+
self.clad_structure.rotate(self.clad_rotation)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# -
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: SuPyMode
|
|
3
|
+
Version: 2.4.3
|
|
4
|
+
Summary: A package for light propagation in fiber optics.
|
|
5
|
+
Keywords: coupled-mode theory,waveguide
|
|
6
|
+
Author-Email: Martin Poinsinet de Sivry-Houle <martin.poinsinet.de.sivry@gmail.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2020 Martin de Sivry
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Classifier: Programming Language :: Python
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
35
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
36
|
+
Classifier: Development Status :: 4 - Beta
|
|
37
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
38
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
39
|
+
Classifier: Intended Audience :: Science/Research
|
|
40
|
+
Project-URL: Homepage, https://github.com/MartinPdeS/SuPyMode
|
|
41
|
+
Project-URL: Repository, https://github.com/MartinPdeS/SuPyMode
|
|
42
|
+
Project-URL: Issues, https://github.com/MartinPdeS/SuPyMode/issues
|
|
43
|
+
Project-URL: Documentation, https://martinpdes.github.io/SuPyMode/
|
|
44
|
+
Requires-Python: >=3.11
|
|
45
|
+
Requires-Dist: setuptools_scm[toml]>=8.0
|
|
46
|
+
Requires-Dist: numpy>=2.0.0
|
|
47
|
+
Requires-Dist: MPSPlots
|
|
48
|
+
Requires-Dist: pydantic
|
|
49
|
+
Requires-Dist: PyFinitDiff
|
|
50
|
+
Requires-Dist: FiberFusing
|
|
51
|
+
Requires-Dist: pyvista
|
|
52
|
+
Requires-Dist: PyFiberModes<0.17
|
|
53
|
+
Requires-Dist: pathvalidate
|
|
54
|
+
Provides-Extra: testing
|
|
55
|
+
Requires-Dist: pytest>=0.6; extra == "testing"
|
|
56
|
+
Requires-Dist: pytest-cov>=2.0; extra == "testing"
|
|
57
|
+
Requires-Dist: pytest-json-report==1.5.0; extra == "testing"
|
|
58
|
+
Requires-Dist: coverage==7.16.2; extra == "testing"
|
|
59
|
+
Provides-Extra: documentation
|
|
60
|
+
Requires-Dist: PyFiberModes; extra == "documentation"
|
|
61
|
+
Requires-Dist: PyOptik; extra == "documentation"
|
|
62
|
+
Requires-Dist: numpydoc==1.11.0; extra == "documentation"
|
|
63
|
+
Requires-Dist: sphinx>=5.1.1; extra == "documentation"
|
|
64
|
+
Requires-Dist: sphinx-rtd-theme==3.1.0; extra == "documentation"
|
|
65
|
+
Requires-Dist: sphinx-gallery==0.22.1; extra == "documentation"
|
|
66
|
+
Requires-Dist: sphinx_design==0.7.0; extra == "documentation"
|
|
67
|
+
Requires-Dist: pydata-sphinx-theme==0.23.0; extra == "documentation"
|
|
68
|
+
Provides-Extra: dev
|
|
69
|
+
Requires-Dist: ruff<1,>=0.8; extra == "dev"
|
|
70
|
+
Description-Content-Type: text/x-rst
|
|
71
|
+
|
|
72
|
+
.. figure:: https://github.com/MartinPdeS/SuPyMode/blob/master/docs/images/mode_propagation.gif?raw=true
|
|
73
|
+
:alt: Propagation of mode in an adiabatic 2x1 modally-specific photonic lantern.
|
|
74
|
+
:class: with-shadow float-left
|
|
75
|
+
:width: 800px
|
|
76
|
+
|
|
77
|
+
.. list-table::
|
|
78
|
+
:widths: 10 25 25 25
|
|
79
|
+
:header-rows: 0
|
|
80
|
+
|
|
81
|
+
* - Meta
|
|
82
|
+
- |python|
|
|
83
|
+
- |docs|
|
|
84
|
+
- |zenodo|
|
|
85
|
+
* - Testing
|
|
86
|
+
- |ci/cd|
|
|
87
|
+
- |coverage|
|
|
88
|
+
- |colab|
|
|
89
|
+
* - PyPI
|
|
90
|
+
- |PyPI|
|
|
91
|
+
- |PyPI_download|
|
|
92
|
+
-
|
|
93
|
+
* - Anaconda
|
|
94
|
+
- |anaconda|
|
|
95
|
+
- |anaconda_download|
|
|
96
|
+
- |anaconda_date|
|
|
97
|
+
|
|
98
|
+
SuPyMode
|
|
99
|
+
========
|
|
100
|
+
|
|
101
|
+
This project aims to develop an useful tool design and optimize fiber optic tapered component.
|
|
102
|
+
SuPyMode is a Python library linked to a c++ core allowing for a flexible interface and fast computing core.
|
|
103
|
+
The library also aims to offer the end-user a great vizual tools for data analysis.
|
|
104
|
+
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.
|
|
105
|
+
|
|
106
|
+
Features
|
|
107
|
+
--------
|
|
108
|
+
- Fast and efficient simulation of fiber optic tapered components.
|
|
109
|
+
- User-friendly interface for easy integration into existing workflows.
|
|
110
|
+
- Comprehensive visualization tools for data analysis and interpretation.
|
|
111
|
+
|
|
112
|
+
Installation
|
|
113
|
+
------------
|
|
114
|
+
**SuPyMode** is available on PyPI and Anaconda. Install it with:
|
|
115
|
+
|
|
116
|
+
.. code-block:: bash
|
|
117
|
+
|
|
118
|
+
pip install SuPyMode
|
|
119
|
+
conda install SuPyMode
|
|
120
|
+
|
|
121
|
+
See the `online documentation <https://martinpdes.github.io/SuPyMode/>`_ for detailed
|
|
122
|
+
usage and additional examples.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
Quick example
|
|
126
|
+
-------------
|
|
127
|
+
Below is a short example computing the mode propgation in a simple fiber.
|
|
128
|
+
|
|
129
|
+
.. code-block:: python
|
|
130
|
+
|
|
131
|
+
from SuPyMode.workflow import Workflow, fiber_loader, Boundaries, BoundaryValue, DomainAlignment
|
|
132
|
+
|
|
133
|
+
wavelength = 1550e-9
|
|
134
|
+
|
|
135
|
+
fiber = fiber_loader.load_fiber('SMF28', clad_refractive_index=1.4444, remove_cladding=False)
|
|
136
|
+
|
|
137
|
+
boundaries = [
|
|
138
|
+
Boundaries(right=BoundaryValue.SYMMETRIC, top=BoundaryValue.SYMMETRIC),
|
|
139
|
+
Boundaries(right=BoundaryValue.SYMMETRIC, top=BoundaryValue.ANTI_SYMMETRIC)
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
workflow = Workflow(
|
|
144
|
+
fiber_list=[fiber], # List of fiber to be added in the mesh, the order matters.
|
|
145
|
+
wavelength=wavelength, # Wavelength used for the mode computation.
|
|
146
|
+
resolution=80, # Number of point in the x and y axis [is divided by half if symmetric or anti-symmetric boundaries].
|
|
147
|
+
x_bounds=DomainAlignment.LEFT, # Mesh x-boundary structure.
|
|
148
|
+
y_bounds=DomainAlignment.BOTTOM,# Mesh y-boundary structure.
|
|
149
|
+
boundaries=boundaries, # Set of symmetries to be evaluated, each symmetry add a round of simulation
|
|
150
|
+
n_sorted_mode=3, # Total computed and sorted mode.
|
|
151
|
+
n_added_mode=2, # Additional computed mode that are not considered later except for field comparison [the higher the better but the slower].
|
|
152
|
+
plot_geometry=True, # Plot the geometry mesh before computation.
|
|
153
|
+
auto_label=True, # Auto labeling the mode. Label are not always correct and should be verified afterwards.
|
|
154
|
+
itr_final=0.05, # Final value of inverse taper ratio to simulate
|
|
155
|
+
index_scrambling=0 # Scrambling of refractive index value in order to lift mode degeneracy [useful for some analysis]
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
workflow.superset.plot(plot_type='field', itr_list=[1.0, 0.1])
|
|
159
|
+
|
|
160
|
+
workflow.superset.plot(plot_type='index')
|
|
161
|
+
|
|
162
|
+
workflow.superset.plot(plot_type='normalized-coupling')
|
|
163
|
+
|
|
164
|
+
workflow.superset.plot(plot_type='adiabatic')
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
Building from source
|
|
168
|
+
--------------------
|
|
169
|
+
For development or manual compilation, clone the repository and run:
|
|
170
|
+
|
|
171
|
+
.. code-block:: bash
|
|
172
|
+
|
|
173
|
+
git submodule update --init
|
|
174
|
+
mkdir build && cd build
|
|
175
|
+
cmake ../ -G"Unix Makefiles"
|
|
176
|
+
sudo make install
|
|
177
|
+
cd ..
|
|
178
|
+
python -m pip install .
|
|
179
|
+
|
|
180
|
+
Testing
|
|
181
|
+
-------
|
|
182
|
+
Run the unit tests with:
|
|
183
|
+
|
|
184
|
+
.. code-block:: bash
|
|
185
|
+
|
|
186
|
+
pip install SuPyMode[testing]
|
|
187
|
+
pytest
|
|
188
|
+
|
|
189
|
+
Citing SuPyMode
|
|
190
|
+
---------------
|
|
191
|
+
If you use SuPyMode in academic work, please cite:
|
|
192
|
+
|
|
193
|
+
.. code-block:: none
|
|
194
|
+
|
|
195
|
+
@article{de2024supymode,
|
|
196
|
+
title={SuPyMode: an open-source library for design and optimization of fiber optic components},
|
|
197
|
+
author={de Sivry-Houle, Martin Poinsinet and Becerra Deana, Rodrigo Itzamna and Virally, St{\'e}phane and Godbout, Nicolas and Boudoux, Caroline},
|
|
198
|
+
journal={Optics Continuum},
|
|
199
|
+
volume={3},
|
|
200
|
+
number={2},
|
|
201
|
+
pages={242--255},
|
|
202
|
+
year={2024},
|
|
203
|
+
publisher={Optica Publishing Group}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
Contact
|
|
207
|
+
-------
|
|
208
|
+
For questions or contributions, contact `martin.poinsinet.de.sivry@gmail.com <mailto:martin.poinsinet.de.sivry@gmail.com>`_.
|
|
209
|
+
|
|
210
|
+
.. |python| image:: https://img.shields.io/badge/Made%20with-Python-1f425f.svg
|
|
211
|
+
:alt: Python
|
|
212
|
+
:target: https://www.python.org/
|
|
213
|
+
.. |zenodo| image:: https://zenodo.org/badge/366930899.svg
|
|
214
|
+
:target: https://opg.optica.org/optcon/viewmedia.cfm?uri=optcon-3-2-242&html=true
|
|
215
|
+
:alt: Scientific article
|
|
216
|
+
.. |colab| image:: https://colab.research.google.com/assets/colab-badge.svg
|
|
217
|
+
:alt: Google Colab
|
|
218
|
+
:target: https://colab.research.google.com/github/MartinPdeS/SuPyMode/blob/master/notebook.ipynb
|
|
219
|
+
.. |docs| image:: https://github.com/martinpdes/supymode/actions/workflows/deploy_documentation.yml/badge.svg
|
|
220
|
+
:target: https://martinpdes.github.io/SuPyMode/
|
|
221
|
+
:alt: Documentation Status
|
|
222
|
+
.. |PyPi| image:: https://badge.fury.io/py/SuPyMode.svg
|
|
223
|
+
:alt: PyPI version
|
|
224
|
+
:target: https://pypi.org/project/SuPyMode/
|
|
225
|
+
.. |PyPi_download| image:: https://img.shields.io/pypi/dm/supymode.svg
|
|
226
|
+
:alt: PyPI downloads
|
|
227
|
+
:target: https://pypistats.org/packages/supymode
|
|
228
|
+
.. |coverage| image:: https://raw.githubusercontent.com/MartinPdeS/SuPyMode/python-coverage-comment-action-data/badge.svg
|
|
229
|
+
:alt: Unittest coverage
|
|
230
|
+
:target: https://htmlpreview.github.io/?https://github.com/MartinPdeS/SuPyMode/blob/python-coverage-comment-action-data/htmlcov/index.html
|
|
231
|
+
.. |ci/cd| image:: https://github.com/martinpdes/supymode/actions/workflows/deploy_coverage.yml/badge.svg
|
|
232
|
+
:alt: Unittest Status
|
|
233
|
+
.. |anaconda| image:: https://anaconda.org/martinpdes/supymode/badges/version.svg
|
|
234
|
+
:alt: Anaconda version
|
|
235
|
+
:target: https://anaconda.org/martinpdes/supymode
|
|
236
|
+
.. |anaconda_download| image:: https://anaconda.org/martinpdes/supymode/badges/downloads.svg
|
|
237
|
+
:alt: Anaconda downloads
|
|
238
|
+
:target: https://anaconda.org/martinpdes/supymode
|
|
239
|
+
.. |anaconda_date| image:: https://anaconda.org/martinpdes/supymode/badges/latest_release_relative_date.svg
|
|
240
|
+
:alt: Latest release date
|
|
241
|
+
:target: https://anaconda.org/martinpdes/supymode
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
SuPyMode/__init__.py,sha256=4M4dscJIrtHTnX8506v68jFCgKR_8puLuJyAOURH3XA,183
|
|
2
|
+
SuPyMode/_version.py,sha256=vNrDj4Nagv7VnqJcEzqQ2Zv92eTeDkpVn9YSI7PE9Io,544
|
|
3
|
+
SuPyMode/boundaries.cp313-win_amd64.pyd,sha256=pUwdcp4NDHyMMPKSuQn9mCD7funTgnULxHDzYFC2xmI,700928
|
|
4
|
+
SuPyMode/directories.py,sha256=c08BOrY6zXaUovoGZH5cdanM2RV7o_xXfaCep3BkRZg,1130
|
|
5
|
+
SuPyMode/eigensolver.cp313-win_amd64.pyd,sha256=eNfiy8pp0Vc5Y1mloYSOAlOjNYqv9t_eFWQbDVkCRzs,2031104
|
|
6
|
+
SuPyMode/mesh.cp313-win_amd64.pyd,sha256=d3ZVNF45lIB1peQaTTDkX1P5x6Mg5g1GdQ9kfeUIGEM,729088
|
|
7
|
+
SuPyMode/model_parameters.cp313-win_amd64.pyd,sha256=TqTswIA1L6GwLAxyq6-EdyGh29jAraa4gDBlzX8b-dY,1485824
|
|
8
|
+
SuPyMode/plotter.py,sha256=V_C0MBOznuxoL-pwSxha9zgIOEQUXoyU5P5HhltBKwk,10199
|
|
9
|
+
SuPyMode/propagation.py,sha256=DKskw8tVhqKyVtd9v01J8Fi0JEEhbphR9WrWF58kQzo,6406
|
|
10
|
+
SuPyMode/representation/__init__.py,sha256=QSBH32r_pKT7dI7_mdWxSx2OOEIQJDzT9P5qKKUb64M,400
|
|
11
|
+
SuPyMode/representation/adiabatic.py,sha256=iCdTVZnVQRHyuIXnjHpCuQYVIrjMt1D5-oxCqd48FtE,3612
|
|
12
|
+
SuPyMode/representation/beating_length.py,sha256=UUs7J-mJTumUegGhNx-iJI8xIes5dsk6cYIMB97kPmg,2997
|
|
13
|
+
SuPyMode/representation/beta.py,sha256=7r_vqS7CI3NfirqTZ7Hr_ptMO5J8oXuFY2mLKbyknA0,2423
|
|
14
|
+
SuPyMode/representation/eigen_value.py,sha256=KmSfKbfh0xveHAsQRPk0Xh9eeN0D5r6ePY6fbFVgnbI,2412
|
|
15
|
+
SuPyMode/representation/field.py,sha256=K5n_FujJfl83mkRqFMdkBZ4JTEAPxyLByDEmFvDmSMg,16165
|
|
16
|
+
SuPyMode/representation/index.py,sha256=E5VOy8cnKNJT030tIVDotrlBoRE3xaB_E-3KwqnBavk,2454
|
|
17
|
+
SuPyMode/representation/normalized_coupling.py,sha256=jvdHoA51od6Attw82gzr9LoRlUCfD41k4cDdxj-IiTA,3103
|
|
18
|
+
SuPyMode/solver.py,sha256=DdUOly3uWx0hdKNcFJIESc9EKKUJgu-JPykrW6q7wCI,6963
|
|
19
|
+
SuPyMode/supermode.cp313-win_amd64.pyd,sha256=IfSjGsPOa9ZbrSuqkZHORMDeEzV-PK92I2V_dW-znb8,832000
|
|
20
|
+
SuPyMode/superset.py,sha256=m8ZiNDblCyjz_zkKaSwxVHBNIhMKM-n-ne4IvFGMAkQ,22991
|
|
21
|
+
SuPyMode/superset_plots.py,sha256=VoCVvZIP_m2p2s0IYxNd6PR7prMpI6I9VgwWeo9dc9A,17621
|
|
22
|
+
SuPyMode/taper.cp313-win_amd64.pyd,sha256=Dj1ZAmv4mv-oNz1M095xAC_9hlkGy7N9fLgLJCK1Whs,807936
|
|
23
|
+
SuPyMode/utils.py,sha256=jzC99HiNVXYuwEOuQlksRhr7_wPBA-Bdd1GXP5pdLp4,7319
|
|
24
|
+
SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP02.csv,sha256=j0ybGVc3SmFcwrsK8MGyW1TY0QHRuXaNoiSNEQUbmYY,4073
|
|
25
|
+
SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP21.csv,sha256=E6AshwC1Fu87mg2e9TkLC4-HZUmWSqha7Ext-TiVh7s,3640
|
|
26
|
+
SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP41.csv,sha256=E9DXjgBQTUKnOP_DbUq2iwZy_lzD6MamUQR5MLWkYD8,3552
|
|
27
|
+
SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP12.csv,sha256=ra1S20zmBTXZ8HU0SqRR_Ms_5fhPNCppTRA2mEz-vXo,3435
|
|
28
|
+
SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP31.csv,sha256=KlOx0xrVh02eklLTjxSvJe6NBv4Qjopm85J9GSJTVDk,3871
|
|
29
|
+
SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP51.csv,sha256=EZ1sv0B5--UCImPpknu669oyKtPNLUJTuNfG_h7KpIc,3351
|
|
30
|
+
SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP02.csv,sha256=dVTY2BJANQL8IOV_VHOclnDoSQpCJTJklBfh8SQS1s8,11801
|
|
31
|
+
SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP21.csv,sha256=oOWGCwlufEzh2CsJz4z2HIhP8O2IX7L04LkHXXlWDig,3180
|
|
32
|
+
SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP41.csv,sha256=YiLbzJqQ-kwEQc2Xq_XMqdYpXyV6AREh4tKFM4KNFKQ,9766
|
|
33
|
+
SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP12.csv,sha256=f1EgCIevVz9dggpXWIZBVj15KiGdeVnbGXAGjUQi8ts,5278
|
|
34
|
+
SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP31.csv,sha256=VvIhe6OE5OfHbTuc30yUPoyzWB7B5hRk1IgnwAfTgkc,6584
|
|
35
|
+
SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP51.csv,sha256=eRUF3mav8mN9wmV-sSLC6yh-jK4eSVhW39-hvd1cPig,9280
|
|
36
|
+
SuPyMode/workflow.py,sha256=x13EGeDhDwohN8KIuiE25xELdfsEd5e8E_7ctt-1UeA,8937
|
|
37
|
+
supymode-2.4.3.dist-info/METADATA,sha256=VyteOMqLlm1AdyzesSWhUXWQaWWKPIV-rEfqC4MSB-8,10027
|
|
38
|
+
supymode-2.4.3.dist-info/WHEEL,sha256=sq6LgldFBnjvRzPumpzyb8wN76iXDClJOEXkoK-XWzE,105
|
|
39
|
+
supymode-2.4.3.dist-info/licenses/LICENSE,sha256=_Xcqg6btgIHBE66SoLrThK_k6I8az305mCNRWdWThVE,1093
|
|
40
|
+
supymode-2.4.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Martin de Sivry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|