defectpl.plot¶
Plotter
¶
Publication-quality static figure generator for DefectPL outputs.
Each method produces a single matplotlib figure and either displays it
interactively (plot=True) or saves it at 600 dpi to out_dir
(plot=False, the default used by :meth:~defectpl.defectpl.Photoluminescence.generate_plots).
All energy inputs follow the internal convention of eV; axis labels are converted to meV where appropriate for readability.
Methods:
| Name | Description |
|---|---|
plot_penergy_vs_pmode |
Phonon energy vs mode index (dispersionless Γ-point spectrum). |
plot_ipr_vs_penergy |
Phonon IPR vs phonon energy. |
plot_loc_rat_vs_penergy |
Localization ratio β_k = N·IPR_k vs phonon energy. |
plot_qk_vs_penergy |
Mode-projected displacement q_k vs phonon energy. |
plot_HR_factor_vs_penergy |
Partial Huang–Rhys factors S_k vs phonon energy. |
plot_S_omega_vs_penergy |
Continuous spectral density S(ω) vs phonon energy. |
plot_S_omega_Sks_vs_penergy |
S(ω) and S_k overlaid on dual y-axes. |
plot_S_omega_Sks_Loc_rat_vs_penergy |
S(ω) + S_k scatter coloured by localization ratio. |
plot_S_omega_Sks_ipr_vs_penergy |
S(ω) + S_k scatter coloured by IPR. |
plot_intensity_vs_penergy |
Normalised PL intensity spectrum vs photon energy. |
plot_penergy_vs_pmode
¶
plot_penergy_vs_pmode(
frequencies,
plot=False,
out_dir="./",
file_name="penergy_vs_pmode",
fig_format="pdf",
figsize=(3.3, 2.5),
)
Plot phonon energy (meV) vs mode index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
(ndarray, shape(nmodes))
|
Phonon frequencies in eV. |
required |
plot
|
bool
|
Show interactively instead of saving. Default False. |
False
|
out_dir
|
str or Path
|
Output directory. Default |
'./'
|
file_name
|
str
|
Base file name (no extension). Default |
'penergy_vs_pmode'
|
fig_format
|
str
|
|
'pdf'
|
figsize
|
tuple of float
|
Figure size in inches. Default |
(3.3, 2.5)
|
Source code in defectpl\plot.py
plot_ipr_vs_penergy
¶
plot_ipr_vs_penergy(
frequencies,
iprs,
plot=False,
out_dir="./",
file_name="ipr_vs_penergy",
fig_format="pdf",
figsize=(3.3, 2.5),
)
Scatter plot of phonon IPR vs phonon energy (meV).
IPR = Σp²/(Σp)² ranges from 1/N (fully delocalized) to 1 (fully localized).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
(ndarray, shape(nmodes))
|
Phonon frequencies in eV. |
required |
iprs
|
(ndarray, shape(nmodes))
|
Inverse participation ratios per mode. |
required |
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_loc_rat_vs_penergy
¶
plot_loc_rat_vs_penergy(
frequencies,
localization_ratio,
plot=False,
out_dir="./",
file_name="loc_rat_vs_penergy",
fig_format="pdf",
figsize=(3.3, 2.5),
)
Scatter plot of localization ratio β_k = N·IPR_k vs phonon energy (meV).
β = 1 means perfectly delocalized; β = N means fully localized on one atom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
(ndarray, shape(nmodes))
|
Phonon frequencies in eV. |
required |
localization_ratio
|
(ndarray, shape(nmodes))
|
Localization ratio per mode. |
required |
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_qk_vs_penergy
¶
plot_qk_vs_penergy(
frequencies,
qks,
plot=False,
out_dir="./",
file_name="qk_vs_penergy",
fig_format="pdf",
figsize=(3.3, 2.5),
)
Scatter plot of mode-projected displacement q_k vs phonon energy (meV).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
(ndarray, shape(nmodes))
|
Phonon frequencies in eV. |
required |
qks
|
(ndarray, shape(nmodes))
|
Mode configurational displacements in amu^(½)·Å. |
required |
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_HR_factor_vs_penergy
¶
plot_HR_factor_vs_penergy(
frequencies,
Sks,
plot=False,
out_dir="./",
file_name="HR_factor_vs_penergy",
fig_format="pdf",
figsize=(3.3, 2.5),
)
Scatter plot of partial Huang–Rhys factors S_k vs phonon energy (meV).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
(ndarray, shape(nmodes))
|
Phonon frequencies in eV. |
required |
Sks
|
(ndarray, shape(nmodes))
|
Partial (mode-resolved) Huang–Rhys factors. |
required |
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_S_omega_vs_penergy
¶
plot_S_omega_vs_penergy(
frequencies,
S_omega,
omega_range,
plot=False,
out_dir="./",
file_name="S_omega_vs_penergy",
max_freq=None,
fig_format="pdf",
figsize=(3.3, 2.5),
)
Line plot of the continuous Huang–Rhys spectral density S(ω) in 1/meV vs energy (meV).
S(ω) is the phonon sideband weight per unit energy; its integral equals the total Huang–Rhys factor S.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
(ndarray, shape(nmodes))
|
Phonon frequencies in eV (used to set x-axis upper limit). |
required |
S_omega
|
(array - like, shape(n_grid))
|
Spectral density in eV^(-1). |
required |
omega_range
|
list[ω_min, ω_max, n_points]
|
Energy grid parameters in eV matching the S(ω) array. |
required |
max_freq
|
float
|
Upper frequency cut-off for the plot in eV. |
None
|
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_S_omega_Sks_vs_penergy
¶
plot_S_omega_Sks_vs_penergy(
frequencies,
S_omega,
omega_range,
Sks,
plot=False,
out_dir="./",
file_name="S_omega_Sks_vs_penergy",
max_freq=None,
fig_format="pdf",
figsize=(3.5, 2.5),
)
Dual-axis plot of S(ω) (left axis) and partial S_k scatter (right axis).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
ndarray
|
See :meth: |
required |
S_omega
|
ndarray
|
See :meth: |
required |
omega_range
|
ndarray
|
See :meth: |
required |
Sks
|
(ndarray, shape(nmodes))
|
Partial Huang–Rhys factors. |
required |
max_freq
|
float
|
Upper frequency cut-off in eV. |
None
|
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_S_omega_Sks_Loc_rat_vs_penergy
¶
plot_S_omega_Sks_Loc_rat_vs_penergy(
frequencies,
S_omega,
omega_range,
Sks,
localization_ratio,
plot=False,
out_dir="./",
file_name="S_omega_HRf_loc_rat_vs_penergy",
max_freq=None,
pylim=[None, None],
fig_format="pdf",
figsize=(4.2, 2.5),
cmap="viridis",
)
S(ω) line + S_k scatter coloured by localization ratio β_k.
Identifies phonon modes that simultaneously carry large HR weight and are localized near the defect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
ndarray
|
See :meth: |
required |
S_omega
|
ndarray
|
See :meth: |
required |
omega_range
|
ndarray
|
See :meth: |
required |
Sks
|
(ndarray, shape(nmodes))
|
Partial Huang–Rhys factors (right y-axis). |
required |
localization_ratio
|
(ndarray, shape(nmodes))
|
Colour-code values β_k = N·IPR_k. |
required |
pylim
|
list of [float or None, float or None]
|
|
[None, None]
|
cmap
|
str
|
Matplotlib colormap name. Default |
'viridis'
|
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_S_omega_Sks_ipr_vs_penergy
¶
plot_S_omega_Sks_ipr_vs_penergy(
frequencies,
S_omega,
omega_range,
Sks,
iprs,
plot=False,
out_dir="./",
file_name="S_omega_HRf_ipr_vs_penergy",
max_freq=None,
fig_format="pdf",
figsize=(4.2, 2.5),
cmap="viridis",
)
S(ω) line + S_k scatter coloured by phonon IPR.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
ndarray
|
See :meth: |
required |
S_omega
|
ndarray
|
See :meth: |
required |
omega_range
|
ndarray
|
See :meth: |
required |
Sks
|
(ndarray, shape(nmodes))
|
Partial Huang–Rhys factors (right y-axis). |
required |
iprs
|
(ndarray, shape(nmodes))
|
Phonon inverse participation ratios used as colour code. |
required |
cmap
|
str
|
Matplotlib colormap name. Default |
'viridis'
|
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|
Source code in defectpl\plot.py
plot_intensity_vs_penergy
¶
plot_intensity_vs_penergy(
frequencies,
I,
resolution,
xlim,
plot=False,
out_dir="./",
file_name="intensity_vs_penergy",
iylim=None,
fig_format="pdf",
figsize=(3.3, 2.5),
)
Line plot of the normalised PL intensity spectrum vs photon energy (eV).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies
|
ndarray
|
Phonon frequencies in eV (unused directly; kept for API consistency). |
required |
I
|
ndarray
|
Complex or real intensity array from :func: |
required |
resolution
|
int
|
Number of grid points per eV; sets the energy-axis scale. |
required |
xlim
|
tuple of float
|
|
required |
iylim
|
tuple of float
|
|
None
|
plot
|
bool
|
See :meth: |
False
|
out_dir
|
bool
|
See :meth: |
False
|
file_name
|
bool
|
See :meth: |
False
|
fig_format
|
bool
|
See :meth: |
False
|
figsize
|
bool
|
See :meth: |
False
|