tonic.functional.drop_event#

Module Contents#

Functions#

drop_event_numpy(events, drop_probability)

Randomly drops events with drop_probability.

drop_by_time_numpy(events[, duration_ratio])

Drops events in a certain time interval with a length proportional to a specified ratio of

drop_by_area_numpy(events, sensor_size[, area_ratio])

Drops events located in a randomly chosen box area. The size of the box area is defined by a

tonic.functional.drop_event.drop_event_numpy(events: numpy.ndarray, drop_probability: float)[source]#

Randomly drops events with drop_probability.

Parameters:
  • events (numpy.ndarray) – ndarray of shape [num_events, num_event_channels].

  • drop_probability (float) – probability of dropping out event.

Returns:

augmented events that were not dropped.

tonic.functional.drop_event.drop_by_time_numpy(events: numpy.ndarray, duration_ratio: Union[float, Tuple[float]] = 0.2)[source]#

Drops events in a certain time interval with a length proportional to a specified ratio of the original length.

Parameters:
  • events (np.ndarray) – ndarray of shape [num_events, num_event_channels]

  • duration_ratio (Union[float, Tuple[float]], optional) – the length of the dropped time interval, expressed in a ratio of the original sequence duration. - If a float, the value is used to calculate the interval length - If a tuple of 2 floats, the ratio is randomly chosen in [min, max). Defaults to 0.2.

Returns:

augmented events that were not dropped (i.e., the events that are not in the time interval).

Return type:

np.ndarray

tonic.functional.drop_event.drop_by_area_numpy(events: numpy.ndarray, sensor_size: Tuple, area_ratio: Union[float, Tuple[float]] = 0.2)[source]#

Drops events located in a randomly chosen box area. The size of the box area is defined by a specified ratio of the sensor size.

Parameters:
  • events (np.ndarray) – ndarray of shape [num_events, num_event_channels]

  • sensor_size (Tuple) – size of the sensor that was used [W,H,P]

  • area_ratio (Union[float, Tuple[float]], optional) – Ratio of the sensor resolution that determines the size of the box area where events are dropped. - if a float, the value is used to calculate the size of the box area - if a tuple of 2 floats, the ratio is randomly chosen in [min, max) Defaults to 0.2.

Returns:

augmented events that were not dropped (i.e., the events that are not located in the box area).

Return type:

np.ndarray