Skip to content

Commit f62bd73

Browse files
Merge pull request #1143 from TomDonoghue/docmn
[DOC] - Maintenance of in-code comments and docstrings
2 parents 77ec668 + 3e9fbd9 commit f62bd73

40 files changed

+282
-241
lines changed

neo/core/analogsignal.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This module implements :class:`AnalogSignal`, an array of analog signals.
33
44
:class:`AnalogSignal` inherits from :class:`basesignal.BaseSignal` which
5-
derives from :class:`BaseNeo`, and from :class:`quantites.Quantity`which
5+
derives from :class:`BaseNeo`, and from :class:`quantities.Quantity`which
66
in turn inherits from :class:`numpy.array`.
77
88
Inheritance from :class:`numpy.array` is explained here:
@@ -481,13 +481,13 @@ def time_shift(self, t_shift):
481481
"""
482482
Shifts a :class:`AnalogSignal` to start at a new time.
483483
484-
Parameters:
485-
-----------
484+
Parameters
485+
----------
486486
t_shift: Quantity (time)
487487
Amount of time by which to shift the :class:`AnalogSignal`.
488488
489-
Returns:
490-
--------
489+
Returns
490+
-------
491491
new_sig: :class:`AnalogSignal`
492492
New instance of a :class:`AnalogSignal` object starting at t_shift later than the
493493
original :class:`AnalogSignal` (the original :class:`AnalogSignal` is not modified).
@@ -538,19 +538,19 @@ def downsample(self, downsampling_factor, **kwargs):
538538
arguments, except for specifying the axis of resampling, which is fixed to the first axis
539539
here.
540540
541-
Parameters:
542-
-----------
543-
downsampling_factor: integer
541+
Parameters
542+
----------
543+
downsampling_factor: int
544544
Factor used for decimation of samples. Scipy recommends to call decimate multiple times
545545
for downsampling factors higher than 13 when using IIR downsampling (default).
546546
547-
Returns:
548-
--------
547+
Returns
548+
-------
549549
downsampled_signal: :class:`AnalogSignal`
550550
New instance of a :class:`AnalogSignal` object containing the resampled data points.
551551
The original :class:`AnalogSignal` is not modified.
552552
553-
Note:
553+
Notes
554554
-----
555555
For resampling the signal with a fixed number of samples, see `resample` method.
556556
"""
@@ -581,19 +581,19 @@ def resample(self, sample_count, **kwargs):
581581
arguments, except for specifying the axis of resampling which is fixed to the first axis
582582
here, and the sample positions. .
583583
584-
Parameters:
585-
-----------
586-
sample_count: integer
584+
Parameters
585+
----------
586+
sample_count: int
587587
Number of desired samples. The resulting signal starts at the same sample as the
588588
original and is sampled regularly.
589589
590-
Returns:
591-
--------
590+
Returns
591+
-------
592592
resampled_signal: :class:`AnalogSignal`
593593
New instance of a :class:`AnalogSignal` object containing the resampled data points.
594594
The original :class:`AnalogSignal` is not modified.
595595
596-
Note:
596+
Notes
597597
-----
598598
For reducing the number of samples to a fraction of the original, see `downsample` method
599599
"""
@@ -625,8 +625,8 @@ def rectify(self, **kwargs):
625625
This method is a wrapper of numpy.absolute() and accepts the same set of keyword
626626
arguments.
627627
628-
Returns:
629-
--------
628+
Returns
629+
-------
630630
resampled_signal: :class:`AnalogSignal`
631631
New instance of a :class:`AnalogSignal` object containing the rectified data points.
632632
The original :class:`AnalogSignal` is not modified.

neo/core/basesignal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,4 +311,4 @@ def concatenate(self, *signals):
311311
If `other` object has incompatible attributes.
312312
'''
313313

314-
NotImplementedError('Patching need to be implemented in sublcasses')
314+
NotImplementedError('Patching need to be implemented in subclasses')

neo/core/block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'''
22
This module defines :class:`Block`, the main container gathering all the data,
3-
whether discrete or continous, for a given recording session. base class
3+
whether discrete or continuous, for a given recording session. base class
44
used by all :module:`neo.core` classes.
55
66
:class:`Block` derives from :class:`Container`,
@@ -14,7 +14,7 @@
1414

1515
class Block(Container):
1616
'''
17-
Main container gathering all the data, whether discrete or continous, for a
17+
Main container gathering all the data, whether discrete or continuous, for a
1818
given recording session.
1919
2020
A block is not necessarily temporally homogeneous, in contrast to :class:`Segment`.
@@ -78,7 +78,7 @@ def __init__(self, name=None, description=None, file_origin=None,
7878
file_datetime=None, rec_datetime=None, index=None,
7979
**annotations):
8080
'''
81-
Initalize a new :class:`Block` instance.
81+
Initialize a new :class:`Block` instance.
8282
'''
8383
super().__init__(name=name, description=description,
8484
file_origin=file_origin, **annotations)

neo/core/container.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class Container(BaseNeo):
228228
def __init__(self, name=None, description=None, file_origin=None,
229229
**annotations):
230230
"""
231-
Initalize a new :class:`Container` instance.
231+
Initialize a new :class:`Container` instance.
232232
"""
233233
super().__init__(name=name, description=description,
234234
file_origin=file_origin, **annotations)
@@ -466,7 +466,7 @@ def create_many_to_one_relationship(self, force=False, recursive=True):
466466
that this method will link up.
467467
468468
If force is True overwrite any existing relationships
469-
If recursive is True desecend into child objects and create
469+
If recursive is True descend into child objects and create
470470
relationships there
471471
"""
472472
parent_name = _reference_name(self.__class__.__name__)
@@ -485,7 +485,7 @@ def create_many_to_many_relationship(self, append=True, recursive=True):
485485
of this type, put the current object in the parent list.
486486
487487
If append is True add it to the list, otherwise overwrite the list.
488-
If recursive is True desecend into child objects and create
488+
If recursive is True descend into child objects and create
489489
relationships there
490490
"""
491491
parent_name = _container_name(self.__class__.__name__)
@@ -517,7 +517,7 @@ def create_relationship(self, force=False, append=True, recursive=True):
517517
518518
If force is True overwrite any existing relationships
519519
If append is True add it to the list, otherwise overwrite the list.
520-
If recursive is True desecend into child objects and create
520+
If recursive is True descend into child objects and create
521521
relationships there
522522
"""
523523
self.create_many_to_one_relationship(force=force, recursive=False)

neo/core/dataobject.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,22 @@ def _normalize_array_annotations(value, length):
1818
Recursively check that value is either an array or list containing only "simple" types
1919
(number, string, date/time) or is a dict of those.
2020
21-
Args:
22-
:value: (np.ndarray, list or dict) value to be checked for consistency
23-
:length: (int) required length of the array annotation
24-
25-
Returns:
26-
np.ndarray The array_annotations from value in correct form
27-
28-
Raises:
29-
ValueError: In case value is not accepted as array_annotation(s)
30-
21+
Parameters
22+
----------
23+
value : np.ndarray or list or dict
24+
Value to be checked for consistency.
25+
length : int
26+
Required length of the array annotation.
27+
28+
Returns
29+
-------
30+
np.ndarray
31+
The array_annotations from value in correct form
32+
33+
Raises
34+
------
35+
ValueError
36+
In case value is not accepted as array_annotation(s)
3137
"""
3238

3339
# First stage, resolve dict of annotations into single annotations
@@ -124,7 +130,7 @@ def _check_single_elem(element):
124130

125131
# Check the first element for correctness
126132
# If its type is correct for annotations, all others are correct as well
127-
# Note: Emtpy lists cannot reach this point
133+
# Note: Empty lists cannot reach this point
128134
_check_single_elem(value[0])
129135

130136
return value

neo/core/epoch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,13 @@ def time_shift(self, t_shift):
318318
"""
319319
Shifts an :class:`Epoch` by an amount of time.
320320
321-
Parameters:
322-
-----------
321+
Parameters
322+
----------
323323
t_shift: Quantity (time)
324324
Amount of time by which to shift the :class:`Epoch`.
325325
326-
Returns:
327-
--------
326+
Returns
327+
-------
328328
epoch: :class:`Epoch`
329329
New instance of an :class:`Epoch` object starting at t_shift later than the
330330
original :class:`Epoch` (the original :class:`Epoch` is not modified).

neo/core/event.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,13 @@ def time_shift(self, t_shift):
287287
"""
288288
Shifts an :class:`Event` by an amount of time.
289289
290-
Parameters:
291-
-----------
290+
Parameters
291+
----------
292292
t_shift: Quantity (time)
293293
Amount of time by which to shift the :class:`Event`.
294294
295-
Returns:
296-
--------
295+
Returns
296+
-------
297297
epoch: Event
298298
New instance of an :class:`Event` object starting at t_shift later than the
299299
original :class:`Event` (the original :class:`Event` is not modified).

neo/core/imagesequence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This module implements :class:`ImageSequence`, a 3D array.
33
44
:class:`ImageSequence` inherits from :class:`basesignal.BaseSignal` which
5-
derives from :class:`BaseNeo`, and from :class:`quantites.Quantity`which
5+
derives from :class:`BaseNeo`, and from :class:`quantities.Quantity`which
66
in turn inherits from :class:`numpy.array`.
77
88
Inheritance from :class:`numpy.array` is explained here:

neo/core/irregularlysampledsignal.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,14 @@ def resample(self, sample_count, **kwargs):
356356
arguments, except for specifying the axis of resampling which is fixed to the first axis
357357
here, and the sample positions. .
358358
359-
Parameters:
360-
-----------
361-
sample_count: integer
359+
Parameters
360+
----------
361+
sample_count: int
362362
Number of desired samples. The resulting signal starts at the same sample as the
363363
original and is sampled regularly.
364364
365-
Returns:
366-
--------
365+
Returns
366+
-------
367367
resampled_signal: :class:`AnalogSignal`
368368
New instance of a :class:`AnalogSignal` object containing the resampled data points.
369369
The original :class:`AnalogSignal` is not modified.
@@ -431,13 +431,13 @@ def time_shift(self, t_shift):
431431
"""
432432
Shifts a :class:`IrregularlySampledSignal` to start at a new time.
433433
434-
Parameters:
435-
-----------
434+
Parameters
435+
----------
436436
t_shift: Quantity (time)
437437
Amount of time by which to shift the :class:`IrregularlySampledSignal`.
438438
439-
Returns:
440-
--------
439+
Returns
440+
-------
441441
new_sig: :class:`SpikeTrain`
442442
New instance of a :class:`IrregularlySampledSignal` object
443443
starting at t_shift later than the original :class:`IrregularlySampledSignal`

neo/core/segment.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Segment(Container):
2020
'''
2121
A container for data sharing a common time basis.
2222
23-
A :class:`Segment` is a heterogeneous container for discrete or continous
23+
A :class:`Segment` is a heterogeneous container for discrete or continuous
2424
data sharing a common clock (time basis) but not necessary the same
2525
sampling rate, start or end time.
2626
@@ -145,25 +145,22 @@ def time_slice(self, t_start=None, t_stop=None, reset_time=False, **kwargs):
145145
Creates a time slice of a Segment containing slices of all child
146146
objects.
147147
148-
Parameters:
149-
-----------
148+
Parameters
149+
----------
150150
t_start: Quantity
151151
Starting time of the sliced time window.
152152
t_stop: Quantity
153153
Stop time of the sliced time window.
154-
reset_time: bool
154+
reset_time: bool, optional, default: False
155155
If True the time stamps of all sliced objects are set to fall
156156
in the range from t_start to t_stop.
157157
If False, original time stamps are retained.
158-
Default is False.
159-
160-
Keyword Arguments:
161-
------------------
158+
**kwargs
162159
Additional keyword arguments used for initialization of the sliced
163160
Segment object.
164161
165-
Returns:
166-
--------
162+
Returns
163+
-------
167164
subseg: Segment
168165
Temporal slice of the original Segment from t_start to t_stop.
169166
"""

0 commit comments

Comments
 (0)