From ab73decf27709fd28fbb4585d5d0b7ded84c7097 Mon Sep 17 00:00:00 2001 From: Jiacheng Wang <63186896+jcwang587@users.noreply.github.com> Date: Thu, 23 Apr 2026 12:02:03 -0400 Subject: [PATCH 1/2] Use raw strings for LaTeX escapes in hr_factors print output The two print() calls in compute_hrf_force and compute_hrf_dis contained \Delta and \AA inside regular strings, which triggers a SyntaxWarning (invalid escape sequence) under Python 3.12+ and will become a SyntaxError in a future version. Prefixing the strings with `r` preserves the intended output while silencing the warning. Made-with: Cursor --- pypl/hr_factors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pypl/hr_factors.py b/pypl/hr_factors.py index f0e0406..f48a3a6 100644 --- a/pypl/hr_factors.py +++ b/pypl/hr_factors.py @@ -220,7 +220,7 @@ def compute_hrf_forces(self, forces): deltaq = deltaq / self.freqs[self.nom_translational + self.nom_imag_freq :] ** 2 print( - "Total \Delta Q is % .12e amu^{0.5} \AA" + r"Total \Delta Q is % .12e amu^{0.5} \AA" % (np.linalg.norm(deltaq) / constants.physical_constants["atomic mass constant"][0] ** 0.5 * 1e10) ) @@ -276,7 +276,7 @@ def compute_hrf_dis(self, gs_coord, es_coord, cell_parameters): deltaq = np.dot(modes[self.nom_translational + self.nom_imag_freq :, :], mass_dis) print( - "Total \Delta Q is % .12e amu^{0.5} \AA" + r"Total \Delta Q is % .12e amu^{0.5} \AA" % (np.linalg.norm(deltaq) / constants.physical_constants["atomic mass constant"][0] ** 0.5 * 1e10) ) From 8cae8bce330c927b34e9464cff8ef3449277bfa4 Mon Sep 17 00:00:00 2001 From: Jiacheng Wang <63186896+jcwang587@users.noreply.github.com> Date: Thu, 23 Apr 2026 14:21:42 -0400 Subject: [PATCH 2/2] one more fix --- pypl/config_coord_1d_solver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pypl/config_coord_1d_solver.py b/pypl/config_coord_1d_solver.py index 5b575fd..7918527 100644 --- a/pypl/config_coord_1d_solver.py +++ b/pypl/config_coord_1d_solver.py @@ -404,7 +404,7 @@ def compute_spectrum(self, eneaxis=None, linshape=None, tdm=1.0, zpl=0.0, spectr ax.tick_params(direction="in") ax.xaxis.set_ticks_position("both") ax.yaxis.set_ticks_position("both") - ax.set_xlabel("$\hbar\omega$ (eV)") + ax.set_xlabel(r"$\hbar\omega$ (eV)") ax.set_ylabel("PL/Abs (arb. unit.)") plt.show()