Skip to content

Commit 0657b39

Browse files
committed
Backport PR sunpy#865: Make the numpy order explict in docstring for rebin + Fix Ci
1 parent 7f1718c commit 0657b39

File tree

6 files changed

+16
-102
lines changed

6 files changed

+16
-102
lines changed

examples/dev/example_template.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

ndcube/extra_coords/tests/test_extra_coords.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ def test_slice_drop_dimensions(time_lut, skycoord_2d_lut):
366366
assert u.allclose(sec['lon'].wcs.pixel_to_world_values(list(range(2))),
367367
ec['lon'].wcs.pixel_to_world_values(list(range(2)), [0, 0]))
368368

369-
assert u.allclose(sec['exposure_time'].wcs.pixel_to_world_values(list(range(2)), list(range(2))),
370-
ec['exposure_time'].wcs.pixel_to_world_values(list(range(2)), list(range(2))))
369+
assert u.allclose(sec['exposure_time'].wcs.pixel_to_world_values(list(range(2))),
370+
ec['exposure_time'].wcs.pixel_to_world_values(list(range(2))))
371371

372372

373373
def test_slice_extra_twice(time_lut, wave_lut):

ndcube/ndcube.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ def rebin(self, bin_shape, operation=np.mean, operation_ignores_mask=False, hand
10661066
Downsample array by combining contiguous pixels into bins.
10671067
10681068
Values in bins are determined by applying a function to the pixel values within it.
1069-
The number of pixels in each bin in each dimension is given by the bin_shape input.
1069+
The number of pixels in each bin in each dimension is given by the ``bin_shape`` input.
10701070
This must be an integer fraction of the cube's array size in each dimension.
10711071
If the NDCube instance has uncertainties attached, they are propagated
10721072
depending on binning method chosen.
@@ -1081,6 +1081,7 @@ def rebin(self, bin_shape, operation=np.mean, operation_ignores_mask=False, hand
10811081
units have to be convertible to pixels.
10821082
The sentinel value ``-1`` can be passed for a dimension which means
10831083
that no rebinning will occur along that dimension.
1084+
Please note the ``bin_shape`` follows array axis (NumPy) ordering of the axes.
10841085
operation : function
10851086
Function applied to the data to derive values of the bins.
10861087
Default is `numpy.mean`

ndcube/tests/test_ndcube.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import dask.array
77
import numpy as np
88
import pytest
9-
from specutils import Spectrum1D
9+
from specutils import Spectrum
1010

1111
import astropy.units as u
1212
import astropy.wcs
@@ -1061,7 +1061,7 @@ def test_rebin_specutils():
10611061
# Tests for https://github.com/sunpy/ndcube/issues/717
10621062
y = np.arange(4000)*u.ct
10631063
x = np.arange(200, 4200)*u.nm
1064-
spec = Spectrum1D(flux=y, spectral_axis=x, bin_specification='centers', mask=x > 2000*u.nm)
1064+
spec = Spectrum(flux=y, spectral_axis=x, bin_specification='centers', mask=x > 2000*u.nm)
10651065
output = spec.rebin((10,), operation=np.sum, operation_ignores_mask=False)
10661066
assert output.shape == (400,)
10671067

ndcube/visualization/tests/figure_hashes_mpl_382_ft_261_astropy_600_animators_111.json renamed to ndcube/visualization/tests/figure_hashes_mpl_3100_ft_261_astropy_710_animators_124.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[ln_lt_l_t-cslice0-kwargs0]": "ea89b5d1c2fdcf34ba353dffe528f5ecd5ce364a77f43a08d00a6a7f11a869f4",
44
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[ln_lt_l_t-cslice1-kwargs1]": "f5d10df37509d1ba9429deb95ee29cf37dddea1a30f4c84cf2b10034c74c31bd",
55
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[ln_lt_l_t-cslice2-kwargs2]": "e48765a561ea0f43f5a80d3da27fd71654b18d276cbb7617e1918843012425f9",
6-
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[ln_lt_l_t-cslice3-kwargs3]": "b8d2d026c12a600b36ebe8cd943a5d443519443436f755e54fac12a681f1e3e4",
6+
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[ln_lt_l_t-cslice3-kwargs3]": "7d9c6a470077d7ea1e2a38160d9dd27e9c82e9106d8bfdcec789055e9089c8cd",
77
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[uncertainty-cslice4-kwargs4]": "04083a963e79e9aaf2d1771e9a86158ef4be51c4b8cde7b6b7b85f80e1452ea9",
88
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[unit_uncertainty-cslice5-kwargs5]": "53f90627c0612aac7edcca97e108069b915bc7edaf871e62ba747732510e7cb2",
99
"ndcube.visualization.tests.test_plotting.test_plot_1D_cube_from_slice[mask-cslice6-kwargs6]": "b888887d05f9f7654968bd59a33fd86a12111503222904bfd369475210da7abb",
10-
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube": "cc6ff47be658bdcc2e8dd226f50ab04da89cc23dc834fa5b0ce2a5a724414ada",
11-
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_colorbar": "2cdc18629da36f96ddeb24631f70387bc3090c128ad994914816b1be7864af79",
12-
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_custom_axis": "cc6ff47be658bdcc2e8dd226f50ab04da89cc23dc834fa5b0ce2a5a724414ada",
13-
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_custom_axis_plot_axes": "c61173e4904ffd7c6a88a9a18e68014ee258d5d59fb226c021f49a57230dfefc",
10+
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube": "4b194dbc850bfd9ae983ec5f0e07e7295f537e591e61177aadca28e41d74bd98",
11+
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_colorbar": "8adf60402dbd71d066547a08c81757f99db4f55b85288212420cf3a70f967c3e",
12+
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_custom_axis": "4b194dbc850bfd9ae983ec5f0e07e7295f537e591e61177aadca28e41d74bd98",
13+
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_custom_axis_plot_axes": "712809a75e7d587c064d9631ed218214071a9dd2d8017d937ae73c613e4c2ab4",
1414
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_from_slice[ln_lt_l_t-cslice0-kwargs0]": "77b0b9a0067897786777a78974cff240a3268ed38937047c3945473e82bc4cf0",
1515
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_from_slice[ln_lt_l_t-cslice1-kwargs1]": "2af86ad3672ef70d51b3637325c5e7860cad26f70032b51877d45d0a9b647a44",
16-
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_from_slice[ln_lt_l_t-cslice2-kwargs2]": "b00ec9344620cd9f640bbb3410e1fc508b5a86d02826d378147b33b999606d05",
16+
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_from_slice[ln_lt_l_t-cslice2-kwargs2]": "af99b2460f2ed4a99f159fe854cdf63285eaffb55c09932f74f15f2198a7f1b1",
1717
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_from_slice[unit_uncertainty-cslice3-kwargs3]": "77b0b9a0067897786777a78974cff240a3268ed38937047c3945473e82bc4cf0",
1818
"ndcube.visualization.tests.test_plotting.test_plot_2D_cube_from_slice[mask-cslice4-kwargs4]": "490f4d37a93ab800ab2eb4fa077c448bcd6ebc30d64ab374118f5a9288246fb3",
19-
"ndcube.visualization.tests.test_plotting.test_animate_2D_cube": "5dbe5e20670b3809365605637157f46d11235d7a28358cd03db075899e7ff2ae",
19+
"ndcube.visualization.tests.test_plotting.test_animate_2D_cube": "f0622456d02808c9845336e7bead8f4ac22e99d2450bf6f14bb74686a45fd5ed",
2020
"ndcube.visualization.tests.test_plotting.test_animate_cube_from_slice[ln_lt_l_t-cslice0-kwargs0]": "47a0279e3244139f5b7126625a1aeb2bd038b3b39b38829a6b5a9129d8bba09d",
2121
"ndcube.visualization.tests.test_plotting.test_animate_cube_from_slice[ln_lt_l_t-cslice1-kwargs1]": "8e9303bb77aef56991d2cf470de6840cea1994dd8ffb17bec48be9428ec5f7b8",
2222
"ndcube.visualization.tests.test_plotting.test_animate_cube_from_slice[ln_lt_l_t-None-kwargs2]": "4ae632474865d7df8434f66560c83205597437eadb61840266c334a836e4df7d",

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ deps =
5555
# Oldest Dependencies
5656
oldestdeps: minimum_dependencies
5757
# Figure tests need a tightly controlled environment
58-
figure-!devdeps: astropy==6.0.0
58+
figure-!devdeps: astropy==7.1.0
5959
figure-!devdeps: dask
60-
figure-!devdeps: matplotlib==3.8.2
61-
figure-!devdeps: mpl-animators==1.1.1
60+
figure-!devdeps: matplotlib==3.10.0
61+
figure-!devdeps: mpl-animators==1.2.4
6262
figure-!devdeps: scipy
6363
# The following indicates which extras_require will be installed
6464
extras =

0 commit comments

Comments
 (0)