Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension delete on recompute #2579

Merged

Conversation

samuelgarcia
Copy link
Member

@samuelgarcia samuelgarcia commented Mar 14, 2024

@chrishalcrow : this should fix the issue we discussed when recomputing something all children dependency are not valid anymore and have to deleted. Here a simple implementation of this idea.

@alejoe91 alejoe91 added the core Changes to core module label Mar 15, 2024
@chrishalcrow
Copy link
Collaborator

Nice, works for me!

Maybe we could warn the user in some cases? E.g. deleting random spikes deletes everything! Or tell them what's happening:
"{child}, which depends on {parent}, has also being deleted."
?

@samuelgarcia
Copy link
Member Author

@alejoe91 : what do you think of warning or print when cascade deleteting on re compute ?

@zm711
Copy link
Collaborator

zm711 commented Mar 15, 2024

For me I mean I wonder what the warning does? Because you're not going to say delete then offer a y|n in the terminal right. I think it is probably more important to have strong docstrings and documentation to explain that extensions now have parent-child relations and so deleting the parent necessitates deleting the child, no? It might be nice instead in my opinion to offer a function like get_all_extensions_relationships that prints out the dependencies of my current extensions so that I can understand how things interact before I as a user delete them.

For me the warning only helps if I can stop it when I realize that deleting random_spikes deletes waveforms too... But in this case this is just a print that we are putting as a warning. But that's just my two cents.

@chrishalcrow
Copy link
Collaborator

I know that I would be confused if I deleted "random_spikes" and everything vanished. I might not realise that the other extensions were deleted when I deleted random_spikes. So the warning highlights this fact.

But yeah, if this was documented well that could work too!

Another idea: now that we have these relationships we could have a "compute_parents" option on the compute() method?

@zm711
Copy link
Collaborator

zm711 commented Mar 18, 2024

I know that I would be confused if I deleted "random_spikes" and everything vanished. I might not realise that the other extensions were deleted when I deleted random_spikes. So the warning highlights this fact.

I think that is fair for newer users. I think it will also really annoy them that the warning is warning them after it is already done, but it is true that it will at least them know why they are now missing more than just what they thought they were deleting. So I can see it being helpful. I guess I could go either way.

Another idea: now that we have these relationships we could have a "compute_parents" option on the compute() method?

I think @alejoe91 wanted that too! We discussed that a bit here #2504, but Sam was against it because he wanted to keep things as explicit as possible.

Comment on lines 1042 to 1044
# recursive children and so grand children and grand grand children
# this is usefull to delete child extension on re compute
# for instance recompute the "waveforms" need to delete "template" in ms_before is changed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just wondering if we can get a proper docstring here. For future contributors that haven't been a part of the transition to SortingAnalyzer I think it would be nice. For example the parent-child in neo can be pretty confusing for new people so if we document it now I think future developers will thank us.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I will do this but this function will be private. I think it is internal no ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just imagining some young developer in 100 years working on spikeinterface and wishing all the private functions were fully documented.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully there will be a 1.0 by then ahahah

@samuelgarcia
Copy link
Member Author

Finally I choose the silently deletion.
Recomputing an extension is a corner case. Unless you are trying parameters.

@alejoe91 alejoe91 merged commit 0079860 into SpikeInterface:main Mar 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Changes to core module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants