Skip to content

Dropped start/stop kwargs from compute_path_length and compute_path_straightness#987

Open
vybhav72954 wants to merge 3 commits into
neuroinformatics-unit:mainfrom
vybhav72954:refactor/path
Open

Dropped start/stop kwargs from compute_path_length and compute_path_straightness#987
vybhav72954 wants to merge 3 commits into
neuroinformatics-unit:mainfrom
vybhav72954:refactor/path

Conversation

@vybhav72954
Copy link
Copy Markdown
Contributor

@vybhav72954 vybhav72954 commented May 19, 2026

Fixes #986

Description

Remove start/stop kwargs from compute_path_length and compute_path_straightness. Users do the time-windowing with idiomatic xarray instead:

compute_path_length(position.sel(time=slice(start, stop)))

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

References

Discussion on Zulip

Is this a breaking change?

Yes, it would be included in the new release!

Does this PR require an update to the documentation?

Yes, function docstrings updated to remove start/stop references; Examples now show the .sel() migration pattern.

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

@vybhav72954 vybhav72954 marked this pull request as draft May 19, 2026 18:21
@vybhav72954
Copy link
Copy Markdown
Contributor Author

@niksirbi I have completed the refactor, have updated dosctring best as per my understanding.

There is one question, _slice_and_validate no longer slices, so the name is misleading. Happy to rename in this PR, looking forward to your guidance.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d17ced0) to head (f9f8411).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #987   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         2824      2823    -1     
=========================================
- Hits          2824      2823    -1     

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

@vybhav72954 vybhav72954 marked this pull request as ready for review May 19, 2026 18:44
Copy link
Copy Markdown
Member

@niksirbi niksirbi left a comment

Choose a reason for hiding this comment

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

Thanks @vybhav72954, this is well done!

I only have two minor suggestions:

  • as you've already flagged, let's rename _slice_and_validate to sth like _validate_time_points
  • Nitpicky: The module docstring (path.py:3-4) still reads "the spatial trajectory of an individual between two time points." That phrasing was framed around the old start/stop model. Consider rewording to sth like "the spatial trajectory of an individual over the time span of the data", for consistency.

I'm pre-approving this PR, as both suggestions are minor. The CI failure is unrelated and should hopefully resolve itself soon.

Comment thread movement/kinematics/path.py Outdated
@sonarqubecloud
Copy link
Copy Markdown

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.

[REFACTOR] Remove start/stop kwargs from compute_path_length and compute_path_straightness

2 participants