<div dir="ltr">Feel free to post the example here and a maintainer will put it on GitHub for you.<div><br></div><div>Thanks!</div><div>Tom</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 26, 2019 at 8:25 AM LAMBERT-HUYGHE Antigone <<a href="mailto:antigone.lambert-huyghe@cea.fr">antigone.lambert-huyghe@cea.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div bgcolor="#FFFFFF">
<div style="direction:ltr;font-family:Tahoma;color:rgb(0,0,0);font-size:10pt">
<div>Isn't there an other way? I don't have a github account.</div>
<div><br>
</div>
<div>Antigone<br>
</div>
<div style="font-family:"Times New Roman";color:rgb(0,0,0);font-size:16px">
<hr>
<div id="gmail-m_5601774262052646699divRpF25691" style="direction:ltr"><font size="2" face="Tahoma" color="#000000"><b>De :</b> AstroPy [astropy-bounces+antigone.lambert-huyghe=<a href="mailto:cea.fr@python.org" target="_blank">cea.fr@python.org</a>] de la part de Simon Conseil [<a href="mailto:simon@sconseil.fr" target="_blank">simon@sconseil.fr</a>]<br>
<b>Envoyé :</b> lundi 26 août 2019 14:22<br>
<b>À :</b> <a href="mailto:astropy@python.org" target="_blank">astropy@python.org</a><br>
<b>Objet :</b> Re: [AstroPy] Problem with the latest version of astropy and numpy<br>
</font><br>
</div>
<div></div>
<div>
<p>The issue tracker is on github:</p>
<p><a class="gmail-m_5601774262052646699moz-txt-link-freetext" href="https://github.com/astropy/astropy/issues/new" rel="noopener noreferrer" target="_blank">https://github.com/astropy/astropy/issues/new</a></p>
<p>Simon</p>
<p><br>
</p>
<div class="gmail-m_5601774262052646699moz-cite-prefix">Le 26/08/2019 à 12:58, LAMBERT-HUYGHE Antigone a écrit :<br>
</div>
<blockquote type="cite">
<pre class="gmail-m_5601774262052646699moz-quote-pre">Hi,

Ok, where can I send the bug report? I will construct the minimal example ASAP.

Best,
Antigone
________________________________
De : AstroPy [<a class="gmail-m_5601774262052646699moz-txt-link-abbreviated" href="mailto:astropy-bounces+antigone.lambert-huyghe=cea.fr@python.org" rel="noopener noreferrer" target="_blank">astropy-bounces+antigone.lambert-huyghe=cea.fr@python.org</a>] de la part de Simon Conseil [<a class="gmail-m_5601774262052646699moz-txt-link-abbreviated" href="mailto:simon@sconseil.fr" rel="noopener noreferrer" target="_blank">simon@sconseil.fr</a>]
Envoyé : lundi 26 août 2019 11:59
À : <a class="gmail-m_5601774262052646699moz-txt-link-abbreviated" href="mailto:astropy@python.org" rel="noopener noreferrer" target="_blank">astropy@python.org</a>
Objet : Re: [AstroPy] Problem with the latest version of astropy and numpy


Hi,

It is indeed weird that it tries to convert to a quantity if you are using Numpy arrays. There were significant changes in the convolution sub-package in Astropy 3.2 so this is probably worth a bug report, and ideally adding a minimal example to reproduce the issue (showing how you build the kernel).

Best,

Simon

Le 26/08/2019 à 09:24, LAMBERT-HUYGHE Antigone a écrit :

Hi,

I re-installed previous versions, more precisely 3.0.4 for astropy and 1.16.4 for numpy. The things are going well, with no error, and the convolution is well done, for any size of map. So I'm sure it is due to new versions of astropy (or numpy).

I don't understant why it should be a quantity, because I'm not using directly _result_as_quantity(), but astropy.convolution.convolve(), for which the doc is the following:

convolve(array, kernel, boundary='fill', fill_value=0.0, nan_treatment='interpolate', normalize_kernel=True, mask=None, preserve_nan=False, normalization_zero_tol=1e-08)

Parameters

array NDData<a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData></a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData></a> or numpy.ndarray<a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" rel="noopener noreferrer" target="_blank"><https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray></a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" rel="noopener noreferrer" target="_blank"><https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray></a> or array-like

The array to convolve. This should be a 1, 2, or 3-dimensional array or a list or a set of nested lists representing a 1, 2, or 3-dimensional array. If an NDData<a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData></a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData></a>, the mask of the NDData<a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData></a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.nddata.NDData.html#astropy.nddata.NDData></a> will be used as the mask argument.

kernel numpy.ndarray<a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" rel="noopener noreferrer" target="_blank"><https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray></a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" rel="noopener noreferrer" target="_blank"><https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray></a> or Kernel<a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.convolution.Kernel.html#astropy.convolution.Kernel" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.convolution.Kernel.html#astropy.convolution.Kernel></a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.astropy.org/en/stable/api/astropy.convolution.Kernel.html#astropy.convolution.Kernel" rel="noopener noreferrer" target="_blank"><https://docs.astropy.org/en/stable/api/astropy.convolution.Kernel.html#astropy.convolution.Kernel></a>

The convolution kernel. The number of dimensions should match those for the array, and the dimensions should be odd in all directions. If a masked array, the masked values will be replaced by fill_value.

[...]
Returns

result numpy.ndarray<a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" rel="noopener noreferrer" target="_blank"><https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray></a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray" rel="noopener noreferrer" target="_blank"><https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray></a>

An array with the same dimensions and as the input array, convolved with kernel. The data type depends on the input array type. If array is a floating point type, then the return array keeps the same data type, otherwise the type is numpy.float.

I don't understand why this function is now using _result_as_quantity(), from what I checked in the source code it is indirect use. But from the doc I can use numpy arrays as input for the map to convolve.

Best,

Antigone
________________________________
De : AstroPy [<a class="gmail-m_5601774262052646699moz-txt-link-abbreviated" href="mailto:astropy-bounces+antigone.lambert-huyghe=cea.fr@python.org" rel="noopener noreferrer" target="_blank">astropy-bounces+antigone.lambert-huyghe=cea.fr@python.org</a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="mailto:astropy-bounces+antigone.lambert-huyghe=cea.fr@python.org" rel="noopener noreferrer" target="_blank"><mailto:astropy-bounces+antigone.lambert-huyghe=cea.fr@python.org></a>] de la part de Kenneth Anderson [<a class="gmail-m_5601774262052646699moz-txt-link-abbreviated" href="mailto:kanderso@gemini.edu" rel="noopener noreferrer" target="_blank">kanderso@gemini.edu</a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="mailto:kanderso@gemini.edu" rel="noopener noreferrer" target="_blank"><mailto:kanderso@gemini.edu></a>]
Envoyé : vendredi 23 août 2019 17:04
À : Astronomical Python mailing list
Objet : Re: [AstroPy] Problem with the latest version of astropy and numpy

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 tuple.
        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.

salud,
k







_______________________________________________
AstroPy mailing list
<a class="gmail-m_5601774262052646699moz-txt-link-abbreviated" href="mailto:AstroPy@python.org" rel="noopener noreferrer" target="_blank">AstroPy@python.org</a><a class="gmail-m_5601774262052646699moz-txt-link-rfc2396E" href="mailto:AstroPy@python.org" rel="noopener noreferrer" target="_blank"><mailto:AstroPy@python.org></a>
<a class="gmail-m_5601774262052646699moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/astropy" rel="noopener noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/astropy</a>


</pre>
<br>
<fieldset class="gmail-m_5601774262052646699mimeAttachmentHeader" rel="noopener noreferrer">
</fieldset>
<pre class="gmail-m_5601774262052646699moz-quote-pre">_______________________________________________
AstroPy mailing list
<a class="gmail-m_5601774262052646699moz-txt-link-abbreviated" href="mailto:AstroPy@python.org" rel="noopener noreferrer" target="_blank">AstroPy@python.org</a>
<a class="gmail-m_5601774262052646699moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/astropy" rel="noopener noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/astropy</a>
</pre>
</blockquote>
</div>
</div>
</div>
</div>

_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@python.org" target="_blank">AstroPy@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/astropy" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/astropy</a><br>
</blockquote></div>