Skip to content

Commit e0ae2fe

Browse files
committed
DOC - fix docstrings to allow latex doc build
Several docstrings lacked an intro line before the first section (often the Parameters section). This caused errors in the latex build of the automated API docs.
1 parent 5458f80 commit e0ae2fe

File tree

3 files changed

+43
-28
lines changed

3 files changed

+43
-28
lines changed

nipy/labs/spatial_models/discrete_domain.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ class MeshDomain(object):
291291
"""
292292

293293
def __init__(self, coord, triangles):
294-
"""
294+
""" Initialize mesh domain instance
295+
295296
Parameters
296297
----------
297298
coord: array of shape (n_vertices, 3),
@@ -305,7 +306,8 @@ def __init__(self, coord, triangles):
305306
# fixme: implement consistency checks
306307

307308
def area(self):
308-
"""
309+
""" Return array of areas for each node
310+
309311
Returns
310312
-------
311313
area: array of shape self.V,
@@ -404,7 +406,8 @@ class DiscreteDomain(object):
404406
"""
405407

406408
def __init__(self, dim, coord, local_volume, id='', referential=''):
407-
"""
409+
""" Initialize discrete domain instance
410+
408411
Parameters
409412
----------
410413
dim: int,
@@ -567,7 +570,8 @@ class StructuredDomain(DiscreteDomain):
567570

568571
def __init__(self, dim, coord, local_volume, topology, did='',
569572
referential=''):
570-
"""
573+
""" Initialize structured domain instance
574+
571575
Parameters
572576
----------
573577
dim: int,
@@ -622,7 +626,8 @@ class NDGridDomain(StructuredDomain):
622626

623627
def __init__(self, dim, ijk, shape, affine, local_volume, topology,
624628
referential=''):
625-
"""
629+
""" Initialize ndgrid domain instance
630+
626631
Parameters
627632
----------
628633
dim: int,

nipy/labs/spatial_models/mroi.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from nibabel import load, save, Nifti1Image
77

8-
import discrete_domain as ddom
8+
from . import discrete_domain as ddom
99

1010
##############################################################################
1111
# class MultiROI
@@ -19,7 +19,8 @@ class MultiROI(object):
1919
"""
2020

2121
def __init__(self, domain, k, rid=''):
22-
"""
22+
""" Initialize multi ROI instance
23+
2324
Parameters
2425
----------
2526
domain: ROI instance
@@ -75,7 +76,8 @@ class SubDomains(object):
7576
"""
7677

7778
def __init__(self, domain, label, id='', no_empty_label=True):
78-
"""
79+
""" Initialize subdomains instance
80+
7981
Parameters
8082
----------
8183
domain: ROI instance
@@ -209,16 +211,16 @@ def select(self, valid, id='', auto=True, no_empty_label=True):
209211
return SD
210212

211213
def make_feature(self, fid, data, override=True):
212-
"""Extract a set of ffeatures from a domain map
214+
"""Extract a set of features from a domain map
213215
214216
Parameters
215217
----------
216-
fid: string,
217-
feature identifier
218+
fid: string
219+
feature identifier
218220
data: array of shape(deomain.size) or (domain, size, dim),
219-
domain map from which ROI features are axtracted
221+
domain map from which ROI features are axtracted
220222
override: bool, optional,
221-
Allow feature overriding
223+
Allow feature overriding
222224
"""
223225
if data.shape[0] != self.domain.size:
224226
raise ValueError("Incorrect data provided")
@@ -333,7 +335,7 @@ def plot_feature(self, fid, ax=None):
333335
334336
Parameters
335337
----------
336-
fid: string,
338+
fid: string
337339
the feature identifier
338340
ax: axis handle, optional
339341
"""
@@ -349,11 +351,14 @@ def plot_feature(self, fid, ax=None):
349351
return ax
350352

351353
def set_roi_feature(self, fid, data):
352-
"""
354+
""" Set feature defined by `fid` and `data` into ``self``
355+
353356
Parameters
354357
----------
355-
fid: string, feature identifier
356-
data: array of shape(self.k, p), with p>0
358+
fid: string
359+
feature identifier
360+
data: array
361+
shape(self.k, p), with p>0
357362
"""
358363
if data.shape[0] != self.k:
359364
print data.shape[0], self.k, fid
@@ -368,15 +373,15 @@ def get_roi_feature(self, fid):
368373
return self.roi_features[fid]
369374

370375
def to_image(self, path=None, descrip=None, write_type=np.int16, data=None):
371-
""" Generates and possiblly writes a label image that represents self.
376+
""" Generates and possibly writes a label image that represents self.
372377
373378
Parameters
374379
----------
375380
path: string, optional
376381
output image path
377-
descrip: string, optional,
382+
descrip: string, optional
378383
descritpion associated with the output image
379-
write_type: string, optional,
384+
write_type: string, optional
380385
type of the written data
381386
data: array os shape (self.k), optional,
382387
information to write into the image
@@ -461,6 +466,7 @@ def subdomain_from_position_and_image(nim, pos):
461466
"""
462467
keeps the set of labels of the image corresponding to a certain index
463468
so that their position is closest to the prescribed one
469+
464470
Parameters
465471
----------
466472
mim: NiftiIImage instance, or string path toward such an image
@@ -482,11 +488,11 @@ def subdomain_from_balls(domain, positions, radii):
482488
Parameters
483489
----------
484490
domain: StructuredDomain instance,
485-
the description of a discrete domain
491+
the description of a discrete domain
486492
positions: array of shape(k, dim):
487-
the positions of the balls
493+
the positions of the balls
488494
radii: array of shape(k):
489-
the sphere radii
495+
the sphere radii
490496
"""
491497
# checks
492498
if np.size(positions) == positions.shape[0]:

nipy/labs/spatial_models/parcellation.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class MultiSubjectParcellation(object):
3333

3434
def __init__(self, domain, template_labels=None, individual_labels=None,
3535
nb_parcel=None):
36-
"""
36+
""" Initialize multi-subject parcellation
37+
3738
Parameters
3839
----------
3940
domain: discrete_domain.DiscreteDomain instance,
@@ -159,13 +160,15 @@ def make_feature(self, fid, data):
159160
return pfeature
160161

161162
def set_feature(self, fid, data):
162-
"""
163+
""" Set feature defined by `fid` and `data` into ``self``
164+
163165
Parameters
164166
----------
165-
fid: string, the feature identifier
167+
fid: string
168+
the feature identifier
166169
data: array of shape (self.nb_parcel, self.nb_subj, dim) or
167170
(self.nb_parcel, self.nb_subj)
168-
the data to be set as parcel- and subject-level information
171+
the data to be set as parcel- and subject-level information
169172
"""
170173
if len(data.shape) < 2:
171174
raise ValueError("Data array should at least have dimension 2")
@@ -176,7 +179,8 @@ def set_feature(self, fid, data):
176179
self.features.update({fid: data})
177180

178181
def get_feature(self, fid):
179-
"""
182+
""" Get feature defined by `fid`
183+
180184
Parameters
181185
----------
182186
fid: string, the feature identifier

0 commit comments

Comments
 (0)