Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring the periodic broadcaster and added warn + error + test #349

Merged
merged 15 commits into from
Aug 7, 2024

Conversation

gvegayon
Copy link
Member

This PR does the following:

  • Refactors PeriodicBroadcaster from a class to a factory (like with the scanner functions).
  • Raises a warning if, during the factory of a tiling broadcaster, the user passes period size, which is only needed for the repeat broadcaster.
  • Raises an error if the requested size of the broadcaster surpasses the maximum length in a repeat broadcaster.
  • Adds explicit tests for PeriodicBroadcaster.

@gvegayon gvegayon linked an issue Jul 31, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.17%. Comparing base (a131fe2) to head (db59cba).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #349      +/-   ##
==========================================
- Coverage   93.24%   93.17%   -0.07%     
==========================================
  Files          39       39              
  Lines         918      909       -9     
==========================================
- Hits          856      847       -9     
  Misses         62       62              
Flag Coverage Δ
unittests 93.17% <100.00%> (-0.07%) ⬇️

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.

@gvegayon gvegayon marked this pull request as ready for review July 31, 2024 18:53
@damonbayer
Copy link
Collaborator

damonbayer commented Jul 31, 2024

Thanks @gvegayon! What do we gain by implementing a factory? It seems to me that we could have two functions tile_until_n(data, n, offset = 0) and repeat_until_n(data, reps, n, offset = 0)? Since they require different arguments, I feel that implementing them in the same factory is not as readable or efficient as just creating the two functions.

@gvegayon
Copy link
Member Author

Thanks @gvegayon! What do we gain by implementing a factory? It seems to me that we could have two functions tile_until_n(data, n, offset = 0) and repeat_until_n(data, reps, n, offset = 0)? Since they require different arguments, I feel that implementing them in the same factory is not as readable or efficient as just creating the two functions.

The refactoring reduced code size. Keeping both in the same also saved some code, but I do like the look of what you are proposing.

Copy link
Collaborator

@damonbayer damonbayer left a comment

Choose a reason for hiding this comment

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

@gvegayon Based on the thumbs up / responses to #349 (comment), I request that you please do something like is suggested in the comment.

Copy link
Collaborator

@damonbayer damonbayer left a comment

Choose a reason for hiding this comment

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

I think the description of the offset parameter in repeat_until_n is incorrect.

Copy link
Collaborator

@dylanhmorris dylanhmorris left a comment

Choose a reason for hiding this comment

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

Minor suggestions

model/src/pyrenew/arrayutils.py Outdated Show resolved Hide resolved
model/src/pyrenew/arrayutils.py Outdated Show resolved Hide resolved
model/src/pyrenew/arrayutils.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@dylanhmorris dylanhmorris left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @gvegayon

@dylanhmorris dylanhmorris dismissed damonbayer’s stale review August 7, 2024 23:15

offset parameter description now addressed

@dylanhmorris dylanhmorris merged commit bf09a37 into main Aug 7, 2024
8 of 9 checks passed
@dylanhmorris dylanhmorris deleted the 347-testfix-periodicbroadcaster branch August 7, 2024 23:15
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.

Test/fix PeriodicBroadcaster
3 participants