datman.config module

Return the site wide config file and project config files

By default the system_config.yaml file is location is read from the environment variable os.environ['DM_CONFIG']

The system is identified from os.environ['DM_SYSTEM'] and can be used to switch between multiple installations of datman or different computing systems.

These can both be overridden at __init__.py

class datman.config.TagInfo(export_settings, site_settings=None)[source]

Bases: object

get(tag, field=None)[source]
keys()[source]
property series_map

Maps the ‘pattern’ fields onto the expected tags. If multiple patterns exist, they’re joined with ‘|’.

class datman.config.config(filename=None, system=None, study=None)[source]

Bases: object

get_key(key, site=None, ignore_defaults=False, defaults_only=False)[source]

Searches the configuration from most specific settings to least to allow overrides + additional settings to be discovered.

Searches from site (if given) -> study -> local system -> system wide

If ‘defaults_only’ is used the search will restrict itself to system wide settings and local system settings (i.e. settings from the main config file)

If ‘ignore_defaults’ is set the search is restricted to only site (if site was given) or only the current study (if site was not).

Raises UndefinedSetting if no value is found

get_path(path_type, study=None)[source]

returns the absolute path to a folder type

get_sites(study=None)[source]
get_study_base(study=None)[source]

Return the base directory for a study

get_study_tags(study=None)[source]

Returns a dictionary of study tags mapped to the sites defined for that tag.

If a study has not been set then an exception is raised

get_tags(site=None, study=None)[source]

Returns a TagInfo instance.

If you get the tags without a study set or without specifying a site you get the configuration of all defined tags from ‘ExportSettings’ in the system config file.

If you specify a site, you get the configuration for that site merged with the configuration of ‘ExportSettings’ for the tags matching that site. If there’s a key conflict between ‘ExportInfo’ (study config) and ‘ExportSettings’ (system config) the values in ‘ExportInfo’ will override the values in ‘ExportSettings’.

get_xnat_projects(study=None)[source]
install_config = None
load_yaml(filename)[source]
map_xnat_archive_to_project(filename)[source]

Maps the XNAT tag (e.g. SPN01) to the project name e.g. SPINS Can either supply a full filename in which case only the first part is considered or just a tag.

By default the project tag is extracted from the filename and matched to the “StudyTag” in the study config file. If a study has used multiple site tags (e.g. SPN01, SPINS) these can be defined in the site specific [SiteTags] key.

One project tag (DTI) is shared between two xnat archives (DTI15T and DTI3T), the site is used to differentiate between them. As a result, if only a ‘DTI’ project tag is given this function raises an exception.

set_study(study_name)[source]

This function can take just the study ID for every study except DTI. So where possible, please give it an exact match to a project name or a full session ID.

study_config = None
study_config_file = None
study_name = None
system_config = None
datman.config.study_required(wrapper=None, enabled=None, adapter=None, proxy=<class 'FunctionWrapper'>)[source]