@@ -49,56 +49,65 @@ def PlotIndex(self, Scene, Col, Row):
4949 x = self .ITRList ,
5050 y = supermode .Index ,
5151 Fill = False ,
52- Legend = supermode .ModeNumber ,
52+ Legend = supermode .Name ,
5353 xLabel = r'ITR' ,
5454 yLabel = r'Effective refractive index n$_{eff}$' )
5555
5656 Scene .SetAxes (Col , Row , Equal = False , Legend = True , yLimits = [self .Geometry .MinIndex / 1.005 , self .Geometry .MaxIndex ], LegendTitle = 'Mode' )
5757
5858
59- def PlotBeta (self , Scene , Col , Row ):
59+ def PlotBetas (self , Scene , Col , Row ):
6060 for supermode in self .SuperModes :
6161 Scene .AddLine (Row = Row ,
6262 Col = Col ,
6363 x = self .ITRList ,
6464 y = supermode .Betas ,
6565 Fill = False ,
66- Legend = supermode .ModeNumber ,
66+ Legend = supermode .Name ,
6767 xLabel = r'ITR' ,
6868 yLabel = r'Propagation constante $\beta$' )
6969
7070 Scene .SetAxes (Col , Row , Equal = False , Legend = True , LegendTitle = 'Mode' )
7171
7272
73- def PlotCoupling (self , Scene , Col , Row , Combination ):
74- for supermode in self .SuperModes :
75- print (supermode .Adiabatic .shape )
76- Coupling = supermode .Coupling .T
77- Scene .AddLine (Row = Row ,
78- Col = Col ,
79- x = self .ITRList ,
80- y = Mode0 .Adiabatic [:, Mode1 .ModeNumber ],
81- Fill = False ,
82- Legend = f'{ Mode0 .ModeNumber } - { Mode1 .ModeNumber } ' ,
83- xLabel = r'ITR' ,
84- yLabel = r'Mode coupling' )
73+ def PlotCoupling (self , Scene , Col , Row ):
74+ Done = []
75+ for Mode0 in self .SuperModes :
76+ for Mode1 in self .SuperModes :
77+ ID = (Mode0 .ID , Mode1 .ID )
78+ if ID in Done or ID [::- 1 ] in Done or ID [0 ]== ID [1 ] or ID [0 ][0 ] != ID [1 ][0 ]: continue
8579
86- Scene .SetAxes (Col , Row , Equal = False , Legend = True , LegendTitle = 'Mode' )
80+ Scene .AddLine (Row = Row ,
81+ Col = Col ,
82+ x = self .ITRList ,
83+ y = Mode0 .Coupling [:, ID [1 ][1 ]],
84+ Fill = False ,
85+ Legend = f'{ Mode0 .Name } - { Mode1 .Name } ' ,
86+ xLabel = r'ITR' ,
87+ yLabel = r'Coupling factor' )
8788
89+ Scene .SetAxes (Col , Row , Equal = False , Legend = True , yScale = 'log' , yLimits = [1e-8 , 1e-1 ], LegendTitle = 'Mode' )
90+ Done .append (ID )
8891
89- def PlotAdiabatic (self , Scene , Col , Row , Combination ):
9092
91- for (Mode0 , Mode1 ) in Combination :
92- Scene .AddLine (Row = Row ,
93- Col = Col ,
94- x = self .ITRList ,
95- y = Mode0 .Adiabatic [:, Mode1 .ModeNumber ],
96- Fill = False ,
97- Legend = f'{ Mode0 .ModeNumber } - { Mode1 .ModeNumber } ' ,
98- xLabel = r'ITR' ,
99- yLabel = r'Adiabatic criterion' )
93+ def PlotAdiabatic (self , Scene , Col , Row ):
94+ Done = []
95+ for Mode0 in self .SuperModes :
96+ for Mode1 in self .SuperModes :
97+ ID = (Mode0 .ID , Mode1 .ID )
98+ if ID in Done or ID [::- 1 ] in Done or ID [0 ]== ID [1 ] or ID [0 ][0 ] != ID [1 ][0 ]: continue
99+
100+ Scene .AddLine (Row = Row ,
101+ Col = Col ,
102+ x = self .ITRList ,
103+ y = Mode0 .Adiabatic [:, ID [1 ][1 ]],
104+ Fill = False ,
105+ Legend = f'{ Mode0 .Name } - { Mode1 .Name } ' ,
106+ xLabel = r'ITR' ,
107+ yLabel = r'Adiabatic criterion' )
100108
101- Scene .SetAxes (Col , Row , Equal = False , Legend = True , yScale = 'log' , yLimits = [1e-8 , 1e-1 ], LegendTitle = 'Mode' )
109+ Scene .SetAxes (Col , Row , Equal = False , Legend = True , yScale = 'log' , yLimits = [1e-8 , 1e-1 ], LegendTitle = 'Mode' )
110+ Done .append (ID )
102111
103112
104113 def _PlotFields (self , Slices = 0 ):
@@ -117,55 +126,43 @@ def _PlotFields(self, Slices=0):
117126 ColorMap = FieldMap ,
118127 xLabel = r'X-distance [$\mu$m]' ,
119128 yLabel = r'Y-distance [$\mu$m]' if supermode .ModeNumber == 0 else "" ,
120- Title = f'Mode: { supermode .ModeNumber } [ITR: { self .ITRList [slice ]:.2f} ]'
129+ Title = f'{ supermode .Name } [ITR: { self .ITRList [slice ]:.2f} ]'
121130 )
122131
123132 Scene .SetAxes (supermode .ModeNumber , s , Equal = True )
124133
125134 return Scene
126135
127136
128-
129-
130137 def PlotFields (self , Slices = 0 ):
131138 Scene = self ._PlotFields (Slices = Slices )
132139
133140 Scene .Show ()
134141
135142
136- def GetCombination (self , Combination ):
137- if Combination is None :
138- return tuple ( combinations ( self .SuperModes , 2 ) )
139- else :
140- Output = []
141- for (c0 , c1 ) in Combination :
142- Output .append ( ( self .SuperModes [c0 ], self .SuperModes [c1 ] ) )
143-
144- def _Plot (self , Input , iter = 0 , Combination = None ):
143+ def _Plot (self , Input , iter = 0 ):
145144 Input = ToList (Input )
146145
147- Combination = self .GetCombination (Combination )
148-
149146 Scene = Scene2D (nCols = 1 , nRows = len (Input ), ColorBar = False )
150147
151148 i = 0
152149 if 'Index' in Input :
153150 self .PlotIndex (Scene , 0 , i ); i += 1
154151
155- if 'Beta ' in Input :
156- self .PlotBeta (Scene , 0 , i ); i += 1
152+ if 'Betas ' in Input :
153+ self .PlotBetas (Scene , 0 , i ); i += 1
157154
158155 if 'Coupling' in Input :
159- self .PlotCoupling (Scene , 0 , i , Combination ); i += 1
156+ self .PlotCoupling (Scene , 0 , i ); i += 1
160157
161158 if 'Adiabatic' in Input :
162- self .PlotAdiabatic (Scene , 0 , i , Combination ); i += 1
159+ self .PlotAdiabatic (Scene , 0 , i ); i += 1
163160
164161 return Scene
165162
166163
167- def Plot (self , Input , iter = 0 , Combination = None ):
168- Scene = self ._Plot (Input , iter = iter , Combination = Combination )
164+ def Plot (self , Input , iter = 0 ):
165+ Scene = self ._Plot (Input , iter = iter )
169166
170167 Scene .Show ()
171168
0 commit comments