Skip to content

Commit

Permalink
Merged in docs/strict_docs (pull request #281)
Browse files Browse the repository at this point in the history
make docs strict

Approved-by: Randy Taylor
  • Loading branch information
jrkerns committed Oct 27, 2023
2 parents ee37ea3 + bb8b717 commit 5cdf33d
Show file tree
Hide file tree
Showing 17 changed files with 71 additions and 60 deletions.
10 changes: 2 additions & 8 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ definitions:
- apt-get update
- python -m venv venv
- source venv/bin/activate
- pip install -r requirements-ram.txt
- pip install -r requirements-dev.txt
- pip freeze
artifacts:
- venv/**
Expand Down Expand Up @@ -247,6 +247,7 @@ definitions:
- apt-get update
- apt-get -y install curl
- curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
- pip freeze
# we want to dump this to file regardless of fail status so we can inspect if needed
- grype dir:. --only-fixed -o json > grype_results.json
- grype dir:. --only-fixed --fail-on high
Expand Down Expand Up @@ -305,13 +306,6 @@ pipelines:
- step: *vmat-tests
- step: *winston-lutz-tests
- step: *core-module-tests
- step:
<<: *grype-scanning
condition:
changesets:
includePaths:
- "requirements.txt"
- "requirements-ram.txt"

branches:
release*:
Expand Down
16 changes: 7 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"matplotlib.sphinxext.plot_directive",
"sphinx_copybutton",
]
Expand All @@ -43,13 +42,12 @@
autodoc_mock_imports = ["_tkinter", "tkinter"]

autoclass_content = "both"
autodoc_default_flags = [
"show-inheritance",
"members",
] # See: http://sphinx-doc.org/latest/ext/autodoc.html#confval-autodoc_default_flags
autodoc_member_order = "bysource"

napoleon_include_special_with_doc = False
autodoc_default_options = {
"show-inheritance": True,
"members": True,
"member-order": "bysource",
"ignore-module-all": True,
}


# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -158,7 +156,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down
3 changes: 1 addition & 2 deletions docs/source/core_modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Geometry Module
Profile Module
--------------

.. automodule:: pylinac.core.profile
:members:
See :ref:`profiles`.

I/O Module
----------
Expand Down
7 changes: 2 additions & 5 deletions docs/source/field_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ The inflection point via the Hill function is useful for both flat and FFF beams
The fitting of the function is best for low-resolution data, and is thus the default for ``DeviceFieldAnalysis``.
The Hill function, the sigmoid function, and 4-point non-linear regression belong to a family of logistic equations to fit a dual-curved value.
Since these fit a function to the data the resolution problems are eliminated. Some examples can be
seen `here <https://en.wikipedia.org/wiki/Sigmoid_function#Examples>`_. The generalized logistic function has helpful visuals as well
`here <https://en.wikipedia.org/wiki/Generalised_logistic_function>`_.
seen `here <https://en.wikipedia.org/wiki/Sigmoid_function#Examples>`__. The generalized logistic function has helpful visuals as well
`here <https://en.wikipedia.org/wiki/Generalised_logistic_function>`__.

The function used here is:

Expand Down Expand Up @@ -737,9 +737,6 @@ These are the classes a typical user may interface with.
.. autoclass:: pylinac.field_analysis.Interpolation
:members:

.. autoclass:: pylinac.field_analysis.Normalization
:members:

.. autoclass:: pylinac.field_analysis.Edge
:members:

Expand Down
6 changes: 3 additions & 3 deletions docs/source/log_analyzer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,10 @@ Trajectory logs in a MachineLogs instance can also be converted to CSV, just as
API Documentation
-----------------

Main classes
^^^^^^^^^^^^
Main interface
^^^^^^^^^^^^^^

These are the classes a typical user may interface with.
These are the classes and functions a typical user may interface with.

.. autofunction:: pylinac.log_analyzer.load_log

Expand Down
2 changes: 1 addition & 1 deletion docs/source/winston_lutz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ the radiation iso is not of interest. For large-field WL images, you may need to
parameter to True. This is because the automatic inversion of the WL module assumes a small field is being delivered.
For large field deliveries, kV or MV, see about flipping this parameter if the analysis fails.

.. wl_cbct:
.. _wl_cbct:

CBCT Analysis
-------------
Expand Down
13 changes: 0 additions & 13 deletions docs/source/winston_lutz_multi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -468,26 +468,13 @@ with an output of::
API Documentation
-----------------

.. autoclass:: pylinac.winston_lutz.WinstonLutz
:members:

.. autoclass:: pylinac.winston_lutz.WinstonLutzMultiTargetMultiField
:members:

.. autoclass:: pylinac.winston_lutz.WinstonLutz2D
:members:

.. autoclass:: pylinac.winston_lutz.WinstonLutz2DMultiTarget
:members:

.. autoclass:: pylinac.winston_lutz.WinstonLutzResult
:members:
:inherited-members:

.. autoclass:: pylinac.winston_lutz.WinstonLutz2DResult
:members:
:inherited-members:

.. autoclass:: pylinac.winston_lutz.WinstonLutzMultiTargetMultiFieldResult
:members:
:inherited-members:
16 changes: 15 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,21 @@ def serve_docs(session):

@nox.session(python=False)
def build_docs(session):
session.run("sphinx-build", "docs/source", "docs/build")
"""Build the docs; used in CI pipelines to test the build. Will always rebuild and will always fail if there are any warnings"""
session.run(
"sphinx-build",
"docs/source",
"docs/build",
"-W",
"--keep-going",
"-j",
"auto",
"-a",
"-E",
"-b",
"html",
"-q",
)


@nox.session(python=False)
Expand Down
3 changes: 2 additions & 1 deletion pylinac/cheese.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def plot_rois(self, axis: plt.Axes) -> None:
class TomoCheeseModule(CheeseModule):
"""The pluggable module with user-accessible holes.
The ROIs of the inner circle are ~45 degrees apart. The ROIs of the outer circle are ~30 degrees apart
The ROIs of the inner circle are ~45 degrees apart. The ROIs of the outer circle are ~30 degrees apart.
"""

common_name = "Tomo Cheese"
Expand Down
3 changes: 2 additions & 1 deletion pylinac/core/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ def equate_images(image1: ImageLike, image2: ImageLike) -> tuple[ImageLike, Imag
Returns
-------
image1 : :class:`~pylinac.core.image.ArrayImage`
The first image equated.
image2 : :class:`~pylinac.core.image.ArrayImage`
The returns are new instances of Images.
The second image equated.
"""
image1 = copy.deepcopy(image1)
image2 = copy.deepcopy(image2)
Expand Down
4 changes: 4 additions & 0 deletions pylinac/core/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,13 @@ def __init__(
path : str
Path to the .prs file.
detector_row
The row that contains the detector data.
bias_row
The row that contains the bias data.
calibration_row
The row that contains the calibration data.
data_row
The row that contains the data.
data_columns
The range of columns that the data is in. Usually, there are some columns before and after the real data.
"""
Expand Down
11 changes: 9 additions & 2 deletions pylinac/ct.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ def __init__(
"""
Parameters
----------
catphan : `~pylinac.cbct.CatPhanBase` instance.
catphan : :class:`~pylinac.cbct.CatPhanBase` instance.
The catphan instance.
slice_num : int
The slice number of the DICOM array desired. If None, will use the ``slice_num`` property of subclass.
combine : bool
Expand Down Expand Up @@ -1001,8 +1003,10 @@ class CTP528CP504(CatPhanModule):
Attributes
----------
radius2linepairs_mm : float
The radius in mm to the line pairs.
"""

attr_name: str = "ctp528"
Expand Down Expand Up @@ -2068,11 +2072,12 @@ def analyze(
low_contrast_tolerance : int
The number of low-contrast bubbles needed to be "seen" to pass.
cnr_threshold : float, int
The threshold for "detecting" low-contrast image. See RTD for calculation info.
.. deprecated:: 3.0
Use visibility parameter instead.
The threshold for "detecting" low-contrast image. See RTD for calculation info.
zip_after : bool
If the CT images were not compressed before analysis and this is set to true, pylinac will compress
the analyzed images into a ZIP archive.
Expand All @@ -2090,9 +2095,11 @@ def analyze(
values are 0, 1, and 2.
.. warning:: This is the padding **on either side**. So a value of 1 => 3 slices, 2 => 5 slices, 3 => 7 slices, etc.
expected_hu_values
An optional dictionary of the expected HU values for the HU linearity module. The keys are the ROI names and the values
are the expected HU values. If a key is not present or the parameter is None, the default values will be used.
"""
self.localize()
ctp404, offset = self._get_module(CTP404CP504, raise_empty=True)
Expand Down
24 changes: 14 additions & 10 deletions pylinac/log_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,12 @@ def calc_map(
equal_aspect : bool
If True, make the y-direction the same resolution as x. If False, the y-axis will be equal to the number of leaves.
Returns
-------
numpy.ndarray
A numpy array reconstructing the actual fluence of the log. The size will
be the number of MLC pairs by 400 / resolution since the MLCs can move anywhere within the
40cm-wide linac head opening.
Returns
-------
numpy.ndarray
A numpy array reconstructing the actual fluence of the log. The size will
be the number of MLC pairs by 400 / resolution since the MLCs can move anywhere within the
40cm-wide linac head opening.
"""
height = MLC_FOV_HEIGHT_MM if not self._mlc.hdmlc else HDMLC_FOV_HEIGHT_MM
if equal_aspect:
Expand Down Expand Up @@ -852,16 +852,20 @@ def __init__(
"""
Parameters
----------
log_type: Dynalog, TrajectoryLog
log_type: :class:`~pylinac.log_analyzer.Dynalog`, :class:`~pylinac.log_analyzer.TrajectoryLog`
The log type.
snapshot_idx : array, list
The snapshots to be considered for RMS and error calculations (can be all snapshots or just when beam was on).
jaw_struct : Jaw_Struct
jaw_struct : :class:`~pylinac.log_analyzer.JawStruct`
The jaw structure.
hdmlc : boolean
If False (default), indicates a regular MLC model (e.g. Millennium 120).
If True, indicates an HD MLC model (e.g. Millennium 120 HD).
Attributes
----------
leaf_axes : dict containing :class:`~pylinac.log_analyzer.Axis`
The dictionary is keyed by the leaf number, with the Axis as the value.
Expand Down Expand Up @@ -2174,9 +2178,9 @@ class TrajectoryLogAxisData:
Collimator data in degrees.
gantry : :class:`~pylinac.log_analyzer.Axis`
Gantry data in degrees.
jaws : :class:`~pylinac.log_analyzer.Jaw_Struct`
jaws : :class:`~pylinac.log_analyzer.JawStruct`
Jaw data structure. Data in cm.
couch : :class:`~pylinac.log_analyzer.Couch_Struct`
couch : :class:`~pylinac.log_analyzer.CouchStruct`
Couch data structure. Data in cm.
mu : :class:`~pylinac.log_analyzer.Axis`
MU data in MU.
Expand Down
6 changes: 4 additions & 2 deletions pylinac/picketfence.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ def __init__(self, leaf_arrangement: list[tuple[int, float]], offset: float = 0)
Parameters
----------
leaf_arrangement: Description of the leaf arrangement. List of tuples containing the number of leaves and leaf width.
leaf_arrangement
Description of the leaf arrangement. List of tuples containing the number of leaves and leaf width.
E.g. (10, 5) is 10 leaves with 5mm widths.
offset: The offset in mm of the leaves. Used for asymmetric arrangements. E.g. -2.5mm will shift the arrangement 2.5mm to the left.
offset
The offset in mm of the leaves. Used for asymmetric arrangements. E.g. -2.5mm will shift the arrangement 2.5mm to the left.
"""
self.centers = []
self.widths = []
Expand Down
3 changes: 2 additions & 1 deletion pylinac/winston_lutz.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ def from_cbct_zip(cls, file: Path | str, raw_pixels: bool = False, **kwargs):
----------
file
Path to the archive file.
raw_pixels
raw_pixels
If True, uses the raw pixel values of the DICOM files. If False, uses the rescaled Hounsfield units.
Generally, this should be true.
kwargs
Expand Down Expand Up @@ -1439,6 +1439,7 @@ def plot_images(
Parameters
----------
axis : {'Gantry', 'Collimator', 'Couch', 'GB Combo', 'GBP Combo', 'All'}
The axis to plot.
show : bool
Whether to show the image.
split : bool
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
-r requirements.txt
black
bump2version
furo
google-cloud-storage
nox
Pillow==10.*
pre-commit
pytest
pytest-cov==3.0.0
Expand Down
2 changes: 1 addition & 1 deletion requirements-ram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ rich==12.4.4
scikit-image==0.19.1
scipy==1.7.3
six==1.16.0
sphinx==5.*
sphinx==7.*
sphinx-autobuild
sphinx-copybutton
tabulate~=0.9.0
Expand Down

0 comments on commit 5cdf33d

Please sign in to comment.