Debian Codegraph @

docs/source/news.rst

raw
1 ######################
2 Changes in version 1.5
3 ######################
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 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:
8
9 .. code-block:: python
10
11 import nixio
12 print("Opening in ReadOnly mode is possible.")
13 nixfile = nixio.File.open("old_format_file.nix", nixio.FileMode.ReadOnly)
14 print("file format version:", f.version)
15
16 print("Opening in ReadWrite model will fail:")
17 nixfile = nixio.File.open("old_format_file.nix", nixio.FileMode.ReadWrite)
18
19 .. code-block:: text
20
21 Opening in ReadOnly mode is possible.
22 File format version: (1, 1, 0)
23 Opening in ReadWrite model will fail:
24 159 if mode == FileMode.ReadWrite:
25 160 if not can_write(self):
26 --> 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.
34
35 .. code-block:: bash
36
37 nixio upgrade --help
38
39
40 Or implement conversion into your code:
41
42 .. code-block:: python
43
44 import nixio
45 filename = "test.nix"
46 nixio.file_upgrade(filename, quiet=False)
47
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.**
49
50 Model changes
51 #############
52
53 * the metadata model was simplified to reflect 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 Entity 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).
55 * *Tags* and *MultiTags* can link to DataFrames as features.
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).
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.
58
59 API changes
60 ###########
61
62 * ``DataArray.append_alias_range_dimension`` has been removed. Use ``DataArray.append_range_dimension_using_self`` for the same effect.
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.
64 * ``Block.create_data_array`` has additional keyword-arguments to directly provide label and unit.
65
66 Misc
67 ####
68
69 Extended command line tool abilities; The ``nixio`` command line tool now bundles commands for validating files, upgrading old files to the current version, and to explore file content.
70
71 .. code-block:: bash
72
73 nixio --help
74
75 .. code-block:: text
76
77 usage: nixio [-h] {explore,validate,upgrade}
78
79 Command line interface for nixio tools
80
81 optional arguments:
82 -h, --help show this help message and exit
83
84 commands:
85 {explore,validate,upgrade}
86 explore Search for information within NIX file(s). Use the "file" command for general
87 information about the file(s). The verbose flag can be used to get more detailed
88 information about the file structure. Multiple -v options increase the
89 verbosity. (e.g. 'nixio explore file nix_file -vvv' for most detailed output).
90 The "metadata" (mdata) and "data" commands provide further options for finding
91 and viewing data and metadata information. With the "dump" subcommand data can
92 be dumped to file (up to 3D data). The "plot" command is only available if the
93 nixworks package is installed (https://github.com/G-node/nixworks). NOTE: This
94 tool is under active development. Please use the github issue tracker
95 (https://github.com/G-node/nixpy/issues) for bug reports and feature requests.
96 validate Validate NIX files for missing or inconsistent objects and annotations.
97 upgrade Upgrade NIX files to newest file format version.