Skip to content

Commit df3f85d

Browse files
jgrewempsonntag
andauthored
[docs] Apply suggestions from code review
Co-authored-by: Michael Sonntag <[email protected]>
1 parent d3546cf commit df3f85d

File tree

10 files changed

+51
-52
lines changed

10 files changed

+51
-52
lines changed

docs/source/annotations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ If we do not know the exact path of the *Section* we are looking for, we need to
7171
.. literalinclude:: examples/annotations.py
7272
:lines: 28 - 31
7373

74-
The result of the ``find_sections`` will always be list which may be empty if no match was found. Therefore, the call in the last line is to some extent risky and would lead to an OutOfBounds exception if the search failed.
74+
The result of the ``find_sections`` will always be a list which may be empty if no match was found. Therefore, the call in the last line is to some extent risky and would lead to an ``OutOfBounds`` exception if the search failed.

docs/source/data_handling.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
Working with data
55
=================
66

7-
Storing data is one thing, but we want to work with it. The following examples illustrate reading of data from *DataArray*, *Tag* and *MultiTag* entities We will use the dummy dataset already used in the :doc:`tagging <./tagging>` example. The figure below shows what is stored in the dataset.
7+
Storing data is one thing, but we want to work with it. The following examples illustrate reading of data from *DataArray*, *Tag* and *MultiTag* entities. We will use the dummy dataset already used in the :doc:`tagging <./tagging>` example. The figure below shows what is stored in the dataset.
88

99
.. figure:: ./images/tag1.png
1010
:alt: a system's response to a stimulus
1111

12-
At some instance in time a system was exposed to a stimulus that leads to the system's response. The response has been recorded and stored in a *DataArray* the A *Tag* is used to highlight the "stimulus-on" segment of the data.
12+
At some instance in time a system was exposed to a stimulus that leads to the system's response. The response has been recorded and stored in a *DataArray*, a *Tag* is used to highlight the "stimulus-on" segment of the data.
1313

1414
.. literalinclude:: examples/tagging_example.py
1515
:caption: :download:`example code <examples/tagging_example.py>`
@@ -29,7 +29,7 @@ The first and maybe most common problem is to read the data stored in a
2929
Reading all data
3030
~~~~~~~~~~~~~~~~
3131

32-
In *NIX* when you open a *DataArray* the stored the data is **not** automatically read from file. This keeps the object lightweight and easy to create. To read the data you can simply access the data in a numpy style:
32+
In *NIX* when you open a *DataArray* the stored data is **not** automatically read from file. This keeps the object lightweight and easy to create. To read the data you can simply access it in a numpy style:
3333

3434
.. literalinclude:: examples/tagging_example.py
3535
:caption: :download:`example code <examples/tagging_example.py>`
@@ -52,21 +52,21 @@ Reading partial data
5252
~~~~~~~~~~~~~~~~~~~~
5353

5454
In other instances it might be wanted to read only parts of the data.
55-
Reading slices of the data ist straight forward using the the numpy style.
55+
Reading slices of the data is straight forward using the numpy style.
5656

5757
.. literalinclude:: examples/tagging_example.py
5858
:caption: :download:`example code <examples/tagging_example.py>`
5959
:lines: 98-101
6060

61-
An alternative approach is to use the ``DataArray.get_slice`` method which by default works with indices but can also work in data coordinates. E.g. we know that the data is 1-D and covers a span of 3.5s and we want to have the data in the interval 0.5s through 1.75s. The method returns a ``nixio.DataView`` object. The actual reading is done be accessing the data.
61+
An alternative approach is to use the ``DataArray.get_slice`` method which by default works with indices but can also work in data coordinates. E.g. we know that the data is 1-D and covers a span of 3.5s and we want to have the data in the interval 0.5s through 1.75s. The method returns a ``nixio.DataView`` object. The actual reading is done by accessing the data.
6262

6363
.. literalinclude:: examples/tagging_example.py
6464
:caption: :download:`example code <examples/tagging_example.py>`
6565
:lines: 103-106
6666
:emphasize-lines: 3
6767

6868
The arguments ``positions`` and ``extents`` are passed as lists. There must be one entry for each dimension of the data. In this case, since the data is 1-D, positions and extents are 1-element lists.
69-
Note: the slice is defined by the starting point(s) and the *extent(s)* not with start and end points.
69+
Note: the slice is defined by the starting point(s) and the *extent(s)*, not with start and end points.
7070

7171
Reading tagged data
7272
~~~~~~~~~~~~~~~~~~~
@@ -85,7 +85,7 @@ In order to read the data that belongs to the highlighted region(s) *Tag* and *M
8585
:emphasize-lines: 10
8686
:caption: Reading data segments tagged by the *Tag* or *MultiTag* can be done using the ``tagged_data`` method (:download:`example code <examples/multiple_regions.py>`).
8787

88-
The *MultiTag* version of the ``tagged_data`` method takes two arguments. The first is the index of the tagged region (0 for the first), the second argument is name (you can also use the index or the id) of the referenced *DataArray*. Since the *Tag* tags only a single region, it only takes one argument, i.e. the name (id, index) of the referenced *DataArray*.
88+
The *MultiTag* version of the ``tagged_data`` method takes two arguments. The first is the index of the tagged region (0 for the first), the second argument is the name of the referenced *DataArray* (you can also use the index or the id). Since the *Tag* tags only a single region, it takes only one argument, i.e. the name (id, index) of the referenced *DataArray*.
8989

9090
.. figure:: ./images/reading_tagged_data.png
9191
:alt: reading tagged data
@@ -98,4 +98,3 @@ obtained using the ``feature_data`` methods.
9898
:lines: 69 - 76
9999
:emphasize-lines: 6, 7
100100
:caption: ``feature_data`` works analogously, the first argument is the index of the tagged region, the second the name (or id or index) of the feature. Here the feature stores a single number, i.e. the frequency of the stimulus for each tagged region which is plotted below the highlighted regions in the figure above (:download:`example code <examples/multiple_regions.py>`).
101-

docs/source/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ units which is not supported/not necessarily possible for non-SI units.
2828
It is largely safe to use non-SI units when providing metadata or
2929
specifying the unit of the data stored in a *DataArray*. It may become
3030
problematic in the context of *Dimensions*. Some functions support
31-
reading data with the positions provided by the *Tags* in these cases we
31+
reading data with the positions provided by the *Tags*, in these cases we
3232
rely on scalability of the units.
3333

3434
If you feel this is unjustified, feel free to improve our unit-handling

docs/source/finding_things.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ the relations between entities.
1212

1313
Still, reading a *NIX* file that has been created by another person or
1414
has been automatically written by a recording tool such
15-
as [relacs](https://github.com/relacs/relacs) might be confusing a
15+
as [relacs](https://github.com/relacs/relacs) might be confusing at
1616
first. The following recommendation should help you when exploring an
1717
unknown file.
1818

@@ -42,8 +42,8 @@ Recommendations when opening an unknown NIX file
4242
Standardization helps
4343
---------------------
4444

45-
Having a well-defined data model and the respective APIsto store and
46-
annotate scientific data with a is a huge step toward standardization
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
4747
and reusability. As mentioned [before](./standardization.md), if the
4848
file is created according to known definitions, finding stuff in an
4949
unknown file is considerably simplified.
@@ -55,19 +55,19 @@ first channel and it is further known that the file is created e.g. by
5555

5656
.. code:: python
5757
58-
nixfile = nixio.File.open("relacs_example.nix", nix.FileMode.ReadOnly);
58+
nixfile = nixio.File.open("relacs_example.nix", nixio.FileMode.ReadOnly);
5959
block = f.blocks()[0];
6060
arrays = [da for da in block.data_arrays if "relacs.data.sampled.v-1" in da.type.lower()]
6161
6262
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 and to scan the metadata tree and
63+
assume a “metadata-centered” view, to scan the metadata tree and
6464
perform an inverse search from the metadata to the data entities that
6565
refer to the respective section. Accordingly, ``Section`` and ``Sources`` define
6666
methods to get the referring *DataArray*\ s, *Tag*\ s, etc..
6767

6868
.. code:: python
6969
70-
section = nixfile.sections()[0]
70+
s = nixfile.sections()[0]
7171
blocks = s.referring_blocks()
7272
for b in blocks:
7373
print(b)

docs/source/image_data.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ attribution in the code.
1616

1717
.. literalinclude:: examples/imageData.py
1818
:lines: 59-64
19-
:caption: Image data is just 3D data that can be easily stored in a *DataArray*. We need to add three dimension descriptors, though (to run the example you need the :download:`example code <examples/imageData.py>` , the :download:`image <examples/lenna.png>` *imagemagick* or *xv* packages).
19+
:caption: Image data is just 3-D data that can be easily stored in a *DataArray*. We need to add three dimension descriptors, though (to run the example you need the :download:`example code <examples/imageData.py>` , the :download:`image <examples/lenna.png>` *imagemagick* or *xv* packages).
2020

2121
.. image:: examples/lenna.png
2222
:alt: lenna
@@ -44,7 +44,7 @@ data. The same Tag can be applied to many references as long as
4444

4545
.. literalinclude:: examples/singleROI.py
4646
:lines: 80-84
47-
:caption: A *Tag* is used to tag a a single region of interest. Most image data is 3D with the third dimension representing the color channels (:download:`singleROI.py <examples/singleROI.py>`).
47+
:caption: A *Tag* is used to tag a a single region of interest. Most image data is 3-D with the third dimension representing the color channels (:download:`singleROI.py <examples/singleROI.py>`).
4848

4949
.. image:: images/single_roi.png
5050
:alt: single roi
@@ -64,7 +64,7 @@ For tagging multiple regions in the image data we again use a *MultiTag* entity.
6464
:alt: many rois
6565
:width: 240
6666

67-
The start positions and extents of the ROIs are stored in two separate *DataArrays*, these are each 2-D the first dimension represents the number of regions , the second defines the position/extent for each single dimension of the data (height, width, color channels).
67+
The start positions and extents of the ROIs are stored in two separate *DataArrays*, these are each 2-D, the first dimension represents the number of regions, the second defines the position/extent for each single dimension of the data (height, width, color channels).
6868

6969
The *MultiTag* has a ``tagged_data`` method that is used to retrieve the data tagged by the *MultiTag*.
7070

@@ -74,4 +74,4 @@ The *MultiTag* has a ``tagged_data`` method that is used to retrieve the data ta
7474

7575
.. image:: images/retrieved_rois.png
7676
:alt: many rois
77-
:width: 240
77+
:width: 240

docs/source/news.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Pass ``quiet=False`` in order to get some feedback on what the tool did. **Note:
5050
Model changes
5151
#############
5252

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).
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 Entitiy 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).
5454
* New *DataFrame* entity that stores tabular data. Each column has a name, unit, and data type. (see :ref:`The DataFrame` for more information).
5555
* *Tags* and *MultiTags* can link to DataFrames as features.
5656
* *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).
@@ -94,4 +94,4 @@ Extended command line tool abilities; The ``nixio`` command line tool now bundle
9494
tool is under active development. Please use the github issue tracker
9595
(https://github.com/G-node/nixpy/issues) for bug reports and feature requests.
9696
validate Validate NIX files for missing or inconsistent objects and annotations.
97-
upgrade Upgrade NIX files to newest file format version.
97+
upgrade Upgrade NIX files to newest file format version.

docs/source/sources.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ subject.
2323
As mentioned above the Sources build a tree. The block (as the root of the tree) at the moment has only a single source attached to it
2424

2525
.. literalinclude:: examples/sources.py
26-
:lines: 53 - 55
26+
:lines: 52 - 54
2727

2828
The output should yield:
2929

@@ -39,7 +39,7 @@ Search and find
3939
In a data-centered search we can then ask the *DataArray* for it's *Source* to get information about the cell and get the linked metadata. A *DataArray* may have several sources attached to it. To make sure we get the right one (with the cell information) we perform a search on the sources using the **type** information.
4040

4141
.. literalinclude:: examples/sources.py
42-
:lines: 59 - 61
42+
:lines: 58 - 60
4343

4444
The output should give
4545

@@ -53,10 +53,10 @@ The output should give
5353
|- BaselineRate: (15,)Hz
5454
|- Layer: ('4',)
5555
56-
In a or source-centered search we can ask for the *DataArrays* that link to a source.
56+
In a source-centered search we can ask for the *DataArrays* that link to a source.
5757

5858
.. literalinclude:: examples/sources.py
59-
:lines: 63
59+
:lines: 62
6060

6161
This should return a list with a single entry:
6262

docs/source/spike_time_data.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Spike time data
55

66
Storing the times of spikes (action potentials) that are generated by neurons is one of the most common use cases.
77

8-
The data shown below is simulation data created using a Leaky Integrate and Fire (LIF)model neuron. To run the example codes in this section you will need the :download:`lif model <examples/lif.py>`.
8+
The data shown below is simulation data created using a Leaky Integrate and Fire (LIF) model neuron. To run the example codes in this section you will need the :download:`lif model <examples/lif.py>`.
99

1010
.. literalinclude:: examples/spikeTagging.py
1111
:lines: 58-78
@@ -20,7 +20,7 @@ The data shown below is simulation data created using a Leaky Integrate and Fire
2020
Adding features
2121
---------------
2222

23-
The following code shows how to use the **Features** of the NIX-model. Suppose that we have the recording of a signal in which a set of events is detected. Each event may have certain characteristics one wants to store. These are stored as **Features** of the events. There are three different link-types between the features and the events stored in the tag. *nix.LinkType.Untagged* indicates that the whole data stored in the **Feature** applies to the points defined in the tag. *nix.LinkType.Tagged* on the other side implies that the *position* and *extent* have to be applied also to the data stored in the **Feature**. Finally, the *nix.LinkType.Indexed* indicates that there is one point (or slice) in the **Feature** data that is related to each position in the Tag.
23+
The following code shows how to use the **Features** of the NIX-model. Suppose that we have the recording of a signal in which a set of events is detected. Each event may have certain characteristics one wants to store. These are stored as **Features** of the events. There are three different link-types between the features and the events stored in the tag. *nix.LinkType.Untagged* indicates that the whole data stored in the **Feature** applies to the points defined in the tag. *nix.LinkType.Tagged* on the other side implies that the *position* and *extent* have to be applied also to the data stored in the **Feature**. Finally, the *nix.LinkType.Indexed* indicates that there is one point (or slice) in the **Feature** data that is related to each position in the tag.
2424

2525
The following examples show how this works.
2626

@@ -29,7 +29,7 @@ The following examples show how this works.
2929
Tagging stimulus segments
3030
-------------------------
3131

32-
Let's say we record the neuronal activity and in a certain epoch of that recording a stimulus was presented. This time interval is annotated using a **Tag**. This inidicates the time in which the stimulus was on but we may also want to link the stimulus itself to it. The stimulus is also stored as a **DataArray** be linked to the *Tag* as an *untagged* **Feature** of it.
32+
Let's say we record the neuronal activity and in a certain epoch of that recording a stimulus was presented. This time interval is annotated using a **Tag**. This inidicates the time in which the stimulus was on but we may also want to link the stimulus itself to it. The stimulus is also stored as a **DataArray** and can be linked to the *Tag* as an *untagged* **Feature** of it.
3333

3434
.. literalinclude:: examples/untaggedFeature.py
3535
:lines: 111-122
@@ -39,7 +39,7 @@ Let's say we record the neuronal activity and in a certain epoch of that recordi
3939
.. image:: images/untagged_feature.png
4040
:alt: untagged feature
4141

42-
In the recorded membrane voltage data is 10s long and we tag the interval between ``stimulus_onset`` and ``stimulus_onset + stimulus_duration`` (from 1 to 9 seconds). The stimulus itself is only 8s long and was played in the tagged interval. We use a *Tag* to bind stimulus and recorded signal together. The data stored in the "untagged" feature is the whole stimulus. The *Tag's* position and extent do not apply to the stimulus trace.
42+
The recorded membrane voltage data is 10s long and we tag the interval between ``stimulus_onset`` and ``stimulus_onset + stimulus_duration`` (from 1 to 9 seconds). The stimulus itself is only 8s long and was played in the tagged interval. We use a *Tag* to bind stimulus and recorded signal together. The data stored in the "untagged" feature is the whole stimulus. The *Tag's* position and extent do not apply to the stimulus trace.
4343

4444
.. _tagged_feature:
4545

@@ -72,8 +72,8 @@ different flags that define how this link has to be interpreted. In this case th
7272
position has to be used as an index in the first dimension of the Feature data. The **LinkType** has to be set to *indexed*.
7373

7474
.. literalinclude:: examples/spikeFeatures.py
75-
:lines: 135-147
76-
:caption: From the stimulus, a set of snippets has been extracted and stored in 2D-DataArray. To be used as an ``Indexed`` feature it must be organized that the first dimension represents the number of snippets. The second dimension is the time. (:download:`example code <examples/spikeFeatures.py>`).
75+
:lines: 130-135
76+
:caption: From the stimulus, a set of snippets has been extracted and stored in a 2-D DataArray. To be used as an ``Indexed`` feature it must be organized that the first dimension represents the number of snippets. The second dimension is the time. (:download:`example code <examples/spikeFeatures.py>`).
7777

7878
.. figure:: images/spike_features.png
7979
:alt: indexed feature

0 commit comments

Comments
 (0)