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
Copy file name to clipboardExpand all lines: docs/source/annotations.rst
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,35 @@ The *Sections* add much like dictionaries. To access e.g. the "resting potential
37
37
.. literalinclude:: examples/annotations.py
38
38
:lines: 26
39
39
40
+
Extending Properties
41
+
--------------------
42
+
43
+
Properties can carry multiple values and additional information such as a definition.
44
+
45
+
.. literalinclude:: examples/annotations.py
46
+
:lines: 33-35
47
+
48
+
Reading the values will return a tuple. This has the background that one cannot change a tuple. Changing the values stored in a *Property* can be done e.g. by the ``extend_values`` method
49
+
50
+
.. literalinclude:: examples/annotations.py
51
+
:lines: 37-38
52
+
53
+
One can extend it by single values or by lists of values.
54
+
55
+
The data type of all values must, however, be the same. Adding a number to the list of strings will fail with a ``TypeError``:
56
+
57
+
.. literalinclude:: examples/annotations.py
58
+
:lines: 40-43
59
+
60
+
.. code-block:: text
61
+
62
+
New data type '<class 'numpy.int64'>' is inconsistent with the Property's data type '<class 'numpy.str_'>'
63
+
64
+
**Note:** Once the property has been created, the data type can't be changed. One would need to create a replacement with the desired data type.
65
+
66
+
Finding annotations
67
+
-------------------
68
+
40
69
If we do not know the exact path of the *Section* we are looking for, we need to search it by passing a function (in this case a lambda function) to the ``find_section`` method. The following code shows two examples in which we look first for a section with a given name or second a section which contains a property with a certain name.
Copy file name to clipboardExpand all lines: docs/source/news.rst
+35-18Lines changed: 35 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,39 +2,57 @@
2
2
Changes in version 1.5
3
3
######################
4
4
5
-
With version 1.5 we introduced several changes on the library as well as on the data model side (nix model version 1.2). Some are even breaking changes.
6
-
1.5 libraries can open files that have been written with pre 1.5 libraries. Old files cannot be opened for ``ReadWrite`` access.
7
-
You may want to convert such files using the ``nixio`` command line tool that comes with the library or via also implement upgrade into a script.
5
+
With version 1.5 we introduced several changes on the library as well as on the data model side (nix model version 1.2). **Some of these changes are breaking changes.** That is, you may need to adapt your code. Or convert files (see below).
6
+
7
+
Files written with nixpy versions < 1.5 (model version 1.1) can be opened for reading **but not** for writing. Trying to do so will lead to an exception:
--> 161 raise RuntimeError("Cannot open file for writing. "
27
+
162 "Incompatible version.")
28
+
163 elif mode == FileMode.ReadOnly:
29
+
30
+
RuntimeError: Cannot open file for writing. Incompatible version.
31
+
32
+
33
+
You may want to convert such files using the ``nixio`` command line tool that comes with the library.
8
34
9
35
.. code-block:: bash
10
36
11
37
nixio upgrade --help
12
38
39
+
40
+
Or implement conversion into your code:
41
+
13
42
.. code-block:: python
14
43
15
44
import nixio
16
45
filename ="test.nix"
17
46
nixio.file_upgrade(filename, quiet=False)
18
47
19
-
Pass ``quiet=False`` in order to get some feedback on what the tool did. **Note** Files are replaced *in place*. Make sure to backup your files before upgrading.
48
+
Pass ``quiet=False`` in order to get some feedback on what the tool did. **Note: Files are replaced *in place*. Make sure to backup your files before upgrading.**
20
49
21
50
Model changes
22
51
#############
23
52
24
-
* the metadata model was simplified to reflects the changes introduced to the underlying **odml** data model. Accordingly the *Value* entity does no longer exist. New versions of the library can read but not write old data.
25
-
* New *DataFrame* entity.
53
+
* the metadata model was simplified to reflects the changes introduced to the underlying **odml** data model. Accordingly the *Value* entity does no longer exist. New versions of the library can read but not write old data. Experience showed that almost all use cases stored single Values in a *Property*. The overhead (code and also file size) of keeping each value in a separate Enitiy is not justified. The *Property* now keeps all information that was Value related, such as the uncertainty. If you want to store multiple values in a property this is still possible but they have to have the same data type. (see :ref:`Annotations with arbitrary metadata` for more information).
54
+
* New *DataFrame* entity that stores tabular data. Each column has a name, unit, and data type. (see :ref:`The DataFrame` for more information).
26
55
* *Tags* and *MultiTags* can link to DataFrames as features.
27
-
* *RangeDimension* can link to DataFrames as source for the ticks.
28
-
* *AliasRangeDimension* has been removed, the equivalent can be achieved with linking to a *DataArray*.
29
-
30
-
The *DataFrame*
31
-
###############
32
-
33
-
The *DataFrame* is a new entity that stored tabular data. Each column has a name, unit, and data type. (see :ref:`The DataFrame` for more information)
34
-
35
-
*RangeDimension*
36
-
################
37
-
38
56
* *RangeDimensions* ticks can now be stored within the dimension descriptor, or in linked DataArrays or DataFrames. Ticks must still be one-dimensional (see :ref:`RangeDimension` for more information).
39
57
* Because of the above change, the former *AliasRangeDimension* is no longer needed. The same functionality is achieved by linking the *RangeDimension* to the *DataArray* itself.
40
58
@@ -45,7 +63,6 @@ API changes
45
63
* ``SampledDimension.axis`` can now be called with an optional argument ``start_position`` to get an axis that starts at the given position. Starting at a given index is still possible.
46
64
* ``Block.create_data_array`` has additional keyword-arguments to directly provide label and unit.
0 commit comments