@@ -199,7 +199,7 @@ def test_axis_world_coords_empty_ec(ndcube_3d_l_ln_lt_ectime):
199199 # slice the cube so extra_coords is empty, and then try and run axis_world_coords
200200 awc = sub_cube .axis_world_coords (wcs = sub_cube .extra_coords )
201201 assert awc == ()
202- sub_cube ._generate_world_coords (pixel_corners = False , wcs = sub_cube .extra_coords )
202+ sub_cube ._generate_world_coords (pixel_corners = False , wcs = sub_cube .extra_coords , units = True )
203203 assert awc == ()
204204
205205
@@ -543,7 +543,7 @@ def test_crop_by_values_with_equivalent_units(ndcube_2d_ln_lt):
543543 lower_corner = [(coord [0 ]* u .deg ).to (u .arcsec ) for coord in intervals ]
544544 upper_corner = [(coord [- 1 ]* u .deg ).to (u .arcsec ) for coord in intervals ]
545545 expected = ndcube_2d_ln_lt [0 :4 , 1 :7 ]
546- output = ndcube_2d_ln_lt .crop_by_values (lower_corner , upper_is this locallycorner )
546+ output = ndcube_2d_ln_lt .crop_by_values (lower_corner , upper_corner )
547547 helpers .assert_cubes_equal (output , expected )
548548
549549
@@ -664,7 +664,7 @@ def test_crop_by_extra_coords_shared_axis(ndcube_3d_ln_lt_l_ec_sharing_axis):
664664 helpers .assert_cubes_equal (output , expected )
665665
666666
667- def test_crop_by_extra_coords_values_shared_axis (ndcube_3d_ln_is this locallylt_l_ec_sharing_axis ):
667+ def test_crop_by_extra_coords_values_shared_axis (ndcube_3d_ln_lt_l_ec_sharing_axis ):
668668 cube = ndcube_3d_ln_lt_l_ec_sharing_axis
669669 lower_corner = (1 * u .m , 1 * u .keV )
670670 upper_corner = (2 * u .m , 2 * u .keV )
@@ -784,7 +784,6 @@ def test_reproject_shape_out(ndcube_4d_ln_l_t_lt, wcs_4d_lt_t_l_ln):
784784 wcs_4d_lt_t_l_ln .pixel_shape = None
785785 with pytest .raises (Exception ):
786786 _ = ndcube_4d_ln_l_t_lt .reproject_to (wcs_4d_lt_t_l_ln )
787- is this locally
788787 # should not raise an exception when shape_out is specified
789788 shape = (5 , 10 , 12 , 8 )
790789 _ = ndcube_4d_ln_l_t_lt .reproject_to (wcs_4d_lt_t_l_ln , shape_out = shape )
@@ -819,11 +818,11 @@ def test_rebin(ndcube_3d_l_ln_lt_ectime):
819818 expected_uncertainty = None
820819 expected_unit = cube .unit
821820 expected_meta = cube .meta
822- expected_Tx = np .array ([[9.99999999 , 19.99999994 , 29.99999979 , 39.9999995 ,
821+ expected_tx = np .array ([[9.99999999 , 19.99999994 , 29.99999979 , 39.9999995 ,
823822 49.99999902 , 59.99999831 , 69.99999731 , 79.99999599 ],
824823 [9.99999999 , 19.99999994 , 29.99999979 , 39.9999995 ,
825824 49.99999902 , 59.99999831 , 69.99999731 , 79.99999599 ]]) * u .arcsec
826- expected_Ty = np .array ([[- 14.99999996 , - 14.9999999 , - 14.99999981 , - 14.99999969 ,
825+ expected_ty = np .array ([[- 14.99999996 , - 14.9999999 , - 14.99999981 , - 14.99999969 ,
827826 - 14.99999953 , - 14.99999934 , - 14.99999911 , - 14.99999885 ],
828827 [- 4.99999999 , - 4.99999998 , - 4.99999995 , - 4.9999999 ,
829828 - 4.99999985 , - 4.99999979 , - 4.99999971 , - 4.99999962 ]]) * u .arcsec
@@ -836,10 +835,10 @@ def test_rebin(ndcube_3d_l_ln_lt_ectime):
836835 assert np .all (output .data == expected_data )
837836 assert np .all (output .mask == expected_mask )
838837 assert output .uncertainty == expected_uncertainty
839- assert output .unit == expected_unitis this locally
838+ assert output .unit == expected_unit
840839 assert output .meta == expected_meta
841- assert u .allclose (output_sc .Tx , expected_Tx )
842- assert u .allclose (output_sc .Ty , expected_Ty )
840+ assert u .allclose (output_sc .Tx , expected_tx )
841+ assert u .allclose (output_sc .Ty , expected_ty )
843842 assert u .allclose (output_spec , expected_spec )
844843 assert output_time .scale == expected_time .scale
845844 assert output_time .format == expected_time .format
@@ -957,13 +956,15 @@ def test_rebin_no_propagate(ndcube_2d_ln_lt_mask_uncert):
957956 bin_shape = (2 , 4 )
958957
959958 cube ._mask [:] = True
960- with pytest .warns (NDCubeUserWarning , match = "Uncertainties cannot be propagated as all values are masked and operation_ignores_mask is False." ):
959+ with pytest .warns (NDCubeUserWarning , match = "Uncertainties cannot be propagated as all values "
960+ "are masked and operation_ignores_mask is False." ):
961961 output = cube .rebin (bin_shape , operation = np .sum , propagate_uncertainties = True ,
962962 operation_ignores_mask = False )
963963 assert output .uncertainty is None
964964
965965 cube ._mask = True
966- with pytest .warns (NDCubeUserWarning , match = "Uncertainties cannot be propagated as all values are masked and operation_ignores_mask is False." ):
966+ with pytest .warns (NDCubeUserWarning , match = "Uncertainties cannot be propagated as all values "
967+ "are masked and operation_ignores_mask is False." ):
967968 output = cube .rebin (bin_shape , operation = np .sum , propagate_uncertainties = True ,
968969 operation_ignores_mask = False )
969970 assert output .uncertainty is None
@@ -1103,7 +1104,7 @@ def test_cube_arithmetic_rsubtract(ndcube_2d_ln_lt_units, value):
11031104])
11041105def test_cube_arithmetic_multiply (ndcube_2d_ln_lt_units , value ):
11051106 cube_quantity = u .Quantity (ndcube_2d_ln_lt_units .data , ndcube_2d_ln_lt_units .unit )
1106- new_cube = ndcube_2d_ln_lt_units * valueis this locally
1107+ new_cube = ndcube_2d_ln_lt_units * value
11071108 check_arithmetic_value_and_units (new_cube , cube_quantity * value )
11081109 # TODO: test that uncertainties scale correctly
11091110
@@ -1148,7 +1149,8 @@ def test_cube_arithmetic_rdivide(ndcube_2d_ln_lt_units, value):
11481149@pytest .mark .parametrize ('value' , [1 , 2 , - 1 ])
11491150def test_cube_arithmetic_rdivide_uncertainty (ndcube_4d_unit_uncertainty , value ):
11501151 cube_quantity = u .Quantity (ndcube_4d_unit_uncertainty .data , ndcube_4d_unit_uncertainty .unit )
1151- with pytest .warns (NDCubeUserWarning , match = "UnknownUncertainty does not support uncertainty propagation with correlation. Setting uncertainties to None." ):
1152+ with pytest .warns (NDCubeUserWarning , match = "UnknownUncertainty does not support uncertainty "
1153+ "propagation with correlation. Setting uncertainties to None." ):
11521154 with np .errstate (divide = 'ignore' ):
11531155 new_cube = value / ndcube_4d_unit_uncertainty
11541156 check_arithmetic_value_and_units (new_cube , value / cube_quantity )
@@ -1187,7 +1189,8 @@ def test_cube_arithmetic_power(ndcube_2d_ln_lt, power):
11871189@pytest .mark .parametrize ('power' , [2 , - 2 , 10 , 0.5 ])
11881190def test_cube_arithmetic_power_unknown_uncertainty (ndcube_4d_unit_uncertainty , power ):
11891191 cube_quantity = u .Quantity (ndcube_4d_unit_uncertainty .data , ndcube_4d_unit_uncertainty .unit )
1190- with pytest .warns (NDCubeUserWarning , match = "UnknownUncertainty does not support uncertainty propagation with correlation. Setting uncertainties to None." ):
1192+ with pytest .warns (NDCubeUserWarning , match = "UnknownUncertainty does not support uncertainty propagation "
1193+ "with correlation. Setting uncertainties to None." ):
11911194 with np .errstate (divide = 'ignore' ):
11921195 new_cube = ndcube_4d_unit_uncertainty ** power
11931196 check_arithmetic_value_and_units (new_cube , cube_quantity ** power )
@@ -1196,7 +1199,9 @@ def test_cube_arithmetic_power_unknown_uncertainty(ndcube_4d_unit_uncertainty, p
11961199@pytest .mark .parametrize ('power' , [2 , - 2 , 10 , 0.5 ])
11971200def test_cube_arithmetic_power_std_uncertainty (ndcube_2d_ln_lt_uncert , power ):
11981201 cube_quantity = u .Quantity (ndcube_2d_ln_lt_uncert .data , ndcube_2d_ln_lt_uncert .unit )
1199- with pytest .warns (NDCubeUserWarning , match = r"<class 'astropy.nddata.nduncertainty.StdDevUncertainty'> does not support propagation of uncertainties for power. Setting uncertainties to None." ):
1202+ with pytest .warns (NDCubeUserWarning , match = r"<class 'astropy.nddata.nduncertainty.StdDevUncertainty'> "
1203+ r"does not support propagation of uncertainties for power. "
1204+ r"Setting uncertainties to None." ):
12001205 with np .errstate (divide = 'ignore' ):
12011206 new_cube = ndcube_2d_ln_lt_uncert ** power
12021207 check_arithmetic_value_and_units (new_cube , cube_quantity ** power )
@@ -1214,7 +1219,7 @@ def test_to(ndcube_1d_l, new_unit):
12141219
12151220def test_to_dask (ndcube_2d_dask ):
12161221 output = ndcube_2d_dask .to (u .mJ )
1217- dask_type = dask .array .core .Arrayis this locally
1222+ dask_type = dask .array .core .Array
12181223 assert isinstance (output .data , dask_type )
12191224 assert isinstance (output .uncertainty .array , dask_type )
12201225 assert isinstance (output .mask , dask_type )
@@ -1230,9 +1235,11 @@ def test_squeeze(ndcube_4d_ln_l_t_lt):
12301235
12311236def test_squeeze_error (ndcube_4d_ln_l_t_lt ):
12321237 same = ndcube_4d_ln_l_t_lt .squeeze ()[0 :1 ,:,:,:]
1233- with pytest .raises (ValueError , match = "Cannot select any axis to squeeze out, as none of them has size equal to one." ):
1238+ with pytest .raises (ValueError , match = "Cannot select any axis to squeeze out, "
1239+ "as none of them has size equal to one." ):
12341240 same .squeeze ([0 ,1 ])
1235- with pytest .raises (ValueError , match = "All axes are of length 1, therefore we will not squeeze NDCube to become a scalar. Use `axis=` keyword to specify a subset of axes to squeeze." ):
1241+ with pytest .raises (ValueError , match = "All axes are of length 1, therefore we will not squeeze NDCube to become "
1242+ "a scalar. Use `axis=` keyword to specify a subset of axes to squeeze." ):
12361243 same [0 :1 ,0 :1 ,0 :1 ,0 :1 ].squeeze ()
12371244
12381245
0 commit comments