From 6398e46d153b592387c7015a6daf1cbe7f4207c3 Mon Sep 17 00:00:00 2001 From: Circle Ci Date: Fri, 23 Aug 2024 13:14:45 +0000 Subject: [PATCH] doc updates [skip ci] --- dev/.buildinfo | 2 +- .../auto_examples_python.zip | Bin 100203 -> 100203 bytes .../read_bids_datasets.zip | Bin 19850 -> 19850 bytes .../mark_bad_channels.zip | Bin 16499 -> 16499 bytes .../convert_mne_sample.zip | Bin 20493 -> 20493 bytes .../convert_nirs_to_bids.zip | Bin 16296 -> 16296 bytes .../convert_group_studies.zip | Bin 11192 -> 11192 bytes .../rename_brainvision_files.zip | Bin 8931 -> 8931 bytes .../auto_examples_jupyter.zip | Bin 154556 -> 154556 bytes .../bidspath.zip | Bin 17550 -> 17550 bytes .../convert_ieeg_to_bids.zip | Bin 47945 -> 47945 bytes .../update_bids_datasets.zip | Bin 11262 -> 11262 bytes .../create_bids_folder.zip | Bin 5694 -> 5694 bytes .../anonymize_dataset.zip | Bin 18580 -> 18580 bytes .../convert_eeg_to_bids.zip | Bin 21351 -> 21351 bytes .../convert_mri_and_trans.zip | Bin 27386 -> 27386 bytes .../convert_empty_room.zip | Bin 11994 -> 11994 bytes dev/_modules/index.html | 6 +- dev/_modules/mne_bids/copyfiles.html | 6 +- dev/_modules/mne_bids/dig.html | 6 +- dev/_modules/mne_bids/inspect.html | 6 +- dev/_modules/mne_bids/path.html | 6 +- dev/_modules/mne_bids/read.html | 24 ++++- dev/_modules/mne_bids/report/_report.html | 6 +- dev/_modules/mne_bids/sidecar_updates.html | 6 +- dev/_modules/mne_bids/stats.html | 6 +- dev/_modules/mne_bids/utils.html | 6 +- dev/_modules/mne_bids/write.html | 86 +++++++++++++++--- dev/_static/documentation_options.js | 2 +- dev/api.html | 6 +- dev/authors.html | 6 +- dev/auto_examples/anonymize_dataset.html | 68 +++++++------- dev/auto_examples/bidspath.html | 6 +- dev/auto_examples/convert_eeg_to_bids.html | 18 ++-- dev/auto_examples/convert_empty_room.html | 8 +- dev/auto_examples/convert_group_studies.html | 8 +- dev/auto_examples/convert_ieeg_to_bids.html | 18 ++-- dev/auto_examples/convert_mne_sample.html | 54 +++++------ dev/auto_examples/convert_mri_and_trans.html | 8 +- dev/auto_examples/convert_nirs_to_bids.html | 18 ++-- dev/auto_examples/create_bids_folder.html | 6 +- dev/auto_examples/mark_bad_channels.html | 8 +- dev/auto_examples/read_bids_datasets.html | 44 ++++----- .../rename_brainvision_files.html | 6 +- dev/auto_examples/sg_execution_times.html | 34 +++---- dev/auto_examples/update_bids_datasets.html | 8 +- dev/contribute.html | 6 +- dev/generated/cli.html | 6 +- dev/generated/mne_bids.BIDSPath.html | 6 +- dev/generated/mne_bids.anonymize_dataset.html | 6 +- .../mne_bids.convert_montage_to_mri.html | 6 +- .../mne_bids.convert_montage_to_ras.html | 6 +- ...e_bids.copyfiles.copyfile_brainvision.html | 6 +- .../mne_bids.copyfiles.copyfile_bti.html | 6 +- .../mne_bids.copyfiles.copyfile_ctf.html | 6 +- .../mne_bids.copyfiles.copyfile_edf.html | 6 +- .../mne_bids.copyfiles.copyfile_eeglab.html | 6 +- .../mne_bids.copyfiles.copyfile_kit.html | 6 +- .../mne_bids.find_matching_paths.html | 6 +- .../mne_bids.get_anat_landmarks.html | 6 +- .../mne_bids.get_anonymization_daysback.html | 6 +- .../mne_bids.get_bids_path_from_fname.html | 6 +- dev/generated/mne_bids.get_datatypes.html | 6 +- .../mne_bids.get_entities_from_fname.html | 6 +- dev/generated/mne_bids.get_entity_vals.html | 6 +- .../mne_bids.get_head_mri_trans.html | 6 +- dev/generated/mne_bids.inspect_dataset.html | 6 +- .../mne_bids.make_dataset_description.html | 6 +- dev/generated/mne_bids.make_report.html | 6 +- dev/generated/mne_bids.mark_channels.html | 6 +- dev/generated/mne_bids.print_dir_tree.html | 6 +- dev/generated/mne_bids.read_raw_bids.html | 6 +- .../mne_bids.search_folder_for_text.html | 6 +- .../mne_bids.stats.count_events.html | 6 +- dev/generated/mne_bids.template_to_head.html | 6 +- .../mne_bids.update_anat_landmarks.html | 6 +- .../mne_bids.update_sidecar_json.html | 6 +- dev/generated/mne_bids.write_anat.html | 6 +- .../mne_bids.write_meg_calibration.html | 6 +- .../mne_bids.write_meg_crosstalk.html | 6 +- dev/generated/mne_bids.write_raw_bids.html | 18 ++-- dev/genindex.html | 6 +- dev/index.html | 6 +- dev/install.html | 6 +- dev/objects.inv | Bin 3759 -> 3759 bytes dev/py-modindex.html | 6 +- dev/search.html | 6 +- dev/searchindex.js | 2 +- dev/sg_execution_times.html | 34 +++---- dev/use.html | 6 +- dev/whats_new.html | 8 +- dev/whats_new_previous_releases.html | 6 +- 92 files changed, 452 insertions(+), 348 deletions(-) diff --git a/dev/.buildinfo b/dev/.buildinfo index 99c7dbdde..537a07127 100644 --- a/dev/.buildinfo +++ b/dev/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: e23d56b587a1ee1fc0b114670128f976 +config: 0b0b7b95720a924c3268f16ffab790cc tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/dev/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip b/dev/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip index 8c7b8c0718f29efcc7547b9543b9309368fb07f6..16ab5004d10c03dfeb651a6a9f9a74fb4db2bea3 100644 GIT binary patch delta 242 zcmaFe$M(99jVHjHnMH&F1a@X_fvUL3>tl%MHf=Ju!@#xQZ9$n;Ikj1EAfrhjQ>bOBm1-Kqsh&&izL(8A~l z;va5dbOKsAoxK&J&a;)#9cbnBNv%M6p#G~+TB4279BAeAz&4=xw#?~M+8CWd@;5>B L!OZD$?To$vzt3CS delta 242 zcmaFe$M(99jVHjHnMH&F1ekm_@|==odhfmYhU^w?rgz?(`#gL3nVx!YmW@o41MyqS zPbx4y_ud>Z!$196

&!e3=;>6OyAVZ=m0co`j=)#7oZi>ty+NeQ}5{wEsTyJ z{^1rzC!m$n*;^s%JX;yvfmTkR)C!ab>c0x5CE6IxfmTirYy*n_^`1VZjnNq-e-lJ= L_)M2;XY>UCJcLw% diff --git a/dev/_downloads/268d987293d4ee80f1e0d3ca84cf1bd4/read_bids_datasets.zip b/dev/_downloads/268d987293d4ee80f1e0d3ca84cf1bd4/read_bids_datasets.zip index 5d955dd28fd6cdc96debe3197747b2bb519ad490..2a98fd437bde260a5de67791dc088c5eb85fdd0e 100644 GIT binary patch delta 45 xcmeC0&Db@Ykte{LnMH&F1ZHGz4xIo1 diff --git a/dev/_downloads/4643fc773d02dab3aa626f7f7d767950/convert_mne_sample.zip b/dev/_downloads/4643fc773d02dab3aa626f7f7d767950/convert_mne_sample.zip index 5ae083ea9e179536d40300ba1c5869e93d44dff1..03b6e676839028e8911fe8714c635f090f86d446 100644 GIT binary patch delta 45 xcmeBOz}UNhkte{LnMH&F1m8bbR8h=M1ck+IJKL8Sp48LSPB delta 43 scmZ2czoMQez?+#xgaHINd^Ylgh%<5cY)%qiuMVUq3)?$`s0jN20O1}AGXMYp diff --git a/dev/_downloads/5d54d38fa89e77a34bdfd9413b4fbe4f/convert_group_studies.zip b/dev/_downloads/5d54d38fa89e77a34bdfd9413b4fbe4f/convert_group_studies.zip index 0e4678d452112c08779f61cb061f5913a912a1dc..b29a5ed09d246bf776f1113efa00419c52bcb469 100644 GIT binary patch delta 43 vcmdlHz9XC`z?+#xgaHJWXKv)_KAjab!#v^h} zJ2JPgT+PUt2@=^N!c-*9bSQJXh5^%hb*6)v({F||IRovTE*HV%4m5XqI*4A7IekL} zlMB$^>E9xlTtT#LBv2htzA2K)3ux{1bCE##ote``q9Als6q6N*KMlm+kvaWN6q6f> QuM!QU4`oiziDn7_0LD>ULI3~& delta 247 zcmdn9opaB2PM!d7W)=|!5a96H$fK#n^w)c{xz=1eruW{PuVpkzGd=g-9M!^N$n?&8 zbHdi2U^@EwA~m4=_W!($AB35ndT;-z$avL&iOFaCi6F)>J`h78k@285i1E0G@rWD~ zqtEu0s~I^nK_Xj3n2MyCIDEEi7%;6@2QsGL3}>B)jF<{-+;#RUM{VF}Fu diff --git a/dev/_downloads/7d2e2f052d27d212228870d603a1aca7/convert_ieeg_to_bids.zip b/dev/_downloads/7d2e2f052d27d212228870d603a1aca7/convert_ieeg_to_bids.zip index 9ed093a343aa55b37278de4480c33dbf7b1b72b5..f8d78364b8b9db2c12f95861b895ef96b81a73b9 100644 GIT binary patch delta 45 ycmX^4jp^h!CY}IqW)=|!5ZIQvk!NNg(~iu|%LBPHnYLw4-m=RX$esLiR{#KMC=qJ_ delta 45 ycmX^4jp^h!CY}IqW)=|!5cuo8k!NNg6Qj@O<$>IpOn<#6Z`tJxfp>&eV1WQR}n=00gBA#sB~S diff --git a/dev/_downloads/b5991261ea1afda327daaddd3f69dfac/create_bids_folder.zip b/dev/_downloads/b5991261ea1afda327daaddd3f69dfac/create_bids_folder.zip index e8614d2796bf6fbebe36d72c7ca98b6b66b0850a..1f84e4ae3b61b08b24de5fed284a037e0640bceb 100644 GIT binary patch delta 43 tcmdm|vrmU7z?+#xgaHJ0W^UwhWoO!%xjC3Uf)7YfUMuPdqCSZF0Ra9J4IKag delta 43 scmdm|vrmU7z?+#xgaHJYd^Ym9vNJLHYz}6R-~-Z=*NQrVs1Krk0LC{7%>V!Z diff --git a/dev/_downloads/bdc50d7de6c227351cc05fc714c0362c/anonymize_dataset.zip b/dev/_downloads/bdc50d7de6c227351cc05fc714c0362c/anonymize_dataset.zip index 0f985e86f10b5fe9747e508f8cbbf5a3bc1f9627..f2764c1a6e0c817a4e63de72f6253c621f14e5f3 100644 GIT binary patch delta 45 ycmbO-k#WjIMxFp~W)=|!5ZIZyk>`{w)4|NmH)OT7n097PX7z9Yawofc_yPbY0}b5( delta 45 xcmbO-k#WjIMxFp~W)=|!5Mc7z$a6}TiNj~}4Owk1CMKWBtR4{iW)AG#C*A;#n0_n+Df}B8qT2l|{ delta 45 vcmaF9jPdz0MxFp~W)=|!5P0Xkk>{iW(>w3Y*A;#n0_n+Df}B8qWv>v8 diff --git a/dev/_downloads/d90b2c92d1a1159e30b2143cd51843b4/convert_mri_and_trans.zip b/dev/_downloads/d90b2c92d1a1159e30b2143cd51843b4/convert_mri_and_trans.zip index d011145113ecd120f8600a4bc7f2ddede062c1a8..d426a7a0364465f14b26be1ffe2b78cc7e2c745b 100644 GIT binary patch delta 45 ycmex$mGReAMxFp~W)=|!5Ll79k!OoG)3(gbhqUM0F|Ej)oSfwXkoN%*md5jzI3@9z8z*BX$l6 delta 43 vcmcZ=dn=YFz?+#xgaHH?eKztG^D{B|Y;NQ~Cdb6+Guczm5y+j~qvrx&Ax diff --git a/dev/_modules/index.html b/dev/_modules/index.html index 4c9c77672..bf42da6d8 100644 --- a/dev/_modules/index.html +++ b/dev/_modules/index.html @@ -7,7 +7,7 @@ - Overview: module code — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + Overview: module code — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/copyfiles.html b/dev/_modules/mne_bids/copyfiles.html index f25f2c7d5..eb47d28fe 100644 --- a/dev/_modules/mne_bids/copyfiles.html +++ b/dev/_modules/mne_bids/copyfiles.html @@ -7,7 +7,7 @@ - mne_bids.copyfiles — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.copyfiles — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/dig.html b/dev/_modules/mne_bids/dig.html index 29566132c..a1ebe5e29 100644 --- a/dev/_modules/mne_bids/dig.html +++ b/dev/_modules/mne_bids/dig.html @@ -7,7 +7,7 @@ - mne_bids.dig — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.dig — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/inspect.html b/dev/_modules/mne_bids/inspect.html index e5a655317..aebbce71c 100644 --- a/dev/_modules/mne_bids/inspect.html +++ b/dev/_modules/mne_bids/inspect.html @@ -7,7 +7,7 @@ - mne_bids.inspect — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.inspect — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/path.html b/dev/_modules/mne_bids/path.html index c9645aafb..7678f7810 100644 --- a/dev/_modules/mne_bids/path.html +++ b/dev/_modules/mne_bids/path.html @@ -7,7 +7,7 @@ - mne_bids.path — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.path — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/read.html b/dev/_modules/mne_bids/read.html index 33eeb5b4b..31d625c02 100644 --- a/dev/_modules/mne_bids/read.html +++ b/dev/_modules/mne_bids/read.html @@ -7,7 +7,7 @@ - mne_bids.read — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.read — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

@@ -679,7 +679,7 @@

Source code for mne_bids.read

 
     # If we have events, convert them to Annotations so they can be easily
     # merged with existing Annotations.
-    if events.size > 0:
+    if events.size > 0 and event_id is not None:
         ids_without_desc = set(events[:, 2]) - set(event_id.values())
         if ids_without_desc:
             raise ValueError(
@@ -710,6 +710,22 @@ 

Source code for mne_bids.read

         raw.set_annotations(annotations)
         del id_to_desc_map, annotations, new_annotations
 
+    if events.size > 0 and event_id is None:
+        new_annotations = mne.annotations_from_events(
+            events=events,
+            sfreq=raw.info["sfreq"],
+            orig_time=raw.annotations.orig_time,
+        )
+
+        raw = raw.copy()  # Don't alter the original.
+        annotations = raw.annotations.copy()
+
+        # We use `+=` here because `Annotations.__iadd__()` does the right
+        # thing and also performs a sanity check on `Annotations.orig_time`.
+        annotations += new_annotations
+        raw.set_annotations(annotations)
+        del annotations, new_annotations
+
     # Now convert the Annotations to events.
     all_events, all_desc = events_from_annotations(
         raw,
diff --git a/dev/_modules/mne_bids/report/_report.html b/dev/_modules/mne_bids/report/_report.html
index a08b046d3..ae8e928c1 100644
--- a/dev/_modules/mne_bids/report/_report.html
+++ b/dev/_modules/mne_bids/report/_report.html
@@ -7,7 +7,7 @@
   
     
     
-    mne_bids.report._report — MNE-BIDS 0.16.0.dev28+gf9199621 documentation
+    mne_bids.report._report — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation
   
   
   
@@ -40,7 +40,7 @@
 
   
 
-    
+    
     
     
     
@@ -147,7 +147,7 @@
   
   
   
-    

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/sidecar_updates.html b/dev/_modules/mne_bids/sidecar_updates.html index cb34a49fc..a16965f49 100644 --- a/dev/_modules/mne_bids/sidecar_updates.html +++ b/dev/_modules/mne_bids/sidecar_updates.html @@ -7,7 +7,7 @@ - mne_bids.sidecar_updates — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.sidecar_updates — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/stats.html b/dev/_modules/mne_bids/stats.html index 2a6fca251..b2fe621e3 100644 --- a/dev/_modules/mne_bids/stats.html +++ b/dev/_modules/mne_bids/stats.html @@ -7,7 +7,7 @@ - mne_bids.stats — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.stats — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/utils.html b/dev/_modules/mne_bids/utils.html index c245dc3b8..771be0eab 100644 --- a/dev/_modules/mne_bids/utils.html +++ b/dev/_modules/mne_bids/utils.html @@ -7,7 +7,7 @@ - mne_bids.utils — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.utils — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/_modules/mne_bids/write.html b/dev/_modules/mne_bids/write.html index df9fac4e8..3bfc604ba 100644 --- a/dev/_modules/mne_bids/write.html +++ b/dev/_modules/mne_bids/write.html @@ -7,7 +7,7 @@ - mne_bids.write — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + mne_bids.write — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -40,7 +40,7 @@ - + @@ -147,7 +147,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

@@ -776,7 +776,9 @@

Source code for mne_bids.write

     return fid_coords, coord_frame
 
 
-def _events_tsv(events, durations, raw, fname, trial_type, overwrite=False):
+def _events_tsv(
+    events, durations, raw, fname, trial_type, event_metadata=None, overwrite=False
+):
     """Create an events.tsv file and save it.
 
     This function will write the mandatory 'onset', and 'duration' columns as
@@ -800,6 +802,9 @@ 

Source code for mne_bids.write

     trial_type : dict | None
         Dictionary mapping a brief description key to an event id (value). For
         example {'Go': 1, 'No Go': 2}.
+    event_metadata : pandas.DataFrame | None
+        Additional metadata to be stored in the events.tsv file. Must have one
+        row per event.
     overwrite : bool
         Whether to overwrite the existing file.
         Defaults to False.
@@ -829,19 +834,30 @@ 

Source code for mne_bids.write

     else:
         del data["trial_type"]
 
+    if event_metadata is not None:
+        for key, values in event_metadata.items():
+            data[key] = values
+
     _write_tsv(fname, data, overwrite)
 
 
-def _events_json(fname, overwrite=False):
+def _events_json(fname, extra_columns=None, has_trial_type=True, overwrite=False):
     """Create participants.json for non-default columns in accompanying TSV.
 
     Parameters
     ----------
     fname : str | mne_bids.BIDSPath
         Output filename.
+    extra_columns : dict | None
+        Dictionary with additional columns to be added to the events.json file.
+    has_trial_type : bool
+        Whether the events.tsv file should contain a 'trial_type' column.
     overwrite : bool
         Whether to overwrite the output file if it exists.
     """
+    if extra_columns is None:
+        extra_columns = dict()
+
     new_data = {
         "onset": {
             "Description": (
@@ -871,9 +887,16 @@ 

Source code for mne_bids.write

                 "associated with the event."
             )
         },
-        "trial_type": {"Description": "The type, category, or name of the event."},
     }
 
+    if has_trial_type:
+        new_data["trial_type"] = {
+            "Description": "The type, category, or name of the event."
+        }
+
+    for key, value in extra_columns.items():
+        new_data[key] = {"Description": value}
+
     # make sure to append any JSON fields added by the user
     fname = Path(fname)
     if fname.exists():
@@ -1893,6 +1916,8 @@ 

Source code for mne_bids.write

     bids_path,
     events=None,
     event_id=None,
+    event_metadata=None,
+    extra_columns_descriptions=None,
     *,
     anonymize=None,
     format="auto",
@@ -1978,8 +2003,9 @@ 

Source code for mne_bids.write

            call ``raw.set_annotations(None)`` before invoking this function.
 
         .. note::
-           Descriptions of all event codes must be specified via the
-           ``event_id`` parameter.
+           Either, descriptions of all event codes must be specified via the
+           ``event_id`` parameter or each event must be accompanied by a
+           row in ``event_metadata``.
 
     event_id : dict | None
         Descriptions or names describing the event codes, if you passed
@@ -1990,6 +2016,11 @@ 

Source code for mne_bids.write

         contains :class:`~mne.Annotations`, you can use this parameter to
         assign event codes to each unique annotation description (mapping from
         description to event code).
+    event_metadata : pandas.DataFrame | None
+        Metadata for each event in ``events``. Each row corresponds to an event.
+    extra_columns_descriptions : dict | None
+        A dictionary that maps column names of the ``event_metadata`` to descriptions.
+        Each column of ``event_metadata`` must have a corresponding entry in this.
     anonymize : dict | None
         If `None` (default), no anonymization is performed.
         If a dictionary, data will be anonymized depending on the dictionary
@@ -2193,8 +2224,24 @@ 

Source code for mne_bids.write

             '"bids_path.task = <task>"'
         )
 
-    if events is not None and event_id is None:
-        raise ValueError("You passed events, but no event_id dictionary.")
+    if events is not None and event_id is None and event_metadata is None:
+        raise ValueError(
+            "You passed events, but no event_id dictionary " "or event_metadata."
+        )
+
+    if event_metadata is not None and extra_columns_descriptions is None:
+        raise ValueError(
+            "You passed event_metadata, but no "
+            "extra_columns_descriptions dictionary."
+        )
+
+    if event_metadata is not None:
+        for column in event_metadata.columns:
+            if column not in extra_columns_descriptions:
+                raise ValueError(
+                    f"Extra column {column} in event_metadata "
+                    f"is not described in extra_columns_descriptions."
+                )
 
     _validate_type(
         item=empty_room, item_name="empty_room", types=(mne.io.BaseRaw, BIDSPath, None)
@@ -2489,8 +2536,15 @@ 

Source code for mne_bids.write

     # Write events.
     if not data_is_emptyroom:
         events_array, event_dur, event_desc_id_map = _read_events(
-            events, event_id, raw, bids_path=bids_path
+            events,
+            event_id,
+            raw,
+            bids_path=bids_path,
         )
+
+        if event_metadata is not None:
+            event_desc_id_map = None
+
         if events_array.size != 0:
             _events_tsv(
                 events=events_array,
@@ -2498,9 +2552,17 @@ 

Source code for mne_bids.write

                 raw=raw,
                 fname=events_tsv_path.fpath,
                 trial_type=event_desc_id_map,
+                event_metadata=event_metadata,
+                overwrite=overwrite,
+            )
+            has_trial_type = event_desc_id_map is not None
+
+            _events_json(
+                fname=events_json_path.fpath,
+                extra_columns=extra_columns_descriptions,
+                has_trial_type=has_trial_type,
                 overwrite=overwrite,
             )
-            _events_json(fname=events_json_path.fpath, overwrite=overwrite)
         # Kepp events_array around for BrainVision writing below.
         del event_desc_id_map, events, event_id, event_dur
 
diff --git a/dev/_static/documentation_options.js b/dev/_static/documentation_options.js
index c343efb25..9ac2df90f 100644
--- a/dev/_static/documentation_options.js
+++ b/dev/_static/documentation_options.js
@@ -1,5 +1,5 @@
 const DOCUMENTATION_OPTIONS = {
-    VERSION: '0.16.0.dev28+gf9199621',
+    VERSION: '0.16.0.dev29+g471bd0cd',
     LANGUAGE: 'en',
     COLLAPSE_INDEX: false,
     BUILDER: 'html',
diff --git a/dev/api.html b/dev/api.html
index a9038cf94..f18c43e55 100644
--- a/dev/api.html
+++ b/dev/api.html
@@ -8,7 +8,7 @@
     
     
 
-    API Documentation — MNE-BIDS 0.16.0.dev28+gf9199621 documentation
+    API Documentation — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation
   
   
   
@@ -41,7 +41,7 @@
 
   
 
-    
+    
     
     
     
@@ -150,7 +150,7 @@
   
   
   
-    

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/authors.html b/dev/authors.html index 05ff1c7ae..caaf72778 100644 --- a/dev/authors.html +++ b/dev/authors.html @@ -8,7 +8,7 @@ - <no title> — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + <no title> — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -41,7 +41,7 @@ - + @@ -148,7 +148,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

diff --git a/dev/auto_examples/anonymize_dataset.html b/dev/auto_examples/anonymize_dataset.html index 56bcc7075..361c016e6 100644 --- a/dev/auto_examples/anonymize_dataset.html +++ b/dev/auto_examples/anonymize_dataset.html @@ -8,7 +8,7 @@ - 13. Anonymizing a BIDS dataset — MNE-BIDS 0.16.0.dev28+gf9199621 documentation + 13. Anonymizing a BIDS dataset — MNE-BIDS 0.16.0.dev29+g471bd0cd documentation @@ -41,7 +41,7 @@ - + @@ -151,7 +151,7 @@ -

MNE-BIDS 0.16.0.dev28+gf9199621 documentation

+

MNE-BIDS 0.16.0.dev29+g471bd0cd documentation

@@ -667,7 +667,7 @@

Basic anonymizationSpecifying subject IDsSpecifying subject IDsSpecifying subject IDs

@@ -922,9 +922,9 @@

ReproducibilityTotal running time of the script: (0 minutes 11.713 seconds)

+

Total running time of the script: (0 minutes 11.992 seconds)

@@ -772,8 +772,9 @@

Convert to BIDShttps://bids-standard.github.io/bids-validator/

Command line tool: https://www.npmjs.com/package/bids-validator

-

Total running time of the script: (0 minutes 0.356 seconds)

+

Total running time of the script: (0 minutes 0.355 seconds)

-

Total running time of the script: (0 minutes 2.037 seconds)

+

Total running time of the script: (0 minutes 2.147 seconds)

-

Total running time of the script: (0 minutes 1.282 seconds)

+

Total running time of the script: (0 minutes 1.281 seconds)

This should be very similar to the ds000248 dataset_description.json!

-

Total running time of the script: (0 minutes 3.901 seconds)

+

Total running time of the script: (0 minutes 3.921 seconds)

-

Total running time of the script: (0 minutes 13.117 seconds)

+

Total running time of the script: (0 minutes 13.297 seconds)