Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Detailed list of changes
🧐 API and behavior changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Nothing yet
- :func:`mne_bids.make_dataset_description` will now auto-generate basic ``GeneratedBy`` fields if ``generated_by=None``. To suppress the auto-generated fields, pass an empty list. By `Daniel McCloy`_ (:gh:`1384`)

🛠 Requirements
^^^^^^^^^^^^^^^
Expand Down
16 changes: 13 additions & 3 deletions mne_bids/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

from mne_bids import (
BIDSPath,
__version__,
get_anonymization_daysback,
get_bids_path_from_fname,
read_raw_bids,
Expand Down Expand Up @@ -1297,7 +1298,9 @@ def make_dataset_description(
doi:10.5281/zenodo.3686061).
generated_by : list of dict | None
Used to specify provenance of the dataset. See BIDS specification
for details.
for details. If ``None``, a basic description containing MNE-BIDS name, version,
and URL will be generated for you. To suppress this behavior, pass an empty
list.
source_datasets : list of dict | None
Used to specify the locations and relevant attributes of all source
datasets. Each dict in the list represents one source dataset and
Expand Down Expand Up @@ -1349,9 +1352,16 @@ def make_dataset_description(
)
if not set(i.keys()).issubset(generated_by_keys):
raise ValueError(msg_key.format(i.keys() - generated_by_keys))
elif generated_by is not None:
raise ValueError(msg_type.format("generated_by"))
else:
if generated_by is not None:
raise ValueError(msg_type.format("generated_by"))
generated_by = [
dict(
Name="MNE-BIDS",
Version=__version__,
CodeURL="https://mne.tools/mne-bids/",
)
]

source_ds_keys = set(["URL", "DOI", "Version"])
if isinstance(source_datasets, list):
Expand Down