Skip to content

GeneratorRecording outline #1413

@h-mayorquin

Description

@h-mayorquin

Hi, so I am writing here the outline of the features that the GeneratorRecording should have as discussed on today's meeting. The purpose of this issue is to discuss, describe and agree what we want ant to outline the features that we will be adding to it.

The general idea, as described in #1391, is to have a generator whose memory footpring is fully controlled. This is very useful for testing purposes and specifically decoupling reading from writing bugs on high-memory loads. Plus, if we add more functionality, as discussed below, maybe this function can be used in more general scenarios.

Ther are at least two important properties:

  1. Consistency with signature: get_traces(start_frame, end_frame, segment_index) output is totally determined by the parameters on the signature.
  2. Array-like behavior: get_traces(start_frame, end_frame) == get_traces(start_frame,end_frame + 10)[start_frame:end_frame, :]

Notablye that the naive solution of:

def _random_traces(self, start_frame: int, end_frame: int) -> np.ndarray:

    unique_seed_hash = (start_frame, end_frame, self.seed)
    local_rng = np.random.default_rng(seed=unique_seed_hash)
    traces = local_rng.random(size=(end_frame - start_frame, self.num_channels), dtype=self.dtype)
    
    return traces

Has property 1 but not property 2.

Right now, #1391 has a solution that accomplishes these two properties to this by returning a "deterministic" function with period output that looks like this:
image

The general shape is controlled by a random seed and it produces channels with different period, phase and amplitude. I was thinking in using to test detect_peaks scenarios when I wrote that.

That said, we would like to have more functionality to this function in the form of modes so we can support a wider variety of cases. The following outline describes them.

  • Add capabilities to generate pure noise which also has property 2 above.
  • Add capabilites to combine the "deterministic" output of the current solution with noise on top.
  • Add simply sinusoidal behavior for LFP like scenarios.

Metadata

Metadata

Assignees

Labels

coreChanges to core moduleenhancementNew feature or requesttestingRelated to test routines

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions