acies.vehicle_classifier.buffer#

Classes

StreamBuffer

A buffer to hold streaming data.

TemporalEnsembleBuff

A buffer to hold temporal ensemble messages.

class acies.vehicle_classifier.buffer.StreamBuffer#

Bases: object

A buffer to hold streaming data.

Parameters:
__init__(size, _data=<factory>, _meta=<factory>, _timestamps=<factory>)#
Parameters:
add(topic, timestamp, samples, meta)#

Add a new sample to the buffer.

Parameters:
  • topic (str) – The topic of the sample (e.g., ‘rs1/mic’).

  • timestamp (int) – The timestamp of the sample.

  • samples (np.ndarray) – The audio samples.

  • meta (dict) – Metadata associated with the samples.

get(keys, n)#

Get n-second of samples for all keys

Parameters:
  • keys (list[str]) – The keys to retrieve samples for.

  • n (int) – The number of seconds of samples to retrieve.

Raises:

ValueError – If not enough data is available.

Returns:

The retrieved samples and their metadata.

Return type:

tuple[dict[str, dict[int, np.ndarray]], dict[str, dict[int, dict]]]

class acies.vehicle_classifier.buffer.TemporalEnsembleBuff#

Bases: object

A buffer to hold temporal ensemble messages.

Parameters:
__init__(buff_size, _data=<factory>)#
Parameters:
add(msg)#

Add a new message to the buffer.

Parameters:

msg (AciesMsg) – The message to add.

ensemble(timestamp_now, ensemble_win_size, ensemble_size)#

Perform temporal ensembling on the buffered messages.

Parameters:
  • timestamp_now (int) – The current timestamp.

  • ensemble_win_size (int) – The window size for ensembling.

  • ensemble_size (int) – The number of messages to ensemble.

Raises:

ValueError – If not enough data is available for ensembling.

Returns:

The ensembled message.

Return type:

dict