spikeinterface icon indicating copy to clipboard operation
spikeinterface copied to clipboard

Implement `get_parent()` function

Open alejoe91 opened this issue 11 months ago • 5 comments

Fixes #2596

This is super useful for example to plot different processing layers!

alejoe91 avatar Mar 21 '24 08:03 alejoe91

Quick (maybe dumb) question: what about when there are multiple parents? (e.g. UnitsAggregationSorting)

DradeAW avatar Mar 21 '24 10:03 DradeAW

Quick (maybe dumb) question: what about when there are multiple parents? (e.g. UnitsAggregationSorting)

It returns None, but we have other ways to return the parent list (property sortings/recordings)

alejoe91 avatar Mar 21 '24 17:03 alejoe91

Does the context were the other decision was made makes sense her?

I believe that was largely done to allow mapping between network drives for Windows because the cleanup etc doesn't work on Windows otherwise (due to WinError 32 amongst other classic Windows issues. ) . Neo did have a discussion of circular non-closeable references though that may be of interest in relation to this here

zm711 avatar Mar 21 '24 19:03 zm711

  1. For the segments we have the weakref mechanism. Would it make sense to have smoething like this for this? Does the context were the other decision was made makes sense her? Probably for @samuelgarcia to weight in on this one.

I don't think it does, because in this case you're exposing an object which is already referenced (self._parent_recording). Instead, when registering a recording to a sorting, you're "attaching" a complete different recording.

  1. I would go fully verbose and say get_parent_extractor and _parent_extractor.

I actually don't really like extractor :) I know that we have a BaseExtractor class, but the core objects are BaseRecording adn BaseSorting

alejoe91 avatar Mar 24 '24 09:03 alejoe91

  1. For the segments we have the weakref mechanism. Would it make sense to have smoething like this for this? Does the context were the other decision was made makes sense her? Probably for @samuelgarcia to weight in on this one.

I don't think it does, because in this case you're exposing an object which is already referenced (self._parent_recording). Instead, when registering a recording to a sorting, you're "attaching" a complete different recording.

  1. I would go fully verbose and say get_parent_extractor and _parent_extractor.

I actually don't really like extractor :) I know that we have a BaseExtractor class, but the core objects are BaseRecording and BaseSorting

alejoe91 avatar Mar 24 '24 09:03 alejoe91

I have the intuition that we should make a weak reference instance of a hard link. Lets maturate a bit this before merging.

samuelgarcia avatar Mar 25 '24 14:03 samuelgarcia

I have the intuition that we should make a weak reference instance of a hard link. Lets maturate a bit this before merging.

I think it doesn't make sense, since the parent object is also usually stored as self._something

alejoe91 avatar Mar 25 '24 14:03 alejoe91

I don't think it does, because in this case you're exposing an object which is already referenced (self._parent_recording). Instead, when registering a recording to a sorting, you're "attaching" a complete different recording.

I see. Yeah, then maybe let's do it as you have it here and then, if some problem appears, we could add weakref?

h-mayorquin avatar Mar 25 '24 16:03 h-mayorquin

Since Windows is the biggest culprit for problems is there a test I can run locally to probe this?

zm711 avatar Mar 25 '24 18:03 zm711

Since Windows is the biggest culprit for problems is there a test I can run locally to probe this?

I don't think there is! IMO let's merge and see if it causes problems

alejoe91 avatar Mar 27 '24 10:03 alejoe91