shnitsel.core.parse¶
Submodules¶
Attributes¶
Classes¶
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Read all trajectories from a folder of trajectory folders |
Package Contents¶
- _exnum¶
- class Trajres¶
-
- data: xarray.Dataset | None¶
- _default_idfn(path)¶
- _idfn¶
- _read_traj: Callable¶
- READERS¶
- read_trajs_list(paths, kind, idfn=None, sort=True, errors='log')¶
- _per_traj(trajdir)¶
- read_trajs_parallel(paths, kind, idfn=None, sort=True)¶
- gather_traj_metadata(datasets, time_dim='ts')¶
- concat_trajs(datasets)¶
- Return type:
- layer_trajs(datasets)¶
- Return type:
- read_trajs(path, kind, pattern='TRAJ*', format='frames', parallel=True, errors='log')¶
Read all trajectories from a folder of trajectory folders
- Parameters:
path (str) – The path to the folder of folders
kind (Literal['sharc', 'nx', 'pyrai2md']) – The kind of trajectory, i.e. whether it was produced by SHARC, Newton-X or PyRAI2MD
pattern (str) – The search pattern to append to the path (the whole thing will be read by
glob.glob()
), by default ‘TRAJ*’format (Literal['frames', 'layers']) – Whether to return the trajectories concatenated along the time axis (‘frames’) using a
xarray.indexes.PandasMultiIndex
or along a new axis (‘layers’), by default ‘frames’parallel (bool) – 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
errors (Literal['log', 'raise'])
- Return type:
An
xarray.Dataset
containing the data of the trajectories- Raises:
FileNotFoundError – If the search (
= path + pattern
) doesn’t match any paths according toglob.glob()
ValueError – If an invalid value for
format
is passed.