You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Quantity.info should not be copied in ufuncs #14248
Currently, .info gets copied also in operations like result = q1 + q2. This is because at the end of the addition, when taking a _new_view(), result.__array_finalize__(self) is called. That does not seem reasonable -- e.g., there is no reason the result should share the name and description of one of the arguments.
Expected behavior
Instead, result.info should just be empty.
Example
import astropy.units as u
q1 = [1., 2., 3.] * u.m
q1.info.name = 'q1'
q2 = 1.*u.cm
q2.info.name = 'q2'
result = q1+q2
result.info
name = q1
dtype = float64
unit = m
class = Quantity
n_bad = 0
length = 3
This actually is a long-standing issue, see #5047. But perhaps one can tackle them one at a time...
EDIT: the problem is that this makes operations needlessly slow; see #14244 (comment)
Activity
mhvk commentedon Jan 5, 2023
fixed by #14253