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

NDCubeSequence plotting mixin API. #98

Merged
merged 33 commits into from
Mar 29, 2018

Conversation

DanRyanIrish
Copy link
Member

This PR introduces a new API for an NDCubeSequence plotting that will provide a more comprehensive plotting functionality for NDCubeSequence and more consistent API. This API/functionality should be mirrored NDCube where appropriate and vice versa.

This new mixin API will also allow a new NDCubeSequenceBase class independent of visualization and also of sunpy.

@pep8speaks
Copy link

pep8speaks commented Mar 21, 2018

Hello @DanRyanIrish! Thanks for updating the PR.

Line 363:5: E265 block comment should start with '# '
Line 256:5: E265 block comment should start with '# '

Comment last updated on March 26, 2018 at 18:43 Hours UTC

@DanRyanIrish
Copy link
Member Author

@Cadair, I think this is ready for a serious discussion now.

As an explanation, the cubesequence arg is there just so I can easily play with it without actually mixing in the class. All occurrences will be removed and replaced with self before merging.

@DanRyanIrish DanRyanIrish changed the title NDCubeSequence plottling mixin API. NDCubeSequence plotting mixin API. Mar 22, 2018
…ke dimension states. Also got NDCubeSequencePlotMixin.plot working with LineAnimatorNDCubeSequence class for 2D sequences.
@DanRyanIrish
Copy link
Member Author

I think I might have done another Danny's-1st-PR-style move here. +1,198 lines, -3 lines...woops!


axes_units: length 2 `list` of `astropy.unit.Unit` or valid unit `str` or None.
Denotes unit in which X-axis and Y-axis, respectively, should be displayed.
Only used if corresponding entry in axes_coordinates is a Quantity.
Copy link
Member Author

Choose a reason for hiding this comment

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

Error in this kwarg description. Should be same length as number of dimensions.

However, should probably also accept length 2 for images and length one for line plots so slider units don't have to be changed every time for high dimension sequences.

If None coordinates derived from the WCS objects will be used for all axes.
If a list, it should contain one element for each axis. Each element should
be either an `astropy.units.Quantity` or a `numpy.ndarray` of coordinates for
each pixel, or a `str` denoting a valid extra coordinate.
Copy link
Member Author

Choose a reason for hiding this comment

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

Error in this kwarg description. Elements can also be None.

axes_coordinates should probably also accept length 2 for images and length one for line plots so slider units don't have to be changed every time for high dimension sequences.

If None coordinates derived from the WCS objects will be used for all axes.
If a list, it should contain one element for each axis. Each element should
be either an `astropy.units.Quantity` or a `numpy.ndarray` of coordinates for
each pixel, or a `str` denoting a valid extra coordinate.
Copy link
Member

Choose a reason for hiding this comment

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

add None here


data_unit: `astropy.unit.Unit` or valid unit `str` or None
Unit in which data in a 2D image or animation should be displayed. Only used if
visualization is a 2D image or animation, i.e. if image_axis has length 2.
Copy link
Member Author

Choose a reason for hiding this comment

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

Correct this description. Data unit also is applied to y-axis of line plot.

@DanRyanIrish
Copy link
Member Author

Move the plot_as_cube options into separate plot_as_cube top level method.

@DanRyanIrish
Copy link
Member Author

Move some helper functions into class. Those that use the object itself.

…hod. Also updaed docstrings of plot and plot_as_cube to reflect the what the API will become over future commits.
@DanRyanIrish
Copy link
Member Author

Wrap dimension-specific prep operations in plot into dimension-specific helper functions to clean up plot.

…plot and and plot_as_cube methods to external function. Also added more comments.
… plot options. Also implement mixin in ndcubesequence module creating a non-plotting Base class and an NDCubeSequence class using plot mixin.
…ues were being reassigned instead of the axis unit.

Also added some error checks and removed a few lines of extraneous code.
…eby axis values were being reassigned instead of the axis unit.

Also added some error checks and removed a few lines of extraneous code.
…urrent plot API. Also make those ImageAnimator classes aware of the sub-cubes data unit.
@DanRyanIrish
Copy link
Member Author

I've left 1D animation functionality out of this PR as it depends on sunpy master. I'll issue another PR once this one has been merged with the 1D animation capability that can be merged either when sunpy 0.9 comes out or if we decide ndcube master depending on sunpy master is fine until 0.9.

@DanRyanIrish
Copy link
Member Author

As part of this PR I've realised there are shortcomings in the 2D images produced, it that coordinates for an axis are sometimes taken from the first sub-cube in the sequence and assumed not to change. I haven't fully figured out all the ties this occurs. So this comment is just a reminder to raise an issue after this PR is merged. Addressing this issue is beyond the scope of this PR.

@DanRyanIrish DanRyanIrish force-pushed the sequence_plot_api branch 3 times, most recently from b80dc28 to 0917b02 Compare March 28, 2018 22:09
@DanRyanIrish
Copy link
Member Author

Hey @Cadair. I'm planning to merge this tomorrow (your today) as I think it's ready and there are a couple PRs piling up waiting for it. I know you're really busy so if you don't have time to look at it no problem. Otherwise I'll take any comments you do have into tomorrow.

@DanRyanIrish DanRyanIrish merged commit 9ec7d20 into sunpy:master Mar 29, 2018
DanRyanIrish added a commit to DanRyanIrish/ndcube that referenced this pull request Mar 30, 2018
DanRyanIrish added a commit that referenced this pull request Mar 30, 2018
Updated CHANGELOG to include PRs #98, #101 and #103.
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