Skip to content

Commit

Permalink
Merge pull request #23 from kaitj/docs/fix_docstrings
Browse files Browse the repository at this point in the history
Add docstrings to Classes
  • Loading branch information
kaitj authored Aug 29, 2023
2 parents 9475acf + 4530d8a commit 5b23f29
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 13 deletions.
38 changes: 34 additions & 4 deletions afids_utils/afids.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,27 @@
from afids_utils.exceptions import InvalidFiducialError, InvalidFileError


@attrs.define
@attrs.define(kw_only=True)
class AfidPosition:
"""Base class for a single AFID position"""
"""Base class for a single AFID position
Parameters
----------
label
Unique label for AFID
x
Spatial position along x-axis (in mm)
y
Spatial position along y-axis (in mm)
z
Spatial position along z-axis (in mm)
desc
Description for AFID (e.g. AC, PC)
"""

label: int = attrs.field()
x: float = attrs.field()
Expand All @@ -22,9 +40,21 @@ class AfidPosition:
desc: str = attrs.field(default="")


@attrs.define
@attrs.define(kw_only=True)
class AfidSet:
"""Base class for a set of AFIDs"""
"""Base class for a set of AFIDs
Parameters
----------
slicer_version
Version of Slicer associated with AfidSet
coord_system
Coordinate system AFIDs are placed in (e.g. RAS)
afids
List of AFID labels and their coordinates
"""

slicer_version: str = attrs.field()
coord_system: str = attrs.field()
Expand Down
4 changes: 2 additions & 2 deletions afids_utils/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Custom exceptions"""
"""Custom exceptions to raise for various errors"""


class InvalidFileError(Exception):
Expand All @@ -11,5 +11,5 @@ def __init__(self, message):
class InvalidFiducialError(Exception):
"""Exception for invalid fiducial selection"""

def __init__(self, message) -> None:
def __init__(self, message):
super().__init__(message)
9 changes: 7 additions & 2 deletions docs/api/afids.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
## afids_utils.afids

```{eval-rst}
.. autoclass: afids_utils.afids.AfidPosition
.. autoclass:: afids_utils.afids.AfidPosition
:members:
:exclude-members: label, desc, x, y, z
```

```{eval-rst}
.. autoclass:: afids_utils.afids.AfidSet
:members:
```
:exclude-members: slicer_version, coord_system, afids
```
7 changes: 2 additions & 5 deletions docs/exceptions/exceptions.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
## afids_utils.exceptions

```{eval-rst}
.. autoclass: afids_utils.exceptions.InvalidFileError
.. automodule:: afids_utils.exceptions
:members:
.. autoclass:: afids_utils.exceptions.InvalidFiducialError
:members:
```
```

0 comments on commit 5b23f29

Please sign in to comment.