[AstroPy] Problem with the latest version of astropy and numpy

Kenneth Anderson kanderso at gemini.edu
Fri Aug 23 11:04:23 EDT 2019

Hi Antigone,

I cannot be sure how this problem arises for you, but what can be said is
that an AttributeError thrown from the numpy object is way off base for
that function. According the docstr on the* _result_as_quantity()*, the
return object, i.e. the  *'out'* object, should be an
*astropy.units.Quantity* object, not a *numpy* object.

It is unclear where things got confused in the call stack: perhaps an
incorrect object type was passed initially? You may want to *absolutely
ensure* that this did work under the previous versions. And if so, then it
would seem something is amiss in that astropy call stack.

>From the docstr:
*_result_as_quantity(self, result, unit, out):

*        [ ... ]
*        Parameters

*        ----------

*        result : *`~numpy.ndarray` or tuple of `~numpy.ndarray`

            Array(s) which need to be turned into quantity.

*        unit : `~astropy.units.Unit` or None

            Unit for the quantities to be returned (or `None` if the result

            should not be a quantity).  Should be tuple if result is a

*        out : `~astropy.units.Quantity` or None

            Possible output quantity. Should be `None` or a tuple if result

            is a tuple.

*        Returns

*        -------

*        out : `~astropy.units.Quantity`

*           With units set.*

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20190823/7e521a03/attachment-0001.html>

More information about the AstroPy mailing list