bids.reports.BIDSReport

class BIDSReport(layout, config=None)[source]

Generates publication-quality data acquisition methods section from BIDS dataset.

Parameters
  • layout (bids.layout.BIDSLayout) – Layout object for a BIDS dataset.

  • config (str or dict, optional) –

    Configuration info for methods generation. Can be a path to a file (str), a dictionary, or None. If None, loads and uses default configuration information. Keys in the dictionary include:

    ’dir’: a dictionary for converting encoding direction strings

    (e.g., j-) to descriptions (e.g., anterior to posterior)

    ’seq’: a dictionary of sequence abbreviations (e.g., EP) and

    corresponding names (e.g., echo planar)

    ’seqvar’: a dictionary of sequence variant abbreviations

    (e.g., SP) and corresponding names (e.g., spoiled)

Methods

generate(self, \*\*kwargs)

Generate the methods section.

__init__(self, layout, config=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, layout[, config])

Initialize self.

generate(self, \*\*kwargs)

Generate the methods section.

generate(self, **kwargs)[source]

Generate the methods section.

Parameters

task_converter (dict, optional) – A dictionary with information for converting task names from BIDS filename format to human-readable strings.

Returns

counter – A dictionary of unique descriptions across subjects in the dataset, along with the number of times each pattern occurred. In cases where all subjects underwent the same protocol, the most common pattern is most likely the most complete. In cases where the dataset contains multiple protocols, each pattern will need to be inspected manually.

Return type

collections.Counter

Examples

>>> from os.path import join
>>> from bids.layout import BIDSLayout
>>> from bids.reports import BIDSReport
>>> from bids.tests import get_test_data_path
>>> layout = BIDSLayout(join(get_test_data_path(), 'synthetic'))
>>> report = BIDSReport(layout)
>>> counter = report.generate(session='01')
Number of patterns detected: 1
Remember to double-check everything and to replace <deg> with a degree symbol.
>>> counter.most_common()[0][0]  
'For session 01:\n\tMR data were...'