From 2b3985ecb88360c0d932608e5ae2334169c31f21 Mon Sep 17 00:00:00 2001 From: Jeffrey Gill Date: Sat, 21 Dec 2019 21:42:12 -0500 Subject: [PATCH] Make data_dir default to metadata file directory --- docs/metadata.rst | 7 ++++--- neurotic/datasets/metadata.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/metadata.rst b/docs/metadata.rst index ee552d9..e43fab7 100644 --- a/docs/metadata.rst +++ b/docs/metadata.rst @@ -49,10 +49,11 @@ Within a dataset's YAML block, paths to data and video files should be provided. All files associated with a dataset should be collected into a single -directory. A path to the local copy of this directory must be provided using -the ``data_dir`` key. You may specify ``data_dir`` as an absolute path (e.g., +directory. A path to the local copy of this directory can be provided using the +``data_dir`` key. You may specify ``data_dir`` as an absolute path (e.g., ``C:\Users\me\folder``) or as a path relative to the metadata file (e.g., -``folder``). +``folder``). If left unspecified, the directory containing the metadata file is +used. Paths to individual files within the dataset are provided using keys listed below. These paths should be given relative to ``data_dir``. If ``data_dir`` is diff --git a/neurotic/datasets/metadata.py b/neurotic/datasets/metadata.py index 155ec67..b0e5c49 100644 --- a/neurotic/datasets/metadata.py +++ b/neurotic/datasets/metadata.py @@ -180,7 +180,7 @@ def _load_metadata(file = 'metadata.yml', local_data_root = None, remote_data_ro value passed to this function will override the value provided in the file. If both are unspecified, it is assumed that no remote data store exists. - The "data_dir" property must be provided for every data set in ``file`` and + The "data_dir" property is optional for every data set in ``file`` and specifies the directory on the local system containing the data files. "data_dir" may be an absolute path or a relative path with respect to ``local_data_root``. If it is a relative path, it will be converted to an @@ -294,7 +294,7 @@ def _defaults_for_key(key): # - if it is a relative path, it will be interpreted by _load_metadata # as relative to local_data_root and will be converted to an absolute # path - 'data_dir': None, + 'data_dir': '.', # the path of the directory containing the data on a remote server # - this may be a full URL or a relative path, or None if there exists