Skip to content

Commit e3b85ae

Browse files
committed
Tidy some docstring explanations
1 parent fedead3 commit e3b85ae

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

movement/utils/broadcasting.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def make_broadcastable( # noqa: C901
147147
Returns
148148
-------
149149
Decorator
150-
Decorator function that can be applied with the usual ``@decorator``
151-
syntax. See Notes for a description of the action of the returned
152-
decorator.
150+
Decorator function that can be applied with the
151+
``@make_broadcastable(...)`` syntax. See Notes for a description of
152+
the action of the returned decorator.
153153
154154
Notes
155155
-----
@@ -158,9 +158,10 @@ def make_broadcastable( # noqa: C901
158158
axes of an input ``xarray.xr.DataArray``.
159159
160160
The ``r_decorator`` takes a single parameter, ``f``. ``f`` should be a
161-
``Callable`` that acts on 1D data, that is to be converted into a
161+
``Callable`` that acts on 1D inputs, that is to be converted into a
162162
broadcast-able function ``fr``, applying the action of ``f`` along an axis
163-
of an ``xarray.xr.DataArray``.
163+
of an ``xarray.xr.DataArray``. ``f`` should return either scalar or 1D
164+
outputs.
164165
165166
If ``f`` is a class method, it should be callable as
166167
``f(self, [x, y, ...], \*args, \*\*kwargs)``.
@@ -175,6 +176,9 @@ def make_broadcastable( # noqa: C901
175176
The ``\*args`` and ``\*\*kwargs`` match those passed to ``f``, and retain
176177
the same interpretations and effects on the result.
177178
179+
See the docstring of ``make_broadcastable_inner`` in the source code for a
180+
more explicit explanation of the returned decorator.
181+
178182
See Also
179183
--------
180184
broadcastable_method : Convenience alias for ``is_classmethod = True``.
@@ -218,24 +222,26 @@ def make_broadcastable( # noqa: C901
218222
def make_broadcastable_inner(
219223
f: DecoratorInput,
220224
) -> FunctionDaToDa:
221-
"""Broadcast a 1D function along a ``xr.DataArray`` dimension.
225+
r"""Broadcast a 1D function along a ``xr.DataArray`` dimension.
222226
223227
Parameters
224228
----------
225229
f : Callable
226230
1D function to be converted into a broadcast-able function,, that
227-
returns a scalar value. If ``f`` is a class method, it should be
228-
callable as ``f(self, [x, y, ...], *args, **kwargs)``. Otherwise,
229-
``f`` should be callable as ``f([x, y, ...], *args, **kwargs).
231+
returns either a scalar value or 1D output. If ``f`` is a class
232+
method, it should be callable as
233+
``f(self, [x, y, ...], *args, **kwargs)``.
234+
Otherwise, ``f`` should be callable as
235+
``f([x, y, ...], *args, **kwargs).
230236
231237
Returns
232238
-------
233239
Callable
234240
Callable with signature
235241
``(self,) data, *args, broadcast_dimension = str, **kwargs``,
236242
that applies ``f`` along the ``broadcast_dimension`` of ``data``.
237-
``args`` and ``kwargs`` match those passed to ``f``, and retain the
238-
same interpretations.
243+
``\*args`` and ``\*\*kwargs`` match those passed to ``f``, and
244+
retain the same interpretations.
239245
240246
Notes
241247
-----

0 commit comments

Comments
 (0)