You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we perform plotting of NDCube and NDCubeSequence object, the plotting is breaking in some weird ways.
Expected behavior
The extra keywords such as axes_coordinates and plot_axis_indices should not cause NDCube plotting to break.
Actual behavior
On initializing the NDCube objects from the docs and performing plotting using the keywords plot_axis_indices=0 or plot_axis_indices=1, it breaks up without performing the plotting.
Here is a traceback when I perform my_cube[0].plot(plot_axis_indices=0) Traceback
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-7-a17e3408b1c5> in <module>
----> 1 my_cube[0].plot(plot_axis_indices=1)
~/nd/ndcube/ndcube/mixins/plotting.py in plot(self, axes, plot_axis_indices, axes_coordinates, axes_units, data_unit, **kwargs)
77 ax = self._animate_cube_1D(
78 plot_axis_index=plot_axis_indices[0], axes_coordinates=axes_coordinates,
---> 79 axes_units=axes_units, data_unit=data_unit, **kwargs)
80 else:
81 if naxis == 2:
~/nd/ndcube/ndcube/mixins/plotting.py in _animate_cube_1D(self, plot_axis_index, axes_coordinates, axes_units, data_unit, **kwargs)
391 ax = LineAnimator(data, plot_axis_index=plot_axis_index, axis_ranges=axes_coordinates,
392 xlabel=default_xlabel,
--> 393 ylabel="Data [{0}]".format(data_unit), **kwargs)
394 return ax
395
~/nd/vnv/lib/python3.7/site-packages/sunpy/visualization/animator/line.py in __init__(self, data, plot_axis_index, axis_ranges, ylabel, xlabel, xlim, ylim, aspect, **kwargs)
100 # supplied by the user for the plotted axis.
101 self.xdata = edges_to_centers_nd(np.asarray(axis_ranges[self.plot_axis_index]),
--> 102 plot_axis_index)
103 if ylim is None:
104 ylim = (data.min(), data.max())
~/nd/vnv/lib/python3.7/site-packages/sunpy/visualization/animator/base.py in edges_to_centers_nd(axis_range, edges_axis)
584 """
585 upper_edge_indices = [slice(None)] * axis_range.ndim
--> 586 upper_edge_indices[edges_axis] = slice(1, axis_range.shape[edges_axis])
587 upper_edges = axis_range[tuple(upper_edge_indices)]
588
IndexError: tuple index out of range
For NDCubeSequence, this is also not working properly my_sequence.plot(axes_coordinates=[None, "time", None, None]) . Traceback
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-17-315da964f63e> in <module>
----> 1 my_sequence.plot(axes_coordinates=[None, "time", None, None])
~/nd/ndcube/ndcube/mixins/sequence_plotting.py in plot(self, axes, plot_axis_indices, axes_coordinates, axes_units, data_unit, **kwargs)
122 ax = ImageAnimatorNDCubeSequence(
123 self, plot_axis_indices=plot_axis_indices,
--> 124 axes_coordinates=axes_coordinates, axes_units=axes_units, **kwargs)
125
126 return ax
~/nd/ndcube/ndcube/mixins/sequence_plotting.py in __init__(self, seq, wcs, axes, plot_axis_indices, axes_coordinates, axes_units, data_unit, **kwargs)
740 data_stack, wcs=new_wcs, image_axes=plot_axis_indices, axis_ranges=axes_coordinates,
741 unit_x_axis=axes_units[plot_axis_indices[0]],
--> 742 unit_y_axis=axes_units[plot_axis_indices[1]], **kwargs)
743
744
~/nd/vnv/lib/python3.7/site-packages/sunpy/visualization/animator/image.py in __init__(self, data, wcs, image_axes, unit_x_axis, unit_y_axis, axis_ranges, **kwargs)
171 self.unit_x_axis = unit_x_axis
172 self.unit_y_axis = unit_y_axis
--> 173 super().__init__(data, image_axes=image_axes, axis_ranges=axis_ranges, **kwargs)
174
175 def _get_main_axes(self):
~/nd/vnv/lib/python3.7/site-packages/sunpy/visualization/animator/image.py in __init__(self, data, image_axes, axis_ranges, **kwargs)
53 self._non_regular_plot_axis = False
54 # Run init for parent class
---> 55 super().__init__(data, image_axes=image_axes, axis_ranges=axis_ranges, **kwargs)
56
57 def plot_start_image(self, ax):
~/nd/vnv/lib/python3.7/site-packages/sunpy/visualization/animator/base.py in __init__(self, data, image_axes, axis_ranges, **kwargs)
426 raise ValueError("Number of image and slider axes do not match total number of axes.")
427
--> 428 self.axis_ranges, self.extent = self._sanitize_axis_ranges(axis_ranges, data.shape)
429
430 # create data slice
~/nd/vnv/lib/python3.7/site-packages/sunpy/visualization/animator/base.py in _sanitize_axis_ranges(self, axis_ranges, data_shape)
543 elif len(axis_ranges[i]) == data_shape[i]+1:
544 # If array of individual pixel edges supplied, convert to pixel centers.
--> 545 axis_ranges[i] = edges_to_centers_nd(np.asarray(axis_ranges[i]), i)
546 else:
547 raise ValueError(incompatible_axis_ranges_error_message(i))
~/nd/vnv/lib/python3.7/site-packages/sunpy/visualization/animator/base.py in edges_to_centers_nd(axis_range, edges_axis)
584 """
585 upper_edge_indices = [slice(None)] * axis_range.ndim
--> 586 upper_edge_indices[edges_axis] = slice(1, axis_range.shape[edges_axis])
587 upper_edges = axis_range[tuple(upper_edge_indices)]
588
IndexError: tuple index out of range
The axes_coordinates with some str parameter doesn't seem to be working for >2DNDCubes.
Description
When we perform plotting of
NDCube
andNDCubeSequence
object, the plotting is breaking in some weird ways.Expected behavior
The extra keywords such as
axes_coordinates
andplot_axis_indices
should not causeNDCube
plotting to break.Actual behavior
On initializing the
NDCube
objects from the docs and performing plotting using the keywordsplot_axis_indices=0
orplot_axis_indices=1
, it breaks up without performing the plotting.Here is a traceback when I perform
my_cube[0].plot(plot_axis_indices=0)
Traceback
For
NDCubeSequence
, this is also not working properlymy_sequence.plot(axes_coordinates=[None, "time", None, None])
.Traceback
The
axes_coordinates
with somestr
parameter doesn't seem to be working for>2D
NDCubes
.Traceback
Steps to Reproduce
The example code has been taken from ndcube docs
Extra information
The plotting of
NDCube
object seems to be breaking on giving the arguments such asplot_axis_indices
andaxes_coordinates
System Details
1.1.1
1.0.2
3.7
Ubuntu 16.04
The text was updated successfully, but these errors were encountered: