You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Do NOT define a new type via ``neurodata_type_def`` within the
77
+
# definition of another type. Always define the types separately
78
+
# and use ``neurodata_type_inc`` to include the type
79
+
type2_ext = NWBGroupSpec(
80
+
name='custom_type2',
81
+
doc='Example extension type 2',
82
+
neurodata_type_def='MyNewType2',
83
+
groups=[NWBGroupSpec(
84
+
name='custom_type1',
85
+
doc='Example extension type 1',
86
+
neurodata_type_def='MyNewType1',
87
+
neurodata_type_inc='LabMetaData',
88
+
)]
89
+
)
90
+
91
+
.. code-tab:: yaml YAML
92
+
93
+
groups:
94
+
- neurodata_type_def: MyNewType2
95
+
neurodata_type_inc: NWBContainer
96
+
name: custom_type2
97
+
doc: Example extension type 2
98
+
groups:
99
+
- neurodata_type_def: MyNewType1
100
+
neurodata_type_inc: LabMetaData
101
+
name: custom_type1
102
+
doc: Example extension type 1
103
+
104
+
Build on and reuse existing neurodata types
105
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
106
24
107
When possible, use existing types when creating extensions either by creating new ``neurodata_types`` that inherit from
25
108
existing ones, or by creating ``neurodata_types`` that contain existing ones. Building on existing types facilitates the
26
109
reuse of existing functionality and interpretation of the data. If a community extension already exists that has a
27
-
similar scope, it is preferable to use that extension rather than creating a new one.
110
+
similar scope, it is preferable to use that extension rather than creating a new one. For example:
111
+
112
+
* Extend :ref:`nwb-schema:sec-TimeSeries` for storing timeseries data. NWB provides main types of :ref:`nwb-schema:sec-TimeSeries`
113
+
and you should identify the most specific type of :ref:`nwb-schema:sec-TimeSeries` relevant for your use case
114
+
(e.g., extend :ref:`nwb-schema:sec-ElectricalSeries` to define a new kind of electrical recording).
115
+
* Extend :ref:`hdmf-schema:sec-dynamictable` to store tabular data.
116
+
* Extend :ref:`nwb-schema:sec-TimeIntervals` to store specific annotations of intervals in time.
117
+
28
118
119
+
Strive for backward compatible changes
120
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
121
30
-
Provide Documentation
122
+
NWB is already incorporated in many tools - proposing a change that will make already released NWB datasets non-compliant will cause a lot of confusion and will lead to significant cost to update codes.
123
+
124
+
125
+
Provide documentation
31
126
~~~~~~~~~~~~~~~~~~~~~
32
127
33
128
When creating extensions be sure to provide thorough, meaningful documentation as part of the extension specification.
34
129
Explain all fields (groups, datasets, attributes, links etc.) and describe what they store and how they
35
130
should be used.
36
131
37
132
38
-
Write the Specification to the NWBFile
133
+
Write the specification to the NWBFile
39
134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
135
41
136
You can store the specification (core and extension) within the NWBFile through caching.
@@ -45,3 +140,81 @@ anybody who receives the data also receives the necessary data to interpret it.
45
140
.. note::
46
141
In :pynwb-docs:`PyNWB <>`, the extension is cached automatically. This can be specified explicitly with
47
142
``io.write(filepath, cache_spec=True)``
143
+
144
+
145
+
Use Attributes for small metadata related to a particular data object (Group or Dataset)
One of the aims of NWB is to make reusing data easier. This means that when proposing an extension you need to put yourself in the shoes of someone who will receive an NWB dataset and attempt to analyze it. Additionally, consider developers that will try to write tools that take NWB datasets as inputs. It’s worth assessing how much additional code different ways of approaching your extension will lead to.
208
+
209
+
210
+
Use the ``ndx-template`` to create new extensions
211
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212
+
213
+
By using the :nwb_extension_git:`ndx-template` to create new extensions helps ensure
214
+
that extensions can be easily shared and reused and published via the :ndx-catalog:`NDX Catalog <>`.
215
+
216
+
217
+
Get the community involved
218
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
219
+
220
+
Try to reach out to colleagues working with the type of data you are trying to add support for. The more eyes you will get on your extension the better it will get.
0 commit comments