pyrcs.utils.init_data_dir(cls_instance, data_dir, category, cluster=None, **kwargs)[source]

Specify an initial data directory for (an instance of) a class for a data cluster.

  • cls_instance (object) – An instance of a class for a certain data cluster.

  • data_dir (str | None) – The name of a folder where the pickle file is to be saved.

  • category (str) – The name of a data category, e.g. "line-data".

  • cluster (str | None) – A replacement for cls.KEY.

  • kwargs – [optional] parameters of the function cd_data().


Pathnames of a default data directory and a current data directory.

Return type:

tuple[str, os.PathLike[str]]


>>> from pyrcs.utils import init_data_dir
>>> from pyrcs.line_data import Bridges
>>> import os

>>> bridges = Bridges()

>>> dat_dir, current_dat_dir = init_data_dir(bridges, data_dir="data", category="line-data")
>>> os.path.relpath(dat_dir)
>>> os.path.relpath(current_dat_dir)