init_data_dir

pyrcs.utils.init_data_dir(cls, data_dir, category, cluster=None, **kwargs)

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

Parameters
  • cls (object) – (an instance of) a class for a certain data cluster

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

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

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

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

Returns

pathnames of a default data directory and a current data directory

Return type

tuple[str, os.PathLike[str]]

Example:

>>> 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)
'data'
>>> os.path.relpath(current_dat_dir)
'data'