Skip to content

added example to the docstring for rolling with parameters#682

Open
andreas-wuestefeld wants to merge 2 commits into
DASDAE:masterfrom
andreas-wuestefeld:fix/doc-for-rolling-with-parameter
Open

added example to the docstring for rolling with parameters#682
andreas-wuestefeld wants to merge 2 commits into
DASDAE:masterfrom
andreas-wuestefeld:fix/doc-for-rolling-with-parameter

Conversation

@andreas-wuestefeld
Copy link
Copy Markdown
Contributor

@andreas-wuestefeld andreas-wuestefeld commented May 21, 2026

This is updated documentation based on my experience. The rolling-function example currently does not explain how to implement a custom function with additional parameters.

Maybe there is a more efficient way to do it than the solution here?

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings and/or appropriate doc page.
  • included tests. See testing guidelines.
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

Summary by CodeRabbit

  • Documentation
    • Enhanced the rolling function documentation with a new example demonstrating how to use custom functions with additional parameters in rolling operations.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Warning

Rate limit exceeded

@andreas-wuestefeld has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 33 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 611d39b9-75df-4a98-9d71-a737711e2554

📥 Commits

Reviewing files that changed from the base of the PR and between 059f384 and 4c78e98.

📒 Files selected for processing (1)
  • dascore/proc/rolling.py
📝 Walkthrough

Walkthrough

The rolling function docstring is expanded with a new example demonstrating how to use functools.partial to bind extra arguments when applying a custom rolling function. The example defines a rolling percentile calculation, wraps it with partial binding, applies it to sample data, and includes plotting of the results.

Changes

Rolling Function Documentation

Layer / File(s) Summary
Docstring example for partial parameter binding
dascore/proc/rolling.py
The rolling function docstring is extended with a practical example showing how to pass extra parameters to custom functions used with .apply(...) by using functools.partial to bind arguments, including setup, application, and visualization steps.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding an example to the rolling function docstring that demonstrates how to pass parameters.
Description check ✅ Passed The description explains the purpose (documenting how to use custom functions with parameters) and acknowledges it's documentation-only. However, the GitHub issue reference is missing from the description.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dascore/proc/rolling.py`:
- Around line 337-343: Fix typos and improve naming in the example: change the
comment "to allow arguments being parsed to the 'apply' method..." to "to allow
arguments being passed to the 'apply' method or the rolling function", fix "ot"
to "to" in the comment before applying the function, and rename the output
variable med_patch to a clearer name like pct_patch (or percentile_patch) to
reflect that it holds the percentile result; references to functions/vars to
update include _fun, _rolling_percentile, percentile, patch, get_example_patch,
rolling, and med_patch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: edc526eb-b9fa-4a4e-ac85-c6fcdabb334a

📥 Commits

Reviewing files that changed from the base of the PR and between a12eec5 and 059f384.

📒 Files selected for processing (1)
  • dascore/proc/rolling.py

Comment thread dascore/proc/rolling.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.93%. Comparing base (2912a8b) to head (4c78e98).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #682   +/-   ##
=======================================
  Coverage   99.93%   99.93%           
=======================================
  Files         135      135           
  Lines       11685    11704   +19     
=======================================
+ Hits        11677    11696   +19     
  Misses          8        8           
Flag Coverage Δ
unittests 99.93% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreas-wuestefeld andreas-wuestefeld added documentation Improvements or additions to documentation ready_for_review PR is ready for review labels May 21, 2026
@d-chambers
Copy link
Copy Markdown
Contributor

The failure is related to #684; the docs build fine, it is just an issue with permissions to post the comment linking to the build, so no worries there.

You should be able to push you branches directly to dasdae/dascore now, let me know if not.

The added doc example is fine, but I wonder if we ought to just add kwargs and args to apply? Panda's rolling apply specifically has args and kwargs arguments, DASCore's pipe, which is similar in nature, just uses *args and **kwargs directly. Adding one of these approaches would probably be more ergonomic than forcing users to use partial don't you think?

If you want, just change apply to support one of these approaches, write a small test, then either delete or modify the example in this PR.

@andreas-wuestefeld
Copy link
Copy Markdown
Contributor Author

The added doc example is fine, but I wonder if we ought to just add kwargs and args to apply?
If you want, just change apply to support one of these approaches, write a small test, then either delete or modify the example in this PR.

Yes, I was wondering the same, but I was wondering if you had any reason or obstacle to not having it implemented.
I will look into how this would be possible.
I will hold the PR for now

@d-chambers
Copy link
Copy Markdown
Contributor

d-chambers commented May 21, 2026

Hey @andreas-wuestefeld,

I just took a quick look. Overall these are great contributions to DASCore. I found the straight-forward FBE elegant, in other codes I had used stft but the bandpass approach is more straightforward and probably more efficient.

I have a few suggestions I will try to post tomorrow.

edit: this comment was intended for #681

@d-chambers d-chambers mentioned this pull request May 22, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ready_for_review PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants