torch_brain.utils

Tokenizers

create_linspace_latent_tokens()

Create groups of latent tokens with timestamps.

create_start_end_unit_tokens()

Adds start and end tokens to each unit.

create_linspace_latent_tokens(start, end, step, num_latents_per_step)[source]

Creates a sequence of latent tokens. Each token is defined by the latent index and the timestamps. The sequence is defined by the start and end time and the step size. The group of num_latents_per_step latents is repeated for each step.

Parameters:
  • start (float) – The start time of the sequence.

  • end (float) – The end time of the sequence.

  • step (float) – The step size.

  • num_latents_per_step (int) – The number of latents per step.

create_start_end_unit_tokens(unit_ids, start, end)[source]

Creates for each unit a start and end token. Each token is defined by the unit index, the token type index and the timestamps.

Parameters:
  • unit_ids (np.ndarray) – List of unit identifiers.

  • start (float) – The start time of the sequence.

  • end (float) – The end time of the sequence.