| 1 |
.. toctree:: |
| 2 |
:maxdepth: 1 |
| 3 |
|
| 4 |
Finding things |
| 5 |
============== |
| 6 |
|
| 7 |
NIX provides features to store data in a way that makes it |
| 8 |
understandable and discoverable by others. For example, **Name** and |
| 9 |
**Type** fields of the entities should help the human reader to find |
| 10 |
their ways through the file and make sense of the stored content and |
| 11 |
the relations between entities. |
| 12 |
|
| 13 |
Still, reading a *NIX* file that has been created by another person or |
| 14 |
has been automatically written by a recording tool such |
| 15 |
as [relacs](https://github.com/relacs/relacs) might be confusing at |
| 16 |
first. The following recommendation should help you when exploring an |
| 17 |
unknown file. |
| 18 |
|
| 19 |
Recommendations when opening an unknown NIX file |
| 20 |
------------------------------------------------ |
| 21 |
|
| 22 |
1. Find out how many *Blocks* are stored and try to understand what they |
| 23 |
stand for. In most cases there will be only one *Block* and in the |
| 24 |
`relacs <https://github.com/relacs/relacs>`__ use-case it will |
| 25 |
represent the recordings made on a single neuron. |
| 26 |
2. Within the *Block* look for *Group* entities. As indicated by the |
| 27 |
name, these group other entities and thus indicate some kind of |
| 28 |
common relation between the members of each group. |
| 29 |
3. Within *Group*\ s or, if there are no *Group*\ s, within the *Block* |
| 30 |
look out for *Tag*\ s and *MultiTag*\ s. These link between data |
| 31 |
carrying *DataArrays* and provide semantic background. |
| 32 |
4. For example, a *MultiTag* that has a type “stimulus_segment” quite |
| 33 |
clearly indicates that it highlights periods during which a stimulus |
| 34 |
was presented. |
| 35 |
5. For *Tag*\ s and *MultiTag*\ s take a look at the **references** |
| 36 |
which list all *DataArrays* that are tagged. One may further |
| 37 |
investigate the **features** which should provide more information on |
| 38 |
the tagged regions. |
| 39 |
6. Almost all entities can link to additional **metadata** that should |
| 40 |
contain information about the stored data. |
| 41 |
|
| 42 |
Standardization helps |
| 43 |
--------------------- |
| 44 |
|
| 45 |
Having a well-defined data model and the respective API store and |
| 46 |
annotate scientific data with related metadata is a huge step toward standardization |
| 47 |
and reusability. As mentioned [before](./standardization.md), if the |
| 48 |
file is created according to known definitions, finding stuff in an |
| 49 |
unknown file is considerably simplified. |
| 50 |
|
| 51 |
For example, in case one looks for the voltage recording made on the |
| 52 |
first channel and it is further known that the file is created e.g. by |
| 53 |
`relacs <https://github.com/relacs/relacs>`__ then one needs to look for |
| 54 |
“relacs.data.sampled.V-1” typed *DataArray*\ s: |
| 55 |
|
| 56 |
.. code:: python |
| 57 |
|
| 58 |
nixfile = nixio.File.open("relacs_example.nix", nixio.FileMode.ReadOnly); |
| 59 |
block = f.blocks()[0]; |
| 60 |
arrays = [da for da in block.data_arrays if "relacs.data.sampled.v-1" in da.type.lower()] |
| 61 |
|
| 62 |
With this kind of list comprehensions a large variety of searches can be easily performed. The above said assumes a “data-centered” view. The other way would be to |
| 63 |
assume a “metadata-centered” view, to scan the metadata tree and |
| 64 |
perform an inverse search from the metadata to the data entities that |
| 65 |
refer to the respective section. Accordingly, ``Section`` and ``Sources`` define |
| 66 |
methods to get the referring *DataArray*\ s, *Tag*\ s, etc.. |
| 67 |
|
| 68 |
.. code:: python |
| 69 |
|
| 70 |
s = nixfile.sections()[0] |
| 71 |
blocks = s.referring_blocks() |
| 72 |
for b in blocks: |
| 73 |
print(b) |