Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstrings to Classes #23

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()


@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:
```
```