Skip to content

Add log_to_attrs decorator to scale function #604

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

Merged
merged 8 commits into from
Jun 6, 2025
Merged

Conversation

niksirbi
Copy link
Member

@niksirbi niksirbi commented May 30, 2025

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

Supersedes #553, see that PR (and the discussions below it) for a justification.

What does this PR do?

  • Adds the log_to_attrs decorator (previously only used for filtering functions) to the movement.transforms.scale function
  • Documents its effects in the scale function's docstring (as notes and examples)
  • Updates the tests accordingly

References

#553

How has this PR been tested?

Existing test for the scale function were updated to check for the contents of log entries.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

The docstring has been expanded.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@niksirbi niksirbi changed the title added log_to_attrs decorator to scale function and documented its eff… Add log_to_attrs decorator to scale function May 30, 2025
@niksirbi niksirbi force-pushed the ns-log-scale-to-attrs branch from 97f344d to 82b8f2a Compare May 30, 2025 17:35
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8eeecc4) to head (7421b3a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #604   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           32        32           
  Lines         1784      1786    +2     
=========================================
+ Hits          1784      1786    +2     

☔ 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.

@niksirbi niksirbi marked this pull request as ready for review May 30, 2025 18:09
@niksirbi niksirbi requested review from Copilot and lochhh and removed request for Copilot May 30, 2025 18:09
Copilot

This comment was marked as resolved.

@niksirbi
Copy link
Member Author

I've requested a code review from @lochhh, but @hummuscience it would also be great to hear how this feature works for you. Basically, the arguments passed to the scale function are now stored in the log attribute of the scaled output data array, allowing you to "reconstruct" a history of transformations applied to the data. Each successive scale adds a new entry to the log.

@niksirbi
Copy link
Member Author

niksirbi commented Jun 2, 2025

Note to self: this PR needs to be rebased and updated after #606 is merged, because of changes I'm making to the log_to_attrs decorator itself.

@niksirbi niksirbi removed the request for review from lochhh June 2, 2025 15:55
@niksirbi niksirbi force-pushed the ns-log-scale-to-attrs branch from d2d17ea to 05f490c Compare June 5, 2025 16:42
@niksirbi niksirbi force-pushed the ns-log-scale-to-attrs branch from dc0e33f to 9b08ab6 Compare June 5, 2025 16:52
@niksirbi niksirbi requested a review from adamltyson June 5, 2025 16:54
Copy link

sonarqubecloud bot commented Jun 6, 2025

@adamltyson adamltyson enabled auto-merge June 6, 2025 09:02
@adamltyson adamltyson added this pull request to the merge queue Jun 6, 2025
Merged via the queue into main with commit fe28a5f Jun 6, 2025
26 checks passed
@adamltyson adamltyson deleted the ns-log-scale-to-attrs branch June 6, 2025 09:27
@niksirbi niksirbi mentioned this pull request Jun 6, 2025
3 tasks
niksirbi added a commit that referenced this pull request Jun 17, 2025
* added log_to_attrs decorator to scale function and documented its effects

* adapted tests for the scale function

* fixed mistakes in docstring formatting

* use monospace consistently in docstring

* updated docstring to follow new log style

* adapt tests for the serialized attrs.log

* more specific name for test helper function

---------

Co-authored-by: Adam Tyson <[email protected]>
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.

2 participants