Skip to content

Add backwards compatible collect function - #59

Merged
johnomotani merged 15 commits into
boutproject:masterfrom
rdoyle45:backwards-collect-function
Dec 5, 2019
Merged

Add backwards compatible collect function#59
johnomotani merged 15 commits into
boutproject:masterfrom
rdoyle45:backwards-collect-function

Conversation

@rdoyle45

Copy link
Copy Markdown
Collaborator

This pull request adds a new function, collect(), to xBOUT which aims to replicate the behaviour of https://github.com/boutproject/boutdata/blob/master/boutdata/collect.py.

Feature suggested in #9

@pep8speaks

pep8speaks commented Oct 28, 2019

Copy link
Copy Markdown

Hello @rdoyle45! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-12-05 16:11:04 UTC

@TomNicholas TomNicholas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is great, thanks @rdoyle45 .

Main thing it needs is tests to check the indexing behaving as expected. Then this can also be tested against the actual old collect function.

Comment thread xbout/load.py Outdated
Comment thread xbout/load.py
Comment thread xbout/load.py
@TomNicholas

TomNicholas commented Oct 28, 2019 via email

Copy link
Copy Markdown
Collaborator

@rdoyle45

Copy link
Copy Markdown
Collaborator Author

Apologies I meant say within a dictionary.

When I was testing isel with for example dict = {'x' : 3} ds.isel(dict) would remove the x dimension entirely. When I use dict = {'x' : [3]} a single x index is extracted.

Am I missing something or is this correct?

@TomNicholas

TomNicholas commented Oct 28, 2019 via email

Copy link
Copy Markdown
Collaborator

@rdoyle45

rdoyle45 commented Oct 28, 2019

Copy link
Copy Markdown
Collaborator Author

Thanks Tom, will do. I'll check that now.

Hmm I'm actually not sure, I was testing just now by doing isel(t=5), but perhaps I should have been doing isel(dict('t' : 5)). What I suggest is that you practice test-driven-development here. Write out small tests for each case that should work, including handling None and so on. Then change the collect logic until the tests all pass. That process will be less likely to leave errors than trying to guess how isel behaves and hoping you've covered each possibility.

On Mon, 28 Oct 2019, 13:55 Rhys Doyle, @.***> wrote: Apologies I meant say within a dictionary. When I was testing isel with for example dict = {'x' : 3} ds.isel(dict) would remove the x dimension entirely. When I use dict = {'x' : [3]} a single x index is extracted. Am I missing something or is this correct? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#59?email_source=notifications&email_token=AISNPIZ7VDHBWPJS5KLIZZTQQ3VMHA5CNFSM4JFZVJV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECM6OVI#issuecomment-546957141>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISNPI43JDXRU2XSI7BYOGTQQ3VMHANCNFSM4JFZVJVQ .

@rdoyle45 rdoyle45 changed the title Add backwards compatible collect function [WIP] Add backwards compatible collect function Oct 28, 2019
…ated and tests added (tests will fail if xguards and yguards parameters change, issue being looked at in #61)
@rdoyle45

Copy link
Copy Markdown
Collaborator Author

Will wait until #55 is merged

@rdoyle45 rdoyle45 mentioned this pull request Dec 3, 2019
@codecov-io

codecov-io commented Dec 4, 2019

Copy link
Copy Markdown

Codecov Report

Merging #59 into master will decrease coverage by 23.95%.
The diff coverage is 76.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #59       +/-   ##
===========================================
- Coverage   68.69%   44.74%   -23.96%     
===========================================
  Files           7        8        +1     
  Lines         444      789      +345     
  Branches       95      152       +57     
===========================================
+ Hits          305      353       +48     
- Misses         85      380      +295     
- Partials       54       56        +2
Impacted Files Coverage Δ
xbout/load.py 77.41% <76.66%> (-0.13%) ⬇️
xbout/plotting/utils.py 4.91% <0%> (-15.09%) ⬇️
xbout/plotting/animate.py 54.87% <0%> (-8.76%) ⬇️
xbout/boutdataarray.py 71.42% <0%> (-3.58%) ⬇️
xbout/plotting/plotfuncs.py 9.33% <0%> (ø)

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 e53c897...18db7f0. Read the comment docs.

@rdoyle45 rdoyle45 changed the title [WIP] Add backwards compatible collect function Add backwards compatible collect function Dec 4, 2019
@rdoyle45
rdoyle45 requested a review from TomNicholas December 4, 2019 10:48
Comment thread xbout/tests/test_against_collect.py
Comment thread xbout/load.py Outdated
Comment thread xbout/load.py Outdated
Comment thread xbout/tests/test_against_collect.py Outdated
@rdoyle45

rdoyle45 commented Dec 5, 2019

Copy link
Copy Markdown
Collaborator Author

I have added tests to check each dimension and index type. I have kept the list indexing as exclusive when using [start, end, step] as it is in boutdata at present.

This may change depending on the results of boutproject/BOUT-dev#1861 , and therefore we should wait to merge. However all tests should pass at present and any change in #1861 should not make the tests fail.

What do you think @johnomotani? I think the tests are quite robust now.

@johnomotani johnomotani left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. Probably worth holding off on merging for a little while to see if there's a resolution to the discussion in boutproject/BOUT-dev#1861.

@rdoyle45

rdoyle45 commented Dec 5, 2019

Copy link
Copy Markdown
Collaborator Author

Looks good to me. Probably worth holding off on merging for a little while to see if there's a resolution to the discussion in boutproject/BOUT-dev#1861.

Agreed

@johnomotani

Copy link
Copy Markdown
Collaborator

Following discussion on boutproject/BOUT-dev#1862, I think we can remove support and tests for the 3-element list form.

@rdoyle45

rdoyle45 commented Dec 5, 2019

Copy link
Copy Markdown
Collaborator Author

Following discussion on boutproject/BOUT-dev#1862, I think we can remove support and tests for the 3-element list form.

Removed. I think this is good to go? @TomNicholas @johnomotani

@johnomotani
johnomotani dismissed TomNicholas’s stale review December 5, 2019 16:27

Issue has been resolved - indexing now tested against old collect.

@johnomotani
johnomotani merged commit f02e677 into boutproject:master Dec 5, 2019
@rdoyle45
rdoyle45 deleted the backwards-collect-function branch December 5, 2019 19:04
johnomotani added a commit that referenced this pull request Dec 11, 2019
Add backwards compatible collect function
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.

5 participants