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.
Files changed (40) hide show
  1. SuPyMode/__init__.py +9 -0
  2. SuPyMode/_version.py +24 -0
  3. SuPyMode/boundaries.cp313-win_amd64.pyd +0 -0
  4. SuPyMode/directories.py +51 -0
  5. SuPyMode/eigensolver.cp313-win_amd64.pyd +0 -0
  6. SuPyMode/mesh.cp313-win_amd64.pyd +0 -0
  7. SuPyMode/model_parameters.cp313-win_amd64.pyd +0 -0
  8. SuPyMode/plotter.py +325 -0
  9. SuPyMode/propagation.py +202 -0
  10. SuPyMode/representation/__init__.py +23 -0
  11. SuPyMode/representation/adiabatic.py +111 -0
  12. SuPyMode/representation/beating_length.py +95 -0
  13. SuPyMode/representation/beta.py +78 -0
  14. SuPyMode/representation/eigen_value.py +79 -0
  15. SuPyMode/representation/field.py +486 -0
  16. SuPyMode/representation/index.py +80 -0
  17. SuPyMode/representation/normalized_coupling.py +98 -0
  18. SuPyMode/solver.py +203 -0
  19. SuPyMode/supermode.cp313-win_amd64.pyd +0 -0
  20. SuPyMode/superset.py +701 -0
  21. SuPyMode/superset_plots.py +497 -0
  22. SuPyMode/taper.cp313-win_amd64.pyd +0 -0
  23. SuPyMode/utils.py +196 -0
  24. SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP02.csv +98 -0
  25. SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP21.csv +88 -0
  26. SuPyMode/validation_data/SBB_figure_4_16_a/LP01-LP41.csv +86 -0
  27. SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP12.csv +82 -0
  28. SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP31.csv +95 -0
  29. SuPyMode/validation_data/SBB_figure_4_16_a/LP11-LP51.csv +81 -0
  30. SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP02.csv +285 -0
  31. SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP21.csv +75 -0
  32. SuPyMode/validation_data/SBB_figure_4_16_b/LP01-LP41.csv +237 -0
  33. SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP12.csv +126 -0
  34. SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP31.csv +156 -0
  35. SuPyMode/validation_data/SBB_figure_4_16_b/LP11-LP51.csv +224 -0
  36. SuPyMode/workflow.py +253 -0
  37. supymode-2.4.3.dist-info/METADATA +241 -0
  38. supymode-2.4.3.dist-info/RECORD +40 -0
  39. supymode-2.4.3.dist-info/WHEEL +5 -0
  40. supymode-2.4.3.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,111 @@
1
+ # #!/usr/bin/env python
2
+ # # -*- coding: utf-8 -*-
3
+ import numpy
4
+ import matplotlib.pyplot as plt
5
+ import matplotlib.ticker as ticker
6
+ from MPSPlots.helper import post_mpl_plot
7
+
8
+ from SuPyMode.supermode import SUPERMODE
9
+
10
+
11
+ class Adiabatic:
12
+ """
13
+ Represents the adiabatic criterion between modes of different supermodes in optical fiber simulations.
14
+
15
+ This class extends from `InheritFromSuperMode` for accessing supermode-related data and provides plotting functionalities
16
+ tailored to visualize adiabatic transition measurements.
17
+
18
+ Attributes
19
+ ----------
20
+ supermode : SUPERMODE
21
+ The parent supermode object that provides the base mode data.
22
+
23
+ """
24
+
25
+ def __init__(self, supermode: SUPERMODE):
26
+ """
27
+ Initialize an Adiabatic object with a reference to a parent supermode.
28
+
29
+ Parameters
30
+ ----------
31
+ supermode : SUPERMODE
32
+ The parent supermode object that provides the base mode data.
33
+ """
34
+ self.supermode = supermode
35
+
36
+ def get_values(self, other_supermode: SUPERMODE) -> numpy.ndarray:
37
+ """
38
+ Calculate the adiabatic transition measure between the parent supermode and another specified supermode.
39
+
40
+ Parameters
41
+ ----------
42
+ other_supermode : SUPERMODE
43
+ The supermode with which to compare the parent supermode.
44
+
45
+ Returns
46
+ -------
47
+ numpy.ndarray
48
+ An array of adiabatic transition measures calculated between the two supermodes, adjusted as needed for
49
+ computational compatibility.
50
+ """
51
+ output = self.supermode.get_adiabatic_with_mode(other_supermode)
52
+
53
+ if not self.supermode.is_computation_compatible(other_supermode):
54
+ output *= numpy.inf
55
+
56
+ return abs(output)
57
+
58
+ @post_mpl_plot
59
+ def plot(self, other_supermode: SUPERMODE, ax: plt.Axes = None) -> plt.Figure:
60
+ """
61
+ Plot the adiabatic criterion between the parent supermode and another specified supermode.
62
+ This method generates a plot of the adiabatic criterion as a function of the inverse taper ratio (ITR),
63
+ formatted according to the predefined plot style.
64
+
65
+ Parameters
66
+ ----------
67
+ other_supermode : SUPERMODE
68
+ The supermode to compare against.
69
+ ax : matplotlib.axes.Axes, optional
70
+ The axis on which to plot. If `None`, a new axis is created (default is `None`).
71
+
72
+ Returns
73
+ -------
74
+ matplotlib.figure.Figure
75
+ The figure object containing the generated plot.
76
+ """
77
+ if ax is None:
78
+ figure, ax = plt.subplots(nrows=1, ncols=1)
79
+ else:
80
+ figure = ax.figure
81
+
82
+ ax.set(
83
+ yscale="log",
84
+ xlabel="Inverse taper ratio",
85
+ ylabel=r"Adiabatic criterion [$\mu$m$^{-1}$]",
86
+ ylim=[1e-5 * 1e6, 1 * 1e6],
87
+ )
88
+
89
+ def log_scale_yaxis(value, tick_position):
90
+ return f"{value / 1e6:.0e}"
91
+
92
+ # Apply the custom formatter for log scale
93
+ ax.yaxis.set_major_formatter(ticker.FuncFormatter(log_scale_yaxis))
94
+
95
+ if not self.supermode.is_computation_compatible(other_supermode):
96
+ return
97
+
98
+ y = self.get_values(other_supermode=other_supermode)
99
+
100
+ label = f"{self.supermode.stylized_label} - {other_supermode.stylized_label}"
101
+
102
+ ax.plot(
103
+ self.supermode.model_parameters.itr_list, abs(y), label=label, linewidth=2
104
+ )
105
+
106
+ ax.legend()
107
+
108
+ return figure
109
+
110
+
111
+ # -
@@ -0,0 +1,95 @@
1
+ # #!/usr/bin/env python
2
+ # # -*- coding: utf-8 -*-
3
+
4
+ import numpy
5
+ import matplotlib.pyplot as plt
6
+ from MPSPlots.helper import post_mpl_plot
7
+
8
+ from SuPyMode.supermode import SUPERMODE
9
+
10
+
11
+ class BeatingLength:
12
+ """
13
+ Represents the beating lengths between modes of different supermodes in optical fiber simulations.
14
+
15
+ This class extends from `InheritFromSuperMode` to utilize supermode-related data and provides plotting functionalities
16
+ tailored to visualize beating length comparisons.
17
+
18
+ Attributes
19
+ ----------
20
+ supermode : SUPERMODE
21
+ The parent supermode object that provides the base mode data.
22
+ """
23
+
24
+ def __init__(self, supermode: SUPERMODE):
25
+ """
26
+ Initialize a BeatingLength object with a reference to a parent supermode.
27
+
28
+ Parameters
29
+ ----------
30
+ supermode : SUPERMODE
31
+ The parent supermode object that provides the base mode data.
32
+ """
33
+ self.supermode = supermode
34
+
35
+ def get_values(self, other_supermode: SUPERMODE) -> numpy.ndarray:
36
+ """
37
+ Calculate the beating length between the parent supermode and another specified supermode.
38
+
39
+ Parameters
40
+ ----------
41
+ other_supermode : SUPERMODE
42
+ The supermode with which to compare the parent supermode.
43
+
44
+ Returns
45
+ -------
46
+ numpy.ndarray
47
+ An array of beating lengths calculated between the two supermodes.
48
+ """
49
+ return self.supermode.get_beating_length_with_mode(other_supermode)
50
+
51
+ @post_mpl_plot
52
+ def plot(self, other_supermode: SUPERMODE, ax: plt.Axes = None) -> plt.Figure:
53
+ """
54
+ Plot the beating length between the parent supermode and another specified supermode.
55
+
56
+ This method generates a plot of the beating length as a function of the inverse taper ratio (ITR),
57
+ formatted according to the predefined plot style.
58
+
59
+ Parameters
60
+ ----------
61
+ other_supermode : SUPERMODE
62
+ The supermode to compare against.
63
+ ax : matplotlib.axes.Axes, optional
64
+ The axis on which to plot. If `None`, a new axis is created (default is `None`).
65
+
66
+ Returns
67
+ -------
68
+ matplotlib.figure.Figure
69
+ The figure object containing the generated plot.
70
+ """
71
+ if ax is None:
72
+ figure, ax = plt.subplots(nrows=1, ncols=1)
73
+ else:
74
+ figure = ax.figure
75
+
76
+ ax.set_xlabel("Inverse taper ratio")
77
+ ax.set_ylabel("Beating length [m]")
78
+
79
+ if not self.supermode.is_computation_compatible(other_supermode):
80
+ return
81
+
82
+ y = self.get_values(other_supermode=other_supermode)
83
+
84
+ label = f"{self.supermode.stylized_label} - {other_supermode.stylized_label}"
85
+
86
+ ax.plot(
87
+ self.supermode.model_parameters.itr_list, abs(y), label=label, linewidth=2
88
+ )
89
+
90
+ ax.legend()
91
+
92
+ return figure
93
+
94
+
95
+ # -
@@ -0,0 +1,78 @@
1
+ # #!/usr/bin/env python
2
+ # # -*- coding: utf-8 -*-
3
+
4
+ import matplotlib.pyplot as plt
5
+ from MPSPlots.helper import post_mpl_plot
6
+
7
+ from SuPyMode.supermode import SUPERMODE
8
+
9
+
10
+ class Beta:
11
+ """
12
+ Represents the propagation constants (beta values) of a mode derived from a supermode in optical simulations.
13
+
14
+ This class utilizes inheritance from `InheritFromSuperMode` for accessing supermode-related data and
15
+ `BaseSingleModePlot` for plotting functionalities tailored to propagation constant visualization.
16
+
17
+ Attributes
18
+ ----------
19
+ supermode : SUPERMODE
20
+ A reference to the parent supermode object from which beta data is sourced.
21
+ data : numpy.ndarray
22
+ The propagation constant (beta) data retrieved from the parent supermode binding.
23
+ """
24
+
25
+ def __init__(self, supermode: SUPERMODE):
26
+ """
27
+ Initialize a Beta object with a reference to a parent supermode.
28
+
29
+ Parameters
30
+ ----------
31
+ supermode : SUPERMODE
32
+ The parent supermode object that provides the base beta data.
33
+ """
34
+ self.supermode = supermode
35
+ self.data = self.supermode.get_betas()
36
+
37
+ @post_mpl_plot
38
+ def plot(self, ax: plt.Axes = None, show: bool = True) -> plt.Figure:
39
+ """
40
+ Plot the propagation constant for a single mode.
41
+
42
+ This method generates a plot of the propagation constants as a function of the inverse taper ratio (ITR),
43
+ formatted according to the predefined plot style.
44
+
45
+ Parameters
46
+ ----------
47
+ ax : matplotlib.axes.Axes, optional
48
+ The axis on which to plot. If `None`, a new axis is created (default is `None`).
49
+ show : bool, optional
50
+ Whether to display the plot immediately (default is `True`).
51
+
52
+ Returns
53
+ -------
54
+ matplotlib.figure.Figure
55
+ The figure object containing the generated plot.
56
+
57
+ """
58
+ if ax is None:
59
+ figure, ax = plt.subplots(1, 1)
60
+ else:
61
+ figure = ax.figure
62
+
63
+ ax.plot(
64
+ self.supermode.model_parameters.itr_list,
65
+ self.data,
66
+ label=f"{self.supermode.stylized_label}",
67
+ linewidth=2,
68
+ )
69
+
70
+ ax.legend()
71
+
72
+ ax.set_xlabel("Inverse taper ratio")
73
+ ax.set_ylabel("Propagation constant [rad/M]")
74
+
75
+ return figure
76
+
77
+
78
+ # -
@@ -0,0 +1,79 @@
1
+ # #!/usr/bin/env python
2
+ # # -*- coding: utf-8 -*-
3
+ import matplotlib.pyplot as plt
4
+ from MPSPlots.helper import post_mpl_plot
5
+
6
+ from SuPyMode.supermode import SUPERMODE
7
+
8
+
9
+ class EigenValue:
10
+ """
11
+ Represents the eigenvalues of a mode derived from a supermode in a waveguide or optical fiber simulation.
12
+
13
+ This class extends from `InheritFromSuperMode` to access supermode-related data and from `BaseSingleModePlot`
14
+ to provide plotting capabilities tailored to eigenvalue visualization.
15
+
16
+ Attributes
17
+ ----------
18
+ supermode : SUPERMODE
19
+ The parent supermode object from which eigenvalue data is derived.
20
+ data : numpy.ndarray
21
+ The eigenvalue data retrieved from the parent supermode binding.
22
+ """
23
+
24
+ def __init__(self, supermode: SUPERMODE):
25
+ """
26
+ Initialize an EigenValue object with a parent supermode reference.
27
+
28
+ Parameters
29
+ ----------
30
+ supermode : SUPERMODE
31
+ A reference to the parent supermode object that provides the base eigenvalue data.
32
+ """
33
+ self.supermode = supermode
34
+ self.data = self.supermode.get_eigen_value()
35
+
36
+ @post_mpl_plot
37
+ def plot(self, ax: plt.Axes = None, show: bool = True) -> plt.Figure:
38
+ """
39
+ Plot the propagation constant for a single mode.
40
+
41
+ This method generates a plot of the propagation constants as a function of the inverse taper ratio (ITR),
42
+ formatted according to the predefined plot style.
43
+
44
+ Parameters
45
+ ----------
46
+ ax : matplotlib.axes.Axes, optional
47
+ The axis on which to plot. If `None`, a new axis is created (default is `None`).
48
+ show : bool, optional
49
+ Whether to display the plot immediately (default is `True`).
50
+
51
+ Returns
52
+ -------
53
+ matplotlib.figure.Figure
54
+ The figure object containing the generated plot.
55
+
56
+ """
57
+ if ax is None:
58
+ figure, ax = plt.subplots(1, 1)
59
+ else:
60
+ figure = ax.figure
61
+
62
+ ax.plot(
63
+ self.supermode.model_parameters.itr_list,
64
+ self.data,
65
+ label=f"{self.supermode.stylized_label}",
66
+ linewidth=2,
67
+ )
68
+
69
+ ax.legend()
70
+
71
+ ax.set(
72
+ xlabel="Inverse taper ratio",
73
+ ylabel="Eigenvalue",
74
+ )
75
+
76
+ return figure
77
+
78
+
79
+ # -