Repository navigation
Do not copy info when getting scalar Time item - #10889
Conversation
|
The PR looks OK, but I'm still wondering whether it is the right approach: the following behaviour seems weird to me: Why would a sliced time still have the full index associated with it? In contrast, I can see the logic of I guess I wonder if The advantage of solving it at the table level would be that the same solution would work for all other possible mixin columns too. |
|
I think I've got an alternative, I think - see #10890 |
|
Moving discussion here about whether this is still needed given #10890. I can see the argument in #10890 (comment) that
Since this would hold also for astropy/astropy/utils/data_info.py Lines 347 to 350 in 079fcb7 Note that we struggled a bit with this before - see #5047. I think the conclusion there was a good one: we should have clear, predictable behaviour... p.s. Another possibility for implementation is to use that for most classes any subsetting, etc., goes through |
Good plan. The question is whether this should only apply to the |
|
Nice! I think I agree that it makes most sense to do it to |
f21286d to
2dfca24
Compare
|
@mhvk - this should be ready for review. |
mhvk
left a comment
There was a problem hiding this comment.
Looks good modulo the left-over comment in Time._apply, which I think can either be removed or should be clarified. Approving since it is so minor.
| setattr(tm, attr, val) | ||
|
|
||
| # Copy other 'info' attr only if it has actually been defined. | ||
| # Copy other 'info' attr only if it has actually been defined and the |
There was a problem hiding this comment.
This can now be removed/reverted? Or link to this PR perhaps instead of the issue.
|
p.s. Really like the detailed and thorough tests! |
Description
This pull request is to address a memory and speed performance problem when iterating over a
Timecolumn that is indexed (e.g. in aTimeSeriesobject). See #10688 for details.The simple fix is to not copy the
infoattribute when getting a scalarTimefrom an array-valuedTimeobject. This is consistent with the behavior ofColumn.Being very conservative I have milestoned this for 4.2 instead of as a pure performance fix. It seems quite unlikely, but maybe possible that some code is using the
infodata that were previously being copied for a scalar getitem.Fixes #10688