pydmr.write#
- pydmr.write(path, dmr, format='flat')[source]#
Write data to disk in .dmr format.
- Parameters:
path (str) – path to .dmr file. If the extension .dmr is not included, it is added automatically.
dmr (dict) – A dictionary with one required key ‘data’ and optional keys ‘rois’, ‘pars’, ‘sdev’, ‘columns’. dmr[‘data’] is a dictionary with one item for each parameter; the key is the parameter and the value is a list of containing description, unit and python data type. dmr[‘rois’] is a dictionary with one item per ROI; each ROI is a dictionary on itself which has keys (subject, study, parameter) and a list or array as value. dmr[‘pars’] is a dictionary with parameters such as sequence parameters or subject characteristics. dmr[‘sdev’] is a dictionary with standard deviations of parameters listed in pars.csv. This can include only a subset of parameters but all parameters in sdev.csv must also be in pars.csv. Defaults to None. dmr[‘columns’] is a list of headers for optional columns in the data dictionary. Required if the data dictionary contains extra columns above the required three (description, unit, type).
format (str, optional) – Formatting of the arguments. The default (‘flat’) is a dictionary with a multi-index, meaning values (rois, pars, sdev) are flat dictionaries with a multi-index consisting of (subject, study, parameter). If format=’nest’, these values are nested dictionaries with 3 levels. If format=’table’, the values are a list of lists. Defaults to ‘flat’.
- Raises:
ValueError – if the data are not dmr-compliant formatted.
ImportError – if an optional package is not installed