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

[1.1.3] Several CI tests fail with new (1.0.3) sunpy #201

Closed
olebole opened this issue Aug 31, 2019 · 9 comments
Closed

[1.1.3] Several CI tests fail with new (1.0.3) sunpy #201

olebole opened this issue Aug 31, 2019 · 9 comments

Comments

@olebole
Copy link

olebole commented Aug 31, 2019

Description

I updated sunpy on Debian unstable to 1.0.3, but now I observe a number of failing tests in ndcube (19 failures):

../../../../usr/lib/python3/dist-packages/ndcube/tests/test_plotting.py . [ 38%]
...........................FFFF                                          [ 48%]
../../../../usr/lib/python3/dist-packages/ndcube/tests/test_sequence_plotting.py . [ 49%]
..........................................FFFFFFFFFFFFFFF                [ 68%]

Full test log is f.e. here.

Actual behavior

One type of failure is

_ test_cube_plot_ND_as_1DAnimation[test_input0-test_kwargs0-expected_values0] __

test_input = NDCube
---------------------
WCS Keywords

Number of WCS axes: 4
CTYPE : 'TIME'  'WAVE'  'HPLT-TAN'  'HPLN-TAN'  
CRVA...-----------
Length of NDCube: [2. 3. 4.] pix
Axis Types of NDCube: ('custom:pos.helioprojective.lat', 'em.wl', 'time')

test_kwargs = {'plot_axis_indices': -1}
expected_values = (masked_array(
  data=[[[1, 2, 3, 4],
         [2, 4, 5, 3],
         [0, --, 2, 3]],

        [[2, 4, 5, 1],
        ...False, False, False]]],
  fill_value=999999), [False, False, array([0.4, 0.8, 1.2, 1.6])], 'time [min]', 'Data [None]')

    @pytest.mark.parametrize("test_input, test_kwargs, expected_values", [
        (cube, {"plot_axis_indices": -1},
         (cube_data, cube_none_axis_ranges_axis2, "time [min]", "Data [None]")),
    
        (cube_unit, {"plot_axis_indices": -1, "axes_units": u.s, "data_unit": u.erg},
         (cube_data*1e7, cube_none_axis_ranges_axis2_s, "time [s]", "Data [erg]")),
    
        (cube_unit, {"plot_axis_indices": -1, "axes_coordinates": "bye"},
         (cube_data, cube_none_axis_ranges_axis2_bye, "bye [m]", "Data [J]")),
    
        (cube, {"plot_axis_indices": -1, "axes_coordinates": np.arange(10, 10+cube.data.shape[-1])},
         (cube_data, cube_none_axis_ranges_axis2_array, " [None]", "Data [None]"))
        ])
    def test_cube_plot_ND_as_1DAnimation(test_input, test_kwargs, expected_values):
        # Unpack expected properties.
        expected_data, expected_axis_ranges, expected_xlabel, expected_ylabel = expected_values
        # Run plot method.
>       output = test_input.plot(**test_kwargs)

/usr/lib/python3/dist-packages/ndcube/tests/test_plotting.py:337: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/ndcube/mixins/plotting.py:79: in plot
    axes_units=axes_units, data_unit=data_unit, **kwargs)
/usr/lib/python3/dist-packages/ndcube/mixins/plotting.py:393: in _animate_cube_1D
    ylabel="Data [{0}]".format(data_unit), **kwargs)
/usr/lib/python3/dist-packages/sunpy/visualization/animator/line.py:121: in __init__
    **kwargs)
/usr/lib/python3/dist-packages/sunpy/visualization/animator/base.py:428: in __init__
    self.axis_ranges, self.extent = self._sanitize_axis_ranges(axis_ranges, data.shape)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <sunpy.visualization.animator.line.LineAnimator object at 0x7f2c4e18e050>
axis_ranges = [None, None, array([0.4, 0.8, 1.2, 1.6])], data_shape = (2, 3, 4)

    def _sanitize_axis_ranges(self, axis_ranges, data_shape):
        """…"""
[…]
                else:
>                   raise ValueError(incompatible_axis_ranges_error_message(i))
E                   ValueError: Unrecognized format for 2th entry in axis_ranges: [0.4 0.8 1.2 1.6]axis_ranges must be None, a ``[min, max]`` pair, or an array-like giving the edge values of each pixel, i.e. length must be length of axis + 1.

Others end with

>                   raise ValueError(incompatible_axis_ranges_error_message(i))
E                   ValueError: Unrecognized format for 3th entry in axis_ranges: [[[[0.4 0.8 1.2 1.6]
E                      [0.4 0.8 1.2 1.6]
E                      [0.4 0.8 1.2 1.6]]
E                   
E                     [[0.4 0.8 1.2 1.6]
E                      [0.4 0.8 1.2 1.6]
E                      [0.4 0.8 1.2 1.6]]]
E                   
[…]
E                     [[0.4 0.8 1.2 1.6]
E                      [0.4 0.8 1.2 1.6]
E                      [0.4 0.8 1.2 1.6]]]]axis_ranges must be None, a ``[min, max]`` pair, or an array-like giving the edge values of each pixel, i.e. length must be length of axis + 1.

/usr/lib/python3/dist-packages/sunpy/visualization/animator/base.py:534: ValueError
__ test_sequence_plot_LineAnimator[test_input2-test_kwargs2-expected_values2] __

There is also this type of failures:

_ test_sequence_plot_as_cube_LineAnimator[test_input1-test_kwargs1-expected_values1] _

test_input = NDCubeSequence
---------------------
Length of NDCubeSequence:  4.0 pix
Shape of 1st NDCube: (<Quantity 2. pix>, <Quantity 3. pix>, <Quantity 4. pix>)
Axis Types of 1st NDCube: ('custom:pos.helioprojective.lat', 'em.wl', 'time')

test_kwargs = {'plot_axis_indices': 0}
expected_values = (array([[[ 1,  2,  3,  4],
        [ 2,  4,  5,  3],
        [ 0, -1,  2,  3]],

       [[ 2,  4,  5,  1],
        [10... array([0, 1, 2, 3]), array([0, 1, 2, 3, 4])], 'custom:pos.helioprojective.lat [deg]', 'Data [None]', (0, 7), (-1, 55))

    @pytest.mark.parametrize("test_input, test_kwargs, expected_values", [
        (seq, {"plot_axis_indices": 2, "axes_units": u.s},
         (seq_concat.data, cubelike_none_axis_ranges_axis2_s, "time [s]", "Data [None]",
          (cubelike_none_axis_ranges_axis2_s[2].min(), cubelike_none_axis_ranges_axis2_s[2].max()),
          (seq_concat.data.min(), seq_concat.data.max()))),
    
        (seq, {"plot_axis_indices": 0},
         (seq_concat.data, cubelike_none_axis_ranges_axis0,
          "custom:pos.helioprojective.lat [deg]", "Data [None]",
          (0, 7), (seq_concat.data.min(), seq_concat.data.max()))),
    
        (seq_with_masks, {"plot_axis_indices": 0},
         (seq_concat.data, cubelike_none_axis_ranges_axis0,
          "custom:pos.helioprojective.lat [deg]", "Data [None]",
          (0, 7), (seq_concat.data.min(), seq_concat.data.max()))),
    
        (seq_with_some_masks, {"plot_axis_indices": -3},
         (seq_concat.data, cubelike_none_axis_ranges_axis0,
          "custom:pos.helioprojective.lat [deg]", "Data [None]",
          (0, 7), (seq_concat.data.min(), seq_concat.data.max()))),
    
        (seqm, {"plot_axis_indices": 0},
         (seq_concat.data, cubelike_none_axis_ranges_axis0,
          "custom:pos.helioprojective.lon [deg]", "Data [None]",
          (0, 7), (seq_concat.data.min(), seq_concat.data.max())))
        ])
    def test_sequence_plot_as_cube_LineAnimator(test_input, test_kwargs, expected_values):
        # Unpack expected values
        expected_data, expected_axis_ranges, expected_xlabel, \
          expected_ylabel, expected_xlim, expected_ylim = expected_values
        # Run plot method.
        output = test_input.plot_as_cube(**test_kwargs)
        # Check right type of plot object is produced.
        assert type(output) is ndcube.mixins.sequence_plotting.LineAnimatorCubeLikeNDCubeSequence
        # Check data being plotted is correct
        np.testing.assert_array_equal(output.data, expected_data)
        if type(expected_data) is np.ma.core.MaskedArray:
            np.testing.assert_array_equal(output.data.mask, expected_data.mask)
        # Check values of axes and sliders is correct.
        for i in range(len(output.axis_ranges)):
>           assert np.allclose(output.axis_ranges[i], expected_axis_ranges[i])
E           assert False
E            +  where False = <function allclose at 0x7f2c5c06f170>(array([-0.5,  7.5]), [0, 8])
E            +    where <function allclose at 0x7f2c5c06f170> = np.allclose

I can cut&paste more if needed. However, there are already some plotting problems fixed (like #191, #187), so I am not sure whether this would make sense.

If these problems are already fixed, would you consider tagging a new release?

System Details

  • ndcube Version: 1.1.3
  • SunPy Version: 1.0.3
  • Python Version: 3.7.4
  • OS information: Debian unstable (sid)
@Cadair
Copy link
Member

Cadair commented Sep 3, 2019

I think it's unlikely the 1.1 series will support SunPy 1.0, it turns out we made rather too many large changes. I think the plan is to either do a 1.2 or just jump to 2.0.

@olebole
Copy link
Author

olebole commented Sep 3, 2019

So I now feel a bin unsure what to do: Should I drop ndcube from Debian (testing) until this is resolved? Or shall I just pragmatically skip the failing tests (…and let people run into problems when they want to use it that way, or declare a conflict)? Or shall I hold back Sunpy until this is solved?
That is not important for Debian directly since we will not make a release in the next time, but others (Ubuntu, Mint) may take the packages from Debian in the mean time.

@DanRyanIrish
Copy link
Member

DanRyanIrish commented Sep 3, 2019

Hi @olebole. Thanks so much for raising this. Yes, the plan is to do a new 1.2 release of ndcube that will only support the latest and future versions of SunPy. For now, I would recommend rolling back ndcube to 1.1.2 and sunpy to an older version, 1.0.1 or 0.9, if that is possible with your setup.

@Cadair why don't we raise this on tomorrow's sunpy telecon and workout a timetable to resolve this issue?

@ayshih
Copy link
Member

ayshih commented Sep 3, 2019

I think that it's a bad idea to hold back the version of SunPy on Debian. SunPy is used for more than just ndcube. I'd skip the failing tests.

ndcube could modify the unit tests to detect the version of SunPy, and then tell the user what the issue is and how to resolve it.

@olebole
Copy link
Author

olebole commented Sep 3, 2019

Oh, I forgot to Cc @ViviCoder, who is the Debian maintainer of ndcube.

After checking the failures, I also would think the best is to just skip the three failing tests for the moment. @ViviCoder, I would tomorrow create a merge request on salsa, would you consider to review it?

@DanRyanIrish
Copy link
Member

DanRyanIrish commented Sep 4, 2019

Sounds good!

@ViviCoder
Copy link

ViviCoder commented Sep 4, 2019

@olebole: Sure.
If I remember correctly, SunPy is scheculed for autoremoval in Debian testing because of an issue in pytest-mock. It means we might have to drop ndcube anyway.

@olebole
Copy link
Author

olebole commented Sep 4, 2019

@ViviCoder I have put the MR on salsa.

@Cadair
Copy link
Member

Cadair commented Sep 20, 2019

@olebole I have finally just pushed 1.2, which works with sunpy 1.0.3+

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

No branches or pull requests

5 participants