Skip to content

Base API

Convenience functions

Commonly used functions and classes. There are two main object types in scida:

All specialized classes derive from these two classes. Generally, we do not have to instantiate the correct class ourselves, but can use the load function to load a dataset. This function will furthermore adjust the underlying class with additional functionality, such as units, depending on the data set.

load(path, units=True, unitfile='', overwrite=False, force_class=None, **kwargs)

Load a dataset or dataset series from a given path. This function will automatically determine the best-matching class to use and return the initialized instance.

Parameters:

Name Type Description Default
path str

Path to dataset or dataset series. Usually the base folder containing all files of a given dataset/series.

required
units Union[bool, str]

Whether to load units.

True
unitfile str

Can explicitly pass path to a unitfile to use.

''
overwrite bool

Whether to overwrite an existing cache.

False
force_class Optional[object]

Force a specific class to be used.

None
kwargs

Additional keyword arguments to pass to the class.

{}

Returns:

Type Description
Union[Dataset, DatasetSeries]:

Initialized dataset or dataset series.

Datasets and Series

The Dataset class is the base class for all data sets. Collections of datasets are represented by the DatasetSeries class. These objects are not instantiated directly, but are created by the load function.

For example, AREPO snapshots are defined by the ArepoSnapshot class. The load function will select a class based on the following criteria (descending priority):

  1. The class is passed to load as the force_class argument.
  2. The class is specified in the simulation configuration, see here.
  3. The class implements validate_path() returning True for the given path if the class is applicable.