copy behaviour of annotations and object identity
Annotations of objects are by default not deepcopied when manipulating an object, e.g. upon slicing of a signal. However, array annotations are explicitly deepcopied (see https://github.com/NeuralEnsemble/python-neo/issues/809#issuecomment-619902320), whereas this is not the case for regular annotations. This can lead to unexpected behaviour, e.g. when identifying objects via annotations (see #809).
I am not sure at which point it would be best to fix this behaviour. There are multiple options here:
- extend the
__get_item__methods in a similar fashion as implemented forarray_annotations. This would lead to multiple steps in the process of slicing. First linking ofannotationsby__array_finalizeand then explicit deepcopying later on. - extend the
__array_finalize__methods as these are called also during the process of slicing - introduce unique object identifiers within neo. This would require an extended discussion first about the concept of identifiers to use and their expected behaviour in Neo.
@apdavison @samuelgarcia Do you have a preference regarding the different options here?
Hi Julia. I think really prefer deepcopy of annotation. I forget why we did not copy annotations yet.
Having uid for neo object is not a solution I like.
And about the when to make the copy, I don't known choose the simpler!!
Cheers,
Samuel
I think this is important to put in 0.9 no ? Even with something very simple. This is the last stuff. No ?
I don't think this will go into the next release as there is not enough time to implement and review it properly. @samuelgarcia @apdavison I suggest to postpone this to 0.11.0. even though it is labeled as blocker.