Skip to content

Commit

Permalink
Fix formatting in docs for map.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleaoman committed Oct 14, 2024
1 parent fe34d6d commit 53a695f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions swiftgalaxy/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,11 @@ def map(
Examples
--------
A simple example that applies a function `dm_median_position` to each galaxy in
a list of targets `[11, 22, 33]`:
A simple example that applies a function ``dm_median_position`` to each galaxy in
a list of targets ``[11, 22, 33]``:
::
from swiftgalaxy import SWIFTGalaxies, SOAP
# define the function that we will apply to each SWIFTGalaxy object:
Expand All @@ -688,14 +689,15 @@ def dm_median_position(sg):
)
my_result = sgs.map(dm_median_position)
The result stored in `my_result` contains the result of the function for the
galaxies at index `11`, `22` and `33`, in the same order as they are given in the
`soap_index` list.
The result stored in ``my_result`` contains the result of the function for the
galaxies at index ``11``, ``22`` and ``33``, in the same order as they are given
in the ``soap_index`` list.
This second example shows how to pass extra arguments and/or keyword arguments to
the function given to `map`:
the function given to ``map``:
::
from swiftgalaxy import SWIFTGalaxies, SOAP
# define the function that we will apply to each SWIFTGalaxy object:
Expand Down Expand Up @@ -742,6 +744,7 @@ def dm_median_position(
a tuple, for instance:
::
args=[
(my_extra_arg_for_galaxy_11, ),
(my_extra_arg_for_galaxy_22, ),
Expand Down

0 comments on commit 53a695f

Please sign in to comment.