shnitsel.core.parse

Submodules

Attributes

Trajid

_exnum

_idfn

_read_traj

READERS

Classes

Trajres

Functions

_default_idfn(path)

read_trajs_list(paths, kind[, idfn, sort, errors])

_per_traj(trajdir)

read_trajs_parallel(paths, kind[, idfn, sort])

gather_traj_metadata(datasets[, time_dim])

concat_trajs(datasets)

layer_trajs(datasets)

read_trajs(path, kind[, pattern, format, parallel, errors])

Read all trajectories from a folder of trajectory folders

Package Contents

type Trajid = int
_exnum
class Trajres
trajid: int
missing_file: str | None
misc_error: Exception | None
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:

xarray.Dataset

layer_trajs(datasets)
Return type:

xarray.Dataset

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: