diff --git a/stingray/base.py b/stingray/base.py index 92fc14eef..8a851117f 100644 --- a/stingray/base.py +++ b/stingray/base.py @@ -387,6 +387,12 @@ def to_pandas(self) -> DataFrame: Array attributes (e.g. ``time``, ``pi``, ``energy``, etc. for ``EventList``) are converted into columns, while meta attributes (``mjdref``, ``gti``, etc.) are saved into the ``ds.attrs`` dictionary. + + Since pandas does not support n-D data, multi-dimensional arrays are + converted into columns before the conversion, with names ``_dimN_M_K`` etc. + + See documentation of `make_nd_into_arrays` for details. + """ from pandas import DataFrame from .utils import make_nd_into_arrays @@ -423,6 +429,11 @@ def from_pandas(cls: Type[Tso], ts: DataFrame) -> Tso: using the standard attributes of the wanted StingrayObject (e.g. ``time``, ``pi``, etc. for ``EventList``) + Since pandas does not support n-D data, multi-dimensional arrays can be + specified as ``_dimN_M_K`` etc. + + See documentation of `make_1d_arrays_into_nd` for details. + """ import re from .utils import make_1d_arrays_into_nd diff --git a/stingray/utils.py b/stingray/utils.py index 793520944..a78a62271 100644 --- a/stingray/utils.py +++ b/stingray/utils.py @@ -161,6 +161,8 @@ def any_complex_in_array(array): def make_nd_into_arrays(array: np.ndarray, label: str) -> dict: """If an array is n-dimensional, make it into many 1-dimensional arrays. + Call additional dimensions, e.g. ``_dimN_M``. See examples below. + Parameters ---------- array : `np.ndarray` @@ -237,6 +239,8 @@ def get_dimensions_from_list_of_column_labels(labels: list, label: str) -> list: def make_1d_arrays_into_nd(data: dict, label: str) -> np.ndarray: """Literally the opposite of make_nd_into_arrays. + Call additional dimensions, e.g. ``_dimN_M`` + Parameters ---------- data : dict