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

Support plotting to use pixel_edges instead of pixel_values #176

Merged
merged 23 commits into from
Jul 31, 2019

Conversation

yashrsharma44
Copy link
Member

@yashrsharma44 yashrsharma44 commented May 25, 2019

This PR addresses the fix of using pixel_edges instead of pixel_values.
Partial fix #172
TODO:

  • Tests
  • Documentation
  • Using it for >1D

Ping @DanRyanIrish

@ghost
Copy link

ghost commented May 25, 2019

Thanks for the pull request @yashrsharma44! Everything looks great!

@yashrsharma44
Copy link
Member Author

Note that this PR will pass all the tests for SunPy >= 1.0, so some tests have been modified to be run in SunPy >= 1.0.

@codecov
Copy link

codecov bot commented May 28, 2019

Codecov Report

Merging #176 into master will decrease coverage by 0.01%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #176      +/-   ##
==========================================
- Coverage   94.65%   94.63%   -0.02%     
==========================================
  Files          19       19              
  Lines        2264     2275      +11     
==========================================
+ Hits         2143     2153      +10     
- Misses        121      122       +1
Impacted Files Coverage Δ
ndcube/tests/test_plotting.py 97.97% <ø> (ø) ⬆️
ndcube/mixins/plotting.py 86.04% <100%> (+0.05%) ⬆️
ndcube/utils/cube.py 96.38% <90%> (-0.88%) ⬇️

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 e97e3e0...1759825. Read the comment docs.

@pep8speaks
Copy link

pep8speaks commented May 29, 2019

Hello @yashrsharma44! 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-07-31 15:41:29 UTC

@yashrsharma44
Copy link
Member Author

yashrsharma44 commented May 29, 2019

Tasks left if all the tests pass -

  • Add tests for the edited helper method
  • Nitpickings

@DanRyanIrish DanRyanIrish added this to the 1.2 milestone Jun 3, 2019
@DanRyanIrish
Copy link
Member

Hi @yashrsharma44. What's the status of this PR?

@yashrsharma44
Copy link
Member Author

The idea of working of plotting in >1D needs to be discussed. Plotting tests for 1D works well.

@DanRyanIrish
Copy link
Member

OK, what are the issues in >1D?

ndcube/mixins/sequence_plotting.py Show resolved Hide resolved
@@ -195,3 +196,59 @@ def _get_dimension_for_pixel(axis_length, edges):
False stands for pixel_value, while True stands for pixel_edge
"""
return axis_length+1 if edges else axis_length

def _get_extra_coord_edges(value, axis=-1):
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe the name of the function can be changed to some appropriate one :P

Copy link
Member

Choose a reason for hiding this comment

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

If you are looking for suggested name change how about _infer_linear_extra_coord_edges?

ndcube/tests/test_sequence_plotting.py Show resolved Hide resolved
@yashrsharma44
Copy link
Member Author

yashrsharma44 commented Jun 12, 2019

Tasks to follow -

  • Write documentation for accepting pixel_egdes instead of pixel_values.
  • Writing tests for get_extra_coord_edges
  • Write a test for the un-tested line.
  • Nitpickings

1. Now if the `axes_coordinates` is None, or a `str`, it converts the `pixel_values` generated into `pixel_edges`.
2. User defined `axes_coordinates` are not touched, as now we need to document somewhere that input should be `pixel_edges` not `pixel_values`.
…aaray`.

1. Now the `pixel_edges` can be calculated for a given `ndarray` along a given axis.
@yashrsharma44
Copy link
Member Author

So currently, plotting with argument plot_axis_indices is working, and plotting with argument axes_coordinates is failing, so it needs to be discussed if the bug fix for axes_coordinates needs to be in this PR.

@DanRyanIrish
Copy link
Member

That's great progress @yashrsharma44. When you say axes_coordinates are failing do you mean specifically when using a string to use an extra coordinate, or do you mean more generally?

@yashrsharma44
Copy link
Member Author

When you say axes_coordinates are failing do you mean specifically when using a string to use an extra coordinate, or do you mean more generally?

When the axes_coordinates takes in a str value, then it fails, else it works well with manual array values.

@DanRyanIrish
Copy link
Member

OK. Let's make dealing with axes_coordinates another PR.

So what is left to do in this PR?

@yashrsharma44
Copy link
Member Author

Documentation about the plotting, everything else should be working fine after #PR 3283 is merged.

@@ -1,102 +1,107 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-# -*- coding: utf-8 -*-
Copy link
Member

Choose a reason for hiding this comment

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

What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad, it got uncommented twice.

@DanRyanIrish
Copy link
Member

There are a lot of tests commented out. Should they not be uncommented before merging and fixed if necessary. If this is not desired can you explain why?

@yashrsharma44
Copy link
Member Author

yashrsharma44 commented Jul 30, 2019

Hey @DanRyanIrish , the tests that you observed test_plotting.py which had lot of test cases commented, was due to my confusion, in which, I stashed(git stash) changes from another branch, which got reflected in this branch. I did not see the changes, so I have pushed with the current changes.


# Checks for corner cases
if value is None:
return value
Copy link
Member

Choose a reason for hiding this comment

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

This comment still isn't address. Just delete the above two lines for code.

@@ -195,3 +196,59 @@ def _get_dimension_for_pixel(axis_length, edges):
False stands for pixel_value, while True stands for pixel_edge
"""
return axis_length+1 if edges else axis_length

def _get_extra_coord_edges(value, axis=-1):
Copy link
Member

Choose a reason for hiding this comment

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

If you are looking for suggested name change how about _infer_linear_extra_coord_edges?

@DanRyanIrish
Copy link
Member

Apart from the above reminder to delete a couple lines, I am happy with this so long as it passes the sunpy dev tests. It's up to you whether you want to actually change the name of _get_extra_coord_edges or not.

Although passing the dev tests will require sunpy PR #3283 to be merged, right?

@yashrsharma44
Copy link
Member Author

I guess the change of name of _get_extra_coord_edges can be dealt in a separate PR, as lot of changes have been stacked up :P.

@yashrsharma44
Copy link
Member Author

Apart from the above reminder to delete a couple lines, I am happy with this so long as it passes the sunpy dev tests. It's up to you whether you want to actually change the name of _get_extra_coord_edges or not.

Although passing the dev tests will require sunpy PR #3283 to be merged, right?

Yeah, it depends on PR #3283, so this is blocked on that.

@DanRyanIrish
Copy link
Member

Apart from the above reminder to delete a couple lines, I am happy with this so long as it passes the sunpy dev tests. It's up to you whether you want to actually change the name of _get_extra_coord_edges or not.
Although passing the dev tests will require sunpy PR #3283 to be merged, right?

Yeah, it depends on PR #3283, so this is blocked on that.

OK. Let's get that merged then. I think it will be ready once you address those few outstanding comments.

@DanRyanIrish
Copy link
Member

DanRyanIrish commented Jul 30, 2019

Approved! Pending sunpy dev tests passing after the merging of sunpy PR sunpy/sunpy#3283

@DanRyanIrish DanRyanIrish merged commit 68083f2 into sunpy:master Jul 31, 2019
@DanRyanIrish
Copy link
Member

Well done @yashrsharma44!!

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.

3 participants