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
The DynamicTable data type that NWB uses allows you to define custom columns, which offer a high degree of flexibility.
4
+
The :nwb-schema:ref:`dynamictable` data type stores tabular data. It also allows you to define custom columns, which offer a high
5
+
degree of flexibility.
5
6
6
7
7
8
@@ -10,38 +11,89 @@ The DynamicTable data type that NWB uses allows you to define custom columns, wh
10
11
Tables With Only a Single Row
11
12
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12
13
13
-
It is not common to save a table with only a single row entry. Consider other ``neurodata_types``, such as a one-dimensional :nwb-schema:ref:`sec-TimeSeries` or any of its subtypes.
14
+
It is not common to save a table with only a single row entry. Consider other ``neurodata_types``, such as a one-dimensional :nwb-schema:ref:`sec-TimeSeries`.
Store data with long columns rather than long rows. When constructing dynamic tables, keep in mind that the data is stored by column, so it will be
25
-
inefficient to store data in a table with many columns.
26
-
bools
25
+
Store data with long columns rather than long rows. When constructing dynamic tables, keep in mind that the data is
26
+
stored by column, so it will be less efficient to store data in a table that has many more columns than rows.
27
27
28
-
Check function :ref:`check_column_binary_capability <check_column_binary_capability>`
28
+
Check function :py:meth:`~nwbinspector.checks.tables.check_dynamic_table_region_data_validity`
29
29
30
30
31
31
32
+
.. _best_practice_column_binary_capability:
32
33
33
-
Use boolean values where appropriate. Although boolean values (True/False) are not used in the core schema, they are a supported data type, and we
34
-
encourage the use of DynamicTable columns with boolean values. For instance, boolean values would be appropriate for a correct custom column to the trials table.
35
-
times
34
+
Boolean Columns
35
+
~~~~~~~~~~~~~~~
36
36
37
-
Times are always stored in seconds in NWB. This rule applies to times in TimeSeries, TimeIntervals and across NWB:N in general. E.g., in TimeInterval
38
-
objects such as the trials and epochs table, start_time and stop_time should both be in seconds with respect to the timestamps_reference_time (which by
39
-
default is set to the session_start_time).
40
-
Additional time columns in TimeInterval tables (e.g., trials) should have _time as name suffix. E.g., if you add more times in the trials table, for
41
-
instance a subject response time, name it with _time at the end (e.g. response_time) and store the time values in seconds from the timestamps_reference_time,
42
-
just like start_time and stop_time.
37
+
Use boolean values where appropriate. Although boolean values (``True``/``False``) are not used in the core schema,
38
+
they are a supported data type, and we encourage the use of :nwb-schema:ref:`dynamictable` columns with boolean
39
+
values. It is also encouraged practice for boolean columns to be named ``is_condition`` where ``condition`` is
40
+
whatever the positive state of the variable is, e.g. you might create a column called ``is_correct`` that has boolean
41
+
values.
43
42
44
-
Set the timestamps_reference_time if you need to use a different reference time. Rather than relative times, it can in practice be useful to use a common
45
-
global reference time across files (e.g., Posix time). To do so, NWB:N allows users to set the timestamps_reference_time which serves as reference for all
46
-
timestamps in a file. By default, timestamp_reference_time is usually set to the session_start_time to use relative times.
47
-
electrodes: ‘location’
43
+
The reason for this practice is two-fold:
44
+
45
+
(i) It allows for easier user comprehension of the information by intuitively restricting the range of possible values
46
+
for the column; a user would otherwise have to extract all the values and calculate the unique set to see that there
47
+
are only two values.
48
+
49
+
(ii) For large amounts of data, it also saves storage space for the data within the HDF5 file by using the minimal
50
+
number of bytes per item. This can be especially importance if the repeated values are long strings or float casts of
51
+
``1`` and ``0``.
52
+
53
+
An example of a violation of this practice would be for a column of strings with the following values everywhere;
0 commit comments