[Debian-astro-maintainers] Bug#855477: [astroplan] Failure with broadcasts in schedulers

Ole Streicher olebole at debian.org
Sat Feb 18 21:23:14 UTC 2017


Package: python-astroplan
Version: 0.2-4
Severity: important
Forwarded: https://github.com/astropy/astroplan/issues/282

While the fix of #851437 fixes the FTBFS of the package, the packages
still has significant usage problems connected with the schedulers:

self = <astropy.coordinates.baseframe.TimeFrameAttribute object at 0x7f80365e23c8>
instance = <[ValueError("attribute obstime should be scalar or have shape (2, 1), but is has shape (2,) and could not be broadcast.") raised in repr()] AltAz object at 0x7f8032fb2470>
frame_cls = <class 'astropy.coordinates.builtin_frames.altaz.AltAz'>

    def __get__(self, instance, frame_cls=None):
[...]
        if instance is not None:
            instance_shape = getattr(instance, 'shape', None)
            if instance_shape is not None and (getattr(out, 'size', 1) > 1 and
                                               out.shape != instance_shape):
                # If the shapes do not match, try broadcasting.
                try:
                    if isinstance(out, ShapedLikeNDArray):
                        out = out._apply(np_broadcast_to, shape=instance_shape,
>                                        subok=True)

/usr/lib/python3/dist-packages/astropy/coordinates/baseframe.py:227: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Time object: scale='utc' format='iso' value=['2016-02-06 03:00:00.000' '2016-02-06 03:00:00.000']>
method = <function broadcast_to at 0x7f803ce8ce18>, args = ()
kwargs = {'shape': (2, 1), 'subok': True}, new_format = 'iso'
apply_method = <function Time._apply.<locals>.<lambda> at 0x7f803a69c730>
jd1 = array([ 2457424.5,  2457424.5]), jd2 = array([ 0.125,  0.125])

    def _apply(self, method, *args, **kwargs):
[...]
        if callable(method):
            apply_method = lambda array: method(array, *args, **kwargs)
        else:
            if method == 'replicate':
                apply_method = None
            else:
                apply_method = operator.methodcaller(method, *args, **kwargs)
    
        jd1, jd2 = self._time.jd1, self._time.jd2
        if apply_method:
>           jd1 = apply_method(jd1)

/usr/lib/python3/dist-packages/astropy/time/core.py:849: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([ 2457424.5,  2457424.5])

>   apply_method = lambda array: method(array, *args, **kwargs)

/usr/lib/python3/dist-packages/astropy/time/core.py:840: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([ 2457424.5,  2457424.5]), shape = (2, 1), subok = True

    def broadcast_to(array, shape, subok=False):
        """[...]"""
>       return _broadcast_to(array, shape, subok=subok, readonly=True)

/usr/lib/python3/dist-packages/numpy/lib/stride_tricks.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([ 2457424.5,  2457424.5]), shape = (2, 1), subok = True
readonly = True

    def _broadcast_to(array, shape, subok, readonly):
[...]
        broadcast = np.nditer(
            (array,), flags=['multi_index', 'refs_ok', 'zerosize_ok'] + extras,
>           op_flags=[op_flag], itershape=shape, order='C').itviews[0]
E       ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (2,) and requested shape (2,1)

/usr/lib/python3/dist-packages/numpy/lib/stride_tricks.py:129: ValueError

During handling of the above exception, another exception occurred:

    def test_transitioner():
        blocks = [ObservingBlock(t, 55 * u.minute, i) for i, t in enumerate(targets)]
        slew_rate = 1 * u.deg / u.second
        trans = Transitioner(slew_rate=slew_rate)
        start_time = Time('2016-02-06 03:00:00')
>       transition = trans(blocks[0], blocks[2], start_time, apo)

astroplan/tests/test_scheduling.py:112: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
astroplan/scheduling.py:842: in __call__
    sep = aaz[0].separation(aaz[1])[0]
/usr/lib/python3/dist-packages/astropy/utils/misc.py:941: in __getitem__
    return self._apply('__getitem__', item)
/usr/lib/python3/dist-packages/astropy/coordinates/sky_coordinate.py:279: in _apply
    self._sky_coord_frame = self_frame._apply(method, *args, **kwargs)
/usr/lib/python3/dist-packages/astropy/coordinates/baseframe.py:1181: in _apply
    value = getattr(self, attr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <astropy.coordinates.baseframe.TimeFrameAttribute object at 0x7f80365e23c8>
instance = <[ValueError("attribute obstime should be scalar or have shape (2, 1), but is has shape (2,) and could not be broadcast.") raised in repr()] AltAz object at 0x7f8032fb2470>
frame_cls = <class 'astropy.coordinates.builtin_frames.altaz.AltAz'>

    def __get__(self, instance, frame_cls=None):
[...]
                try:
                    if isinstance(out, ShapedLikeNDArray):
                        out = out._apply(np_broadcast_to, shape=instance_shape,
                                         subok=True)
                    else:
                        out = np_broadcast_to(out, instance_shape, subok=True)
                except ValueError:
                    # raise more informative exception.
                    raise ValueError(
                        "attribute {0} should be scalar or have shape {1}, "
                        "but is has shape {2} and could not be broadcast."
>                       .format(self.name, instance_shape, out.shape))
E                   ValueError: attribute obstime should be scalar or have shape (2, 1), but is has shape (2,) and could not be broadcast.

/usr/lib/python3/dist-packages/astropy/coordinates/baseframe.py:235: ValueError

This is still covered in upstream issue #282, but fixed in #285.
The patch needs to be adjusted for the Debian package.

Best regards

Ole



More information about the Debian-astro-maintainers mailing list