Skip to content

Commit 3e9fbd9

Browse files
committed
standardize docstrings using numpydoc format
1 parent 30f369c commit 3e9fbd9

File tree

17 files changed

+190
-149
lines changed

17 files changed

+190
-149
lines changed

neo/core/analogsignal.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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/dataobject.py

Lines changed: 16 additions & 10 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

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/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: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
"""

neo/core/spiketrain.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,13 @@ def time_shift(self, t_shift):
640640
"""
641641
Shifts a :class:`SpikeTrain` to start at a new time.
642642
643-
Parameters:
644-
-----------
643+
Parameters
644+
----------
645645
t_shift: Quantity (time)
646646
Amount of time by which to shift the :class:`SpikeTrain`.
647647
648-
Returns:
649-
--------
648+
Returns
649+
-------
650650
spiketrain: :class:`SpikeTrain`
651651
New instance of a :class:`SpikeTrain` object starting at t_shift later than the
652652
original :class:`SpikeTrain` (the original :class:`SpikeTrain` is not modified).

neo/io/axonio.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class AxonIO(AxonRawIO, BaseFromRaw):
2828
- `AxonIO._sampling_rate`
2929
3030
The current AxonIO.read_protocol() method utilizes a subset of these.
31-
In particular I know it doesn't consider `nDigitalEnable`, `EpochInfo`, or `nActiveDACChannel` and it doesn't account
31+
In particular I know it doesn't consider `nDigitalEnable`, `EpochInfo`, or `nActiveDACChannel` and it doesn't account
3232
for different types of Epochs offered by Clampex/pClamp other than discrete steps (such as ramp, pulse train, etc and
33-
encoded by `nEpochType` in the EpochInfoPerDAC section). I'm currently parsing a superset of the properties used
33+
encoded by `nEpochType` in the EpochInfoPerDAC section). I'm currently parsing a superset of the properties used
3434
by read_protocol() in my analysis scripts, but that code still doesn't parse the full information and isn't in a state
3535
where it could be committed and I can't currently prioritize putting together all the code that would parse the full
3636
set of data. The `AxonIO._axon_info['EpochInfo']` section doesn't currently exist.
@@ -47,8 +47,11 @@ def read_protocol(self):
4747
Read the protocol waveform of the file, if present;
4848
function works with ABF2 only. Protocols can be reconstructed
4949
from the ABF1 header.
50-
Returns: list of segments (one for every episode)
51-
with list of analog signls (one for every DAC).
50+
51+
Returns
52+
-------
53+
segments : list of segments
54+
Segments, one for every episode, with list of analog signls (one for every DAC).
5255
"""
5356
sigs_by_segments, sig_names, sig_units = self.read_raw_protocol()
5457
segments = []

neo/io/elphyio.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,8 +3811,10 @@ def read_block(self, lazy=False, ):
38113811
"""
38123812
Return :class:`Block`.
38133813
3814-
Parameters:
3815-
lazy : postpone actual reading of the file.
3814+
Parameters
3815+
----------
3816+
lazy : bool
3817+
Postpone actual reading of the file.
38163818
"""
38173819
assert not lazy, 'Do not support lazy'
38183820

@@ -4211,9 +4213,11 @@ def get_annotations_dict(self, annotations, prefix, items, name='', idx=0):
42114213
def read_segment(self, episode):
42124214
"""
42134215
Internal method used to return :class:`Segment` data to the main read method.
4214-
Parameters:
4215-
elphy_file : is the elphy object.
4216-
episode : number of elphy episode, roughly corresponding to a segment
4216+
4217+
Parameters
4218+
----------
4219+
episode : int
4220+
Number of elphy episode, roughly corresponding to a segment
42174221
"""
42184222
# print "name:",self.elphy_file.layout.get_episode_name(episode)
42194223
episode_name = self.elphy_file.layout.get_episode_name(episode)
@@ -4254,10 +4258,12 @@ def read_event(self, episode, evt):
42544258
Internal method used to return a list of elphy :class:`EventArray` acquired from event
42554259
channels.
42564260
4257-
Parameters:
4258-
elphy_file : is the elphy object.
4259-
episode : number of elphy episode, roughly corresponding to a segment.
4260-
evt : index of the event.
4261+
Parameters
4262+
----------
4263+
episode : int
4264+
Number of elphy episode, roughly corresponding to a segment.
4265+
evt : int
4266+
Index of the event.
42614267
"""
42624268
event = self.elphy_file.get_event(episode, evt)
42634269
neo_event = Event(
@@ -4270,10 +4276,12 @@ def read_spiketrain(self, episode, spk):
42704276
"""
42714277
Internal method used to return an elphy object :class:`SpikeTrain`.
42724278
4273-
Parameters:
4274-
elphy_file : is the elphy object.
4275-
episode : number of elphy episode, roughly corresponding to a segment.
4276-
spk : index of the spike array.
4279+
Parameters
4280+
----------
4281+
episode : int
4282+
Number of elphy episode, roughly corresponding to a segment.
4283+
spk : int
4284+
Index of the spike array.
42774285
"""
42784286
block = self.elphy_file.layout.episode_block(episode)
42794287
spike = self.elphy_file.get_spiketrain(episode, spk)

neo/io/igorproio.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,21 @@ def key_value_string_parser(itemsep=";", kvsep=":"):
173173
"""
174174
Parses a string into a dict.
175175
176-
Arguments:
177-
itemsep - character which separates items
178-
kvsep - character which separates the key and value within an item
179-
180-
Returns:
176+
Parameters
177+
----------
178+
itemsep : str
179+
Character which separates items
180+
kvsep : str
181+
Character which separates the key and value within an item
182+
183+
Returns
184+
-------
185+
callable
181186
a function which takes the string to be parsed as the sole argument
182187
and returns a dict.
183188
184-
Example:
189+
Examples
190+
--------
185191
186192
>>> parse = key_value_string_parser(itemsep=";", kvsep=":")
187193
>>> parse("a:2;b:3")

0 commit comments

Comments
 (0)