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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix t_starts not propagated to save_to_memory. #3120

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JoeZiminski
Copy link
Collaborator

This PR closes #2515 by propagated t_starts to memory recording objects during save_to_memory. This is tested in #3117.

This works to propagate the times to save to memory, and tests are passing, but I havn't considered other uses for these recording classes. So it would be great if others could let me know if this might break anything elsewhere! I can't see why it would as it uses default kwargs that maintain the old behaviour, but still I'm paranoid 馃槄

@JoeZiminski JoeZiminski changed the title Fix t_starts not propagated to save memory. Fix t_starts not propagated to save_to_memory. Jul 1, 2024
@alejoe91 alejoe91 added this to the 0.101.0 milestone Jul 2, 2024
@alejoe91 alejoe91 added the core Changes to core module label Jul 2, 2024
Copy link
Collaborator

@h-mayorquin h-mayorquin left a comment

Choose a reason for hiding this comment

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

Let's move the corresponding tests from #3117 to here.

I suspect that you tested this in #3117 because you wanted to have a canonical way for seting the t_start in your tests but you don't really need it, t_start is a public attribute of the segment class.

Plus, you are adding interface in #3117 and the tests should not depend on the newly added interface. Having t_start as an attribute of the segment class is a deper contract that the interface at the recording class and the tests of the interface should rely on the machinery that is already baked in on the data model.

@@ -545,11 +545,11 @@ def _save(self, format="binary", verbose: bool = False, **save_kwargs):
if kwargs.get("sharedmem", True):
from .numpyextractors import SharedMemoryRecording

cached = SharedMemoryRecording.from_recording(self, **job_kwargs)
cached = SharedMemoryRecording.from_recording(self, t_starts=t_starts, **job_kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

Cool. thanks a lot I forgot it.

@@ -85,7 +85,7 @@ def __init__(self, traces_list, sampling_frequency, t_starts=None, channel_ids=N
}

@staticmethod
def from_recording(source_recording, **job_kwargs):
def from_recording(source_recording, t_starts=None, **job_kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

Not sure to agree with this. The t_tsarts should be taken from the source recording. No ?

Copy link
Member

Choose a reason for hiding this comment

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

@@ -211,18 +212,16 @@ def __del__(self):
shm.unlink()

@staticmethod
def from_recording(source_recording, **job_kwargs):
def from_recording(source_recording, t_starts=None, **job_kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

same here.

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.

Times not propagated by .save_to_memory()
4 participants