@@ -183,7 +183,25 @@ def _plot_eigs(
183
183
x_width : float = 0.3 ,
184
184
** kwargs ,
185
185
) -> None :
186
- """Plot the eigenvalues."""
186
+ """Plot the eigenvalues.
187
+
188
+ Args:
189
+ d_eigs:
190
+ The dictionary of eigenvalues for the defect state. In the format of
191
+ (iband, ikpt, ispin) -> eigenvalue
192
+ e_fermi:
193
+ The bands above and below the Fermi level will be colored differently.
194
+ If not provided, they will all be colored the same.
195
+ ax:
196
+ The matplotlib axis object to plot on.
197
+ x0:
198
+ The x coordinate of the center of the set of lines representing the eigenvalues.
199
+ x_width:
200
+ The width of the set of lines representing the eigenvalues.
201
+ **kwargs:
202
+ Keyword arguments to pass to `matplotlib.pyplot.hlines`.
203
+ For example, `linestyles`, `alpha`, etc.
204
+ """
187
205
if ax is None : # pragma: no cover
188
206
ax = plt .gca ()
189
207
@@ -215,7 +233,7 @@ def _plot_matrix_elements(
215
233
arrow_width = 0.1 ,
216
234
cmap = None ,
217
235
norm = None ,
218
- ):
236
+ ) -> tuple [ list [ tuple ], plt . cm , plt . Normalize ] :
219
237
"""Plot arrow for the transition from the defect state to all other states.
220
238
221
239
Args:
@@ -242,13 +260,21 @@ def _plot_matrix_elements(
242
260
The cartesian direction of the WAVDER tensor to sum over for the plot.
243
261
If not provided, all the absolute values of the matrix for all
244
262
three diagonal entries will be summed.
263
+
264
+ Returns:
265
+ plot_data:
266
+ A list of tuples in the format of (iband, ikpt, ispin, eigenvalue, matrix element)
267
+ cmap:
268
+ The matplotlib color map used.
269
+ norm:
270
+ The matplotlib normalization used.
245
271
"""
246
272
if ax is None : # pragma: no cover
247
273
ax = plt .gca ()
248
274
ax .set_aspect ("equal" )
249
275
jb , jkpt , jspin = next (filter (lambda x : x [0 ] == defect_band_index , d_eig .keys ()))
250
276
y0 = d_eig [jb , jkpt , jspin ]
251
- plot_data = []
277
+ plot_data : list [ tuple ] = []
252
278
for (ib , ik , ispin ), eig in d_eig .items ():
253
279
A = 0
254
280
for idir , jdir in ijdirs :
@@ -289,8 +315,25 @@ def _plot_matrix_elements(
289
315
return plot_data , cmap , norm
290
316
291
317
292
- def _get_dataframe (d_eigs , me_plot_data ) -> pd .DataFrame :
293
- """Convert the eigenvalue and matrix element data into a pandas dataframe."""
318
+ def _get_dataframe (d_eigs : dict , me_plot_data : list [tuple ]) -> pd .DataFrame :
319
+ """Convert the eigenvalue and matrix element data into a pandas dataframe.
320
+
321
+ Args:
322
+ d_eigs:
323
+ The dictionary of eigenvalues for the defect state. In the format of
324
+ (iband, ikpt, ispin) -> eigenvalue
325
+ me_plot_data:
326
+ A list of tuples in the format of (iband, ikpt, ispin, eigenvalue, matrix element)
327
+
328
+ Returns:
329
+ A pandas dataframe with the following columns:
330
+ ib: The band index of the state the arrow is pointing to.
331
+ jb: The band index of the defect state.
332
+ kpt: The kpoint index of the state the arrow is pointing to.
333
+ spin: The spin index of the state the arrow is pointing to.
334
+ eig: The eigenvalue of the state the arrow is pointing to.
335
+ M.E.: The matrix element of the transition.
336
+ """
294
337
_ , ikpt , ispin = next (iter (d_eigs .keys ()))
295
338
df = pd .DataFrame (
296
339
me_plot_data ,
0 commit comments