From 5c012746ed6fbe877150273d93b33c583a5f30f5 Mon Sep 17 00:00:00 2001 From: Jacan Chaplais Date: Thu, 18 Jul 2024 14:13:40 +0100 Subject: [PATCH] added latex property to PdgArray #184 --- graphicle/data.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/graphicle/data.py b/graphicle/data.py index 492a466..80318d2 100644 --- a/graphicle/data.py +++ b/graphicle/data.py @@ -1038,6 +1038,9 @@ class PdgArray(base.ArrayBase): .. versionchanged:: 0.2.0 Added internal numpy interfaces for greater interoperability. + .. versionchanged:: 0.4.1 + ``name`` property now gives unicode array. latex property added. + Parameters ---------- data : sequence[int] @@ -1045,7 +1048,7 @@ class PdgArray(base.ArrayBase): Attributes ---------- - name : ndarray[object] + name : ndarray[unicode] String representation of particle names. charge : ndarray[float64] Charge for each particle in elementary units. @@ -1069,6 +1072,8 @@ class PdgArray(base.ArrayBase): Spatial parity for each particle. charge_parity : ndarray[float64] Charge parity for each particle. + latex : list[str] + LaTeX compatible representation of particle names. Methods ------- @@ -1235,7 +1240,13 @@ def __get_prop_range(self, field: str) -> base.VoidVector: @property def name(self) -> base.ObjVector: - return self.__get_prop("name") + # 19 is the length of longest name + return self.__get_prop("name").astype(" ty.List[str]: + # 32 is the length of longest name + return self.__get_prop("latex").tolist() @property def charge(self) -> base.DoubleVector: