Skip to content

docs: clarify broadcasting example title, subtitle, and summary paragraph#882

Open
mujju-212 wants to merge 1 commit intoneuroinformatics-unit:mainfrom
mujju-212:docs/564-clarify-broadcasting-example
Open

docs: clarify broadcasting example title, subtitle, and summary paragraph#882
mujju-212 wants to merge 1 commit intoneuroinformatics-unit:mainfrom
mujju-212:docs/564-clarify-broadcasting-example

Conversation

@mujju-212
Copy link

@mujju-212 mujju-212 commented Mar 10, 2026

Summary

Addresses the first two checklist items from issue #564:

  • Find a more appropriate title + subtitle, and write an informative short paragraph description at the top.
  • Update the contents to make them easier to follow (separate follow-up PR)

What changed

1. Title (sphinx-gallery heading)

Before After
Broadcast functions across multi-dimensional data Apply custom functions across movement data dimensions

The old title used the technical term "broadcast" without context. The new title immediately conveys what you are doing (applying custom functions) and where (across a movement dataset), which is more informative for users browsing the example gallery.

2. Subtitle (second line of docstring)

Before After
Use the @make_broadcastable decorator to efficiently apply functions across any data dimension. Use the ``@make_broadcastable`` decorator to run your own analysis functions across all individuals, keypoints, and time frames—without nested loops.

The new subtitle names the concrete axes (individuals, keypoints, time frames) that users typically iterate over, and explicitly mentions the problem it solves (nested loops), giving readers an immediate reason to care.

3. Summary section (introductory paragraph)

The old summary jumped straight to describing the decorator, without first stating the problem. The new paragraph follows the structure:

  1. Problem — I have a function that works on a single (x, y) point; I want to apply it across the whole dataset.
  2. Naive solution — nested for loops are verbose, error-prone, and tightly coupled to the dataset shape.
  3. Solution@make_broadcastable decorates your function once, so it accepts an entire DataArray, applies along the chosen dimension, and returns a new DataArray with coordinates intact.
  4. Preview — this example uses a point-in-rectangle check as a case study.

References

Closes the first checkbox of #564. The second checkbox (content improvements) will be addressed in a separate PR as suggested in the issue.

Checklist

  • The code has been tested locally
  • Tests have been added to cover all new functionality (N/A — documentation only)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

Addresses the first two checklist items from issue neuroinformatics-unit#564:
- Rename the sphinx-gallery title from 'Broadcast functions across
  multi-dimensional data' to 'Apply custom functions across movement
  data dimensions', making the purpose immediately clear to readers
  who are not familiar with the term 'broadcasting'.
- Replace the vague subtitle with one that names the decorator, the
  problem it solves (nested loops), and the typical use-case
  (individuals / keypoints / time frames).
- Rewrite the Summary section with a short introductory paragraph that
  (1) states the motivating problem, (2) explains how @make_broadcastable
  solves it, and (3) previews the case study used throughout the example.

Refs neuroinformatics-unit#564
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant