Full Changelog

v2.0.2 (2022-05-10)

Bug Fixes

  • Fix a bug in the NDCube._as_mpl_axes implementation, allowing cubes with compatible dimensions to be passed as the projection= keyword argument to certain matplotlib functions again. (#509)

Trivial/Internal Changes

  • Remove use of deprecated distutils module. (#520)

2.0.1 (2021-11-19)

Bug Fixes

  • Enable NDCollection to accept aligned axes inputs in any integer type. (#495)

  • Patch to convert quantity objects passed to crop_by_coords to the units given in the wcs.world_axis_units. (#497)

  • Fix a bug which prevented the axes_units= kwarg from working when using the matplotlib animators. (#498)

  • Add support for length-1 lookup table coords within extra coords. (#499)

  • Bump the minimum version of astropy to 4.2 to correctly support capturing dropped world dimensions into global coords when slicing the WCS. (#500)

2.0.0 (2021-10-29)

Backwards Incompatible Changes

  • Remove unused util functions and the ndcube WCS class. Refactor util functions for converting between between data and WCS indices to reflect the APE14 nomenclature that distinguishes between array, pixel and world axes. (#280)

  • NDCubeSequence animation axes can no longer be set by extra coords. (#294)

  • ImageAnimatorNDCubeSequence, ImageAnimatorCubeLikeNDCubeSequence, LineAnimatorNDCubeSequence and LineAnimatorCubeLikeNDCubeSequence have been removed and replaced by NDCubeSequenceAnimator. (#294)

  • Change type of output of NDCollection.aligned_world_axis_physical_types from tuple to list. This is to be consistent with output of astropy.wcs.WCS.world_axis_physical_types. (#302)

  • Change output type when common axis item is a slice that covers only one subcube. Previously this would return an NDCube. Now an NDCubeSequence is always returned unless the common axis item is an integer. Also, refactor NDCubeSequence.index_as_cube so codebase is simpler. (#311)

  • Replace NDCube.crop_by_coords and NDCube.crop_by_extra_coords with new method, NDCube.crop (#316)

  • Remove NDCubeSequence plotting. (#322)

  • Update NDCube.array_axis_physical_types return physical types from extra coords as well as the WCS. (#338)

  • Rename ExtraCoords.add method from previous name “add_coordinate”. (#394)

  • The NDcube object no longer inherits from astropy.nddata.NDArithmeticMixin as the methods were not coordinate aware. (#457)

Deprecations and Removals


  • Implement a new ExtraCoords class which allows the specification of extra coordinates via lookup tables or WCS. This class exposes the extra coords as an APE 14 WCS object. (#271)

  • Add new method, axis_world_coord_values, to return world coords for all pixels for all axes in WCS as quantity objects. (#279)

  • Added a new method ndcube.NDCube.array_axis_physical_types to show which physical types are associated with each array axis. (#281)

  • Add properties to NDCubeSequence giving the world physical types for each array axis. (#301)

  • Add as_mpl_axes method to NDCube plotting mixin so the an NDCube can be provided to astropy WCSAxes as a projection. (#314)

  • Make pyplot colorbar work with the output on NDCube.plot when it is a 2D image. (#314)

  • Introduce a new class, GlobalCoords, for holding scalar coordinates that don’t apply to any pixel axes. (#323)

  • Implement NDCube.world_axis_coords which returns high level coordinate objects for all, or a subset of, axes. (#327)

  • New property, NDCubeSequence.sequence_axis_coords creates lists of GlobalCoords from each NDCube in the sequence. This replaces NDCubeSequence.sequence_axis_extra_coords, but because it uses the GlobaCoords infrastructure, can handle more than just coords that began as extra coords. (#335)

  • Implement ndcube.NDCubeSequence.common_axis_coords to replace common_axis_extra_coords. In contrast to old property, this new property collates coordinates from the wcs as well as extra_coords. (#344)

  • New property, ndcube.NDCollection.aligned_axis_physical_types. This replaces aligned_world_axis_physical_types and returns a list of tuples, where each tuple gives the physical types common between all memebers of the collection for a given aligned axis. (#347)

  • Allow ndcube.NDCubeSequence.explode_along_axis to explode sequence along any axis, not just the common axis. (#358)

  • Plotting functionality on NDCube has been refactored to use pluggable “plotter” classes. All plotting functionality can now be accessed via the NDCube.plotter attribute, with NDCube.plot becoming an alias for NDCube.plotter.plot.

    Advanced users, or package maintainers that which to customise the plotting functionality of an NDCube instance can set the .plotter attribute of a cube to be a subclass of ndcube.visualization.BasePlotter which then customises the behaviour of the NDCube.plot() method and provides any other methods implemented on the plotter. (#401)

  • Preserve sliced-out coordinates from WCS in the GlobalCoords instance. (#402)

  • Enable instantiating an NDCube from an existing NDCube by copying extra/global coords. (#404)

  • Support exposing dropped dimensions when ExtraCoords is sliced. (#411)

  • ExtraCoords is now explicitly limited to one dimensional tables because of a limitation in our use of astropy.modeling. (#414)

  • Adds functionality to reproject an NDCube object to coordinates described by another WCS or FITS Header by calling the new reproject_to method. (#434)

  • Change the edges= keyword to pixel_corners= in NDCube.axis_world_coords and NDCube.axis_world_coords_values to make its meaning clearer based on SEP feedback. (#437)

  • axis_world_coords and axis_world_coords_values now use a different, substantially faster and more memory efficient algorithm to generate the coordinates along all axes. (#442)

  • Extends reproject_to functionality by supporting adaptive and exact algorithms for an NDCube with 2D celestial WCS. (#448)

  • Introduce optional offset between old and new pixel grids in ResampledLowLevelWCS. (#449)

  • ExtraCoords.from_lookup_table accepts (a seqence of) physical_types as kwarg to set the types of its lookup_tables. (#451)

  • Create new plotter class for animating NDCubeSequence is the 2.0 framework. This class always sets the sequence axis as a slider and leverages ndcube.NDCube.plot. (#456)

  • Add __len__ method to NDCubeSequence which makes len(sequence) return the number of cubes in the sequence. (#464)

  • Add __iter__ method to NDCubeSequence which iterates through the cubes within the sequence. (#465)

  • Add property to ExtraCoords that returns a WCS of extra coords that describes all axes of associated cube. (#472)

Bug Fixes

  • Fix NDCollection.aligned_dimensions so it doesnt crash when components of collection are NDCubeSequences. (#264)

  • Generalize int type checking so it is independent of the bit-type of the OS. (#269)

  • Fix axis_world_coord_values when the WCS is 1D and ensure it always returns Quantities (#287)

  • Change name of NDCube.axis_world_coord_values to NDCube.axis_world_coords_values to be consistent with NDCube.axis_world_coords (#293)

  • Remove NDCubeSequence animation dependence of deprecated sunpy ImageAnimator and LineAnimator classes in favour of ArrayAnimatorWCS class. (#294)

  • Fix bug whereby common axis was not updated appropriately when slicing an NDCubeSequence. (#310)

  • Fix bug in NDCube.axis_world_coords_values when number of pixel and world dimensions differ. (#319)

  • Fixes bug in array_indices_for_world_objects when the WCS input does not have a world_axis_object_components attribute. The fix causes the low_level_wcs version is tried before the code fails. This enables ndcube.NDCube.combined_wcs to be used with this function. (#344)

  • Fixes IndexError in array_indices_for_world_objects which occurred when some of the world axes are dependent. (#344)

  • Stop ndcube.NDCube.explode_along_axis setting a common axis to the output NDCubeSequence. The output sequence should have no common axis. (#358)

  • Enable 2-D NDCubes to be visualized as a 1-D animated line. (#381)

  • Ensure corner inputs to ndcube.NDCube.crop are converted to units stored in WCS as world_to_array_index_values does not handle units. (#382)

  • updated ndcube github repository link in ndcube.docs.installation.rst. (#392)

  • Fix bug in NDCube.axis_world_coords_values when axes_coords is initially a bare astropy coordinate object rather than a list/tuple of coordinate objects. (#400)

  • Change the implementation of NDCube.crop so that it takes into account all the corners of the world region specified by the upper and lower corners, not just those two points. (#438)

  • Ensure NDCube init forces WCS to become high level.

    This patches a bug in astropy. (#447)

  • Fix bug in axis_world_coords_values which caused the units to be stripped when an axes input was given. (#461)

  • Fix bug in get_dependent_world_axes where an erroneous matrix transpose caused an error for non-square axis correlation matrices and wrong results for diagonally non-symmetric ones. (#471)

  • Extend support for cropping an NDCube using an ExtraCoords instance as the wcs. (#472)

  • Fix check as to whether user inputs to ndcube.wcs.wrappers.CompoundLowLevelWCS.world_to_pixel_values result in consistent pixel values when world dimensions share pixel dimensions. Previously this check was unreliable when non-trivial mapping between world and pixel dimensions was used. (#472)

  • Fix slicing ExtraCoords made of lookup tables. This bug meant that mapping of coords to arrays axes was not adjusted when an axis was dropped. (#482)

Improved Documentation

  • Document accepted input to lookup_table in ExtraCoords setting its physical_types. (#451)

  • Improved information and formatting of __str__ methods. (#453)

Trivial/Internal Changes

  • Simplify and speed up implementation of NDCubeSequence slicing. (#251)

  • Fix docstring formatting to help docs build. (#262)

  • Use pytest-mpl for figure tests. (#312)

  • Port the tests for NDCube to use pytest fixtures (#318)

  • Allow corner inputs to crop to not be wrapped in a tuple is only one high level coordinate objects required. (#380)

  • Make sunpy an optional dependence. Without it, the _animate_cube plotting functionality will be disabled. (#393)

  • Adds a function to compare the physical types of two WCS objects. (#433)

  • Propagate reference to NDCube object through ExtraCoords string slicing. (#454)

  • Adds a function to identify invariant axes between two WCS objects. (#459)

  • The matplotlib animators code has been moved from sunpy to a new package mpl_animators so ndcube no longer has an optional dependancy on sunpy. (#484)

1.3.0 (2020-03-27)


  • Add new NDCollection class for linking and manipulating partially or non-aligned NDCubes or NDCubeSequences. (#238)

Bug Fixes

  • Fixed the files included and excluded from the tarball. (#212)

  • Fix crashing bug when an NDCube axis after the first is sliced with a numpy.int64. (#223)

  • Raises error if NDCube is sliced with an Ellipsis. (#224)

  • Changes behavior of NDCubeSequence slicing. Previously, a slice item of interval length 1 would cause an NDCube object to be returned. Now an NDCubeSequence made up of 1 NDCube is returned. This is consistent with how interval length 1 slice items slice arrays. (#241)

1.2.0 (2019-09-10)


Bug Fixes

  • ndcube.NDCube.world_axis_physical_types now sets the axis label to the WCS CTYPE if no corresponding IVOA name can be found. (#164)

  • Fixed the bug of using pixel_edges instead of pixel_values in plotting (#176)

  • Fix 2D plotting from crashing when both data and WCS are 2D. (#182)

  • Fix the ability to pass a custom Axes to ndcube.NDCube.plot for a 2D cube. (#204)

Trivial/Internal Changes

  • Include more helpful error when invalid item type is used to slice an NDCube. (#158)


API-Breaking Changes

  • crop_by_extra_coord API has been broken and replaced. Old version: crop_by_extra_coord(min_coord_value, interval_width, coord_name). New version: crop_by_extra_coord(coord_name, min_coord_value,  max_coord_value). [#142]

New Features

  • Created a new NDCubeBase which has all the functionality of NDCube except the plotting. The old NDCubeBase which outlined the NDCube API was renamed NDCubeABC. NDCube has all the same functionality as before except is now simply inherits from NDCubeBase and NDCubePlotMixin. [#101]

  • Moved NDCubSequence plotting to a new mixin class, NDCubSequencePlotMixin, making the plotting an optional extra. All the non-plotting functionality now lives in the NDCubeSequenceBase class. [#98]

  • Created a new explode_along_axis method that breaks an NDCube out into an NDCubeSequence along a chosen axis. It is equivalent to explode_along_axis. [#118]

  • NDCubeSequence plot mixin can now animate a cube as a 1-D line if a single axis number is supplied to plot_axis_indices kwarg.

API Changes

  • Replaced API of what was previously utils.wcs.get_dependent_axes, with two new functions, utils.wcs.get_dependent_data_axes and utils.wcs.get_dependent_wcs_axes. This was inspired by a new implementation in glue-viz which is intended to be merged into astropy in the future. This API change helped fix the NDCube.world_axis_physical_type bug listed below. [#80]

  • Give users more control in plotting both for NDCubePlotMixin and NDCubeSequencePlotMixin. In most cases the axes coordinates, axes units, and data unit can be supplied manually or via supplying the name of an extra coordinate if it is wanted to describe an axis. In the case of NDCube, the old API is currently still supported by will be removed in future versions. [#98 #103]

Bug Fixes

  • Allowed axis_world_coords to accept negative axis indices as arguments. [#106]

  • Fixed bug in NDCube.crop_by_coords in case where real world coordinate system was rotated relative to pixel grid. [#113].

  • world_axis_physical_types is now not case-sensitive to the CTYPE values in the WCS. [#109]

  • plot now generates a 1-D line animation when image_axis is an integer.


New Features

  • Added installation instructions to docs. [#77]

Bug Fixes

  • Fixed bugs in NDCubeSequence slicing and NDCubeSequence.dimensions in cases where sub-cubes contain scalar .data. [#79]

  • Fixed NDCube.world_axis_physical_types in cases where there is a missing WCS axis. [#80]

  • Fixed bugs in converting between negative data and WCS axis numbers. [#91]

  • Add installation instruction to docs. [#77]

  • Fix function name called within NDCubeSequence.plot animation update plot. [#95]