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

Change StateVector indexing #187

Merged
merged 5 commits into from
May 6, 2020
Merged

Change StateVector indexing #187

merged 5 commits into from
May 6, 2020

Conversation

erogers-dstl
Copy link
Contributor

This pull request updates StateVector indexing and code that uses it to demonstrate the change suggested in issue #186. I think this is a simple and useful update, but if people feel this over-complicates the Statevector class for little benefit, then the PR can be shelved.

@codecov-io
Copy link

codecov-io commented Apr 6, 2020

Codecov Report

Merging #187 into master will increase coverage by 0.00%.
The diff coverage is 95.23%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #187   +/-   ##
=======================================
  Coverage   91.90%   91.90%           
=======================================
  Files         111      111           
  Lines        3793     3794    +1     
  Branches      548      549    +1     
=======================================
+ Hits         3486     3487    +1     
  Misses        225      225           
  Partials       82       82           
Impacted Files Coverage Δ
stonesoup/feeder/geo.py 90.56% <ø> (ø)
stonesoup/models/measurement/nonlinear.py 98.50% <92.30%> (-0.05%) ⬇️
stonesoup/functions.py 91.93% <100.00%> (+0.06%) ⬆️
stonesoup/sensor/radar/radar.py 95.83% <100.00%> (ø)
stonesoup/types/array.py 95.23% <100.00%> (+0.50%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89d36ed...0ae6a0f. Read the comment docs.

stonesoup/feeder/geo.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jmbarr jmbarr left a comment

Choose a reason for hiding this comment

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

How does this work with types which aren't int but could usefully be returned directly (e.g. float, long, angle, myOwnVerySpecialType, etc)?

@jmbarr
Copy link
Contributor

jmbarr commented Apr 17, 2020

Doesn't this PR have much the same intent as #170? Would it be worth combining?

@erogers-dstl
Copy link
Contributor Author

How does this work with types which aren't int but could usefully be returned directly (e.g. float, long, angle, myOwnVerySpecialType, etc)?

This works the same regardless of the type dtype of the StateVector (which I think is what you are asking). The check for int in __getitem__ and __setitem__ is whether the index supplied is an int: i.e. we did my_state_vector[1]. The check is necessary so that all other index modes (my_state_vector[:], my_state_vector[1, 0], my_state_vector[[1,2]] etc) behave as expected.

@erogers-dstl erogers-dstl requested a review from a team April 28, 2020 14:11
@DaveKirkland DaveKirkland self-assigned this Apr 30, 2020
Copy link
Collaborator

@DaveKirkland DaveKirkland left a comment

Choose a reason for hiding this comment

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

I admit the code does look much cleaner with this change.

stonesoup/feeder/geo.py Outdated Show resolved Hide resolved
stonesoup/models/measurement/nonlinear.py Outdated Show resolved Hide resolved
stonesoup/models/measurement/nonlinear.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants