From 67f7ecee26656df8b64f925cbb81b7d72e7b46f8 Mon Sep 17 00:00:00 2001 From: "Kieran B. Spooner" Date: Thu, 18 May 2023 12:05:41 +0100 Subject: [PATCH 1/4] fixed lifetime display bug --- tp/calculate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tp/calculate.py b/tp/calculate.py index 0704ef7..095722a 100644 --- a/tp/calculate.py +++ b/tp/calculate.py @@ -148,7 +148,8 @@ def lifetime(gamma, use_tprc=True): with np.errstate(divide='ignore', invalid='ignore'): lifetime = np.reciprocal(np.multiply(2e12 * 2 * np.pi, gamma)) - lifetime = np.where(np.isinf(lifetime), np.nanmax(lifetime), lifetime) + infmax = np.nanmax(np.where(np.isinf(lifetime), 0, lifetime)) + lifetime = np.where(np.isinf(lifetime), infmax, lifetime) lifetime = np.where(np.isnan(lifetime), np.nanmin(lifetime), lifetime) if use_tprc: From c1b45abb2f506f1738239c311b43cc80996f9904 Mon Sep 17 00:00:00 2001 From: "Kieran B. Spooner" Date: Fri, 19 May 2023 15:23:32 +0100 Subject: [PATCH 2/4] adjust wideband wideband now _may_ plot modes where gamma is 0 --- tp/plot/phonons.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tp/plot/phonons.py b/tp/plot/phonons.py index 22eeb54..a3df46b 100644 --- a/tp/plot/phonons.py +++ b/tp/plot/phonons.py @@ -1208,6 +1208,7 @@ def add_wideband(ax, kdata, pdata, temperature=300, poscar='POSCAR', main=True, c2 = np.abs(cinterp(x2)) fmax = np.amax(np.add(f, c2)) fmin = np.amin(np.subtract(f, c2)) + c2 = np.where(c2==0, np.nanmax(c2[np.nonzero(c2)]), c2) f2 = np.linspace(fmin, fmax, 2500) # broadening From 139220a03ec101d19d9bd8f1e827243eb01b0531 Mon Sep 17 00:00:00 2001 From: "Kieran B. Spooner" Date: Fri, 19 May 2023 15:37:47 +0100 Subject: [PATCH 3/4] bug fix --- tp/plot/phonons.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tp/plot/phonons.py b/tp/plot/phonons.py index a3df46b..db785ea 100644 --- a/tp/plot/phonons.py +++ b/tp/plot/phonons.py @@ -1208,7 +1208,7 @@ def add_wideband(ax, kdata, pdata, temperature=300, poscar='POSCAR', main=True, c2 = np.abs(cinterp(x2)) fmax = np.amax(np.add(f, c2)) fmin = np.amin(np.subtract(f, c2)) - c2 = np.where(c2==0, np.nanmax(c2[np.nonzero(c2)]), c2) + c2 = np.where(c2==0, np.nanmin(c2[np.nonzero(c2)]), c2) f2 = np.linspace(fmin, fmax, 2500) # broadening From a33047abd4f0c34811f16125094da35242cd927c Mon Sep 17 00:00:00 2001 From: "Kieran B. Spooner" Date: Tue, 6 Jun 2023 15:22:01 +0100 Subject: [PATCH 4/4] fix custom units x power_factor bug if using cutom units and calculating the power factor, the conversion was sometimes applied twice, this fixes that. --- tp/data/load.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tp/data/load.py b/tp/data/load.py index aa96a79..62db5c4 100644 --- a/tp/data/load.py +++ b/tp/data/load.py @@ -167,7 +167,7 @@ def amset(filename, quantities='all', doping='n'): data2[c] = np.multiply(data2[c], float(aconversions[c])) if 'power_factor' in quantities: - data2 = tp.calculate.power_factor_fromdict(data2) + data2 = tp.calculate.power_factor_fromdict(data2, use_tprc=False) for c in conversions: if c in data2: