shnitsel.core.parse =================== .. py:module:: shnitsel.core.parse Submodules ---------- .. toctree:: :maxdepth: 1 /api/shnitsel/core/parse/common/index /api/shnitsel/core/parse/nx/index /api/shnitsel/core/parse/pyrai2md/index /api/shnitsel/core/parse/sharc_icond/index /api/shnitsel/core/parse/sharc_traj/index /api/shnitsel/core/parse/xyz/index Attributes ---------- .. autoapisummary:: shnitsel.core.parse.Trajid shnitsel.core.parse._exnum shnitsel.core.parse._idfn shnitsel.core.parse._read_traj shnitsel.core.parse.READERS Classes ------- .. autoapisummary:: shnitsel.core.parse.Trajres Functions --------- .. autoapisummary:: shnitsel.core.parse._default_idfn shnitsel.core.parse.read_trajs_list shnitsel.core.parse._per_traj shnitsel.core.parse.read_trajs_parallel shnitsel.core.parse.gather_traj_metadata shnitsel.core.parse.concat_trajs shnitsel.core.parse.layer_trajs shnitsel.core.parse.read_trajs Package Contents ---------------- .. py:type:: Trajid :canonical: int .. py:data:: _exnum .. py:class:: Trajres .. py:attribute:: trajid :type: int .. py:attribute:: missing_file :type: str | None .. py:attribute:: misc_error :type: Exception | None .. py:attribute:: data :type: xarray.Dataset | None .. py:function:: _default_idfn(path) .. py:data:: _idfn .. py:data:: _read_traj :type: Callable .. py:data:: READERS .. py:function:: read_trajs_list(paths, kind, idfn=None, sort=True, errors='log') .. py:function:: _per_traj(trajdir) .. py:function:: read_trajs_parallel(paths, kind, idfn=None, sort=True) .. py:function:: gather_traj_metadata(datasets, time_dim='ts') .. py:function:: concat_trajs(datasets) .. py:function:: layer_trajs(datasets) .. py:function:: read_trajs(path, kind, pattern = 'TRAJ*', format = 'frames', parallel = True, errors = 'log') Read all trajectories from a folder of trajectory folders :param path: The path to the folder of folders :param kind: The kind of trajectory, i.e. whether it was produced by SHARC, Newton-X or PyRAI2MD :param pattern: The search pattern to append to the path (the whole thing will be read by :external:py:func:`glob.glob`), by default 'TRAJ*' :param format: Whether to return the trajectories concatenated along the time axis ('frames') using a :external:py:class:`xarray.indexes.PandasMultiIndex` or along a new axis ('layers'), by default 'frames' :param parallel: Whether to read multiple trajectories at the same time (which, in the current implementation, is only faster on storage that allows non-sequential reads), by default False :rtype: An :external:py:class:`xarray.Dataset` containing the data of the trajectories :raises FileNotFoundError: If the search (``= path + pattern``) doesn't match any paths according to :external:py:func:`glob.glob` :raises ValueError: If an invalid value for ``format`` is passed.