init_data_dir

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

Specifies the initial data directory for a class instance to manage a specific data cluster.

Parameters:
  • cls_instance (object) – An instance of a class managing the data cluster.

  • data_dir (str | None) – The directory where the data (e.g. pickle file) will be saved.

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

  • cluster (str | None) – An optional replacement for cls_instance.KEY.

  • kwargs – [Optional] Additional parameters passed to cd_data().

Returns:

A tuple containing the default data directory and the current data directory path.

Return type:

tuple[str, str]

Examples:

>>> 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'