Datasets#

Dynamic homogeneous multi-dimensional numerical data stored in std::vector. Used to record data collected during an ExperimentalRun.

navground.sim.Dataset supports the buffer protocol and is convertible to and from a numpy.ndarray:

>>> from navground import sim
>>> import numpy
>>>
>>> ds = sim.Dataset(data=numpy.array([1, 2, 3], dtype=numpy.uint8))
>>> ds
<Dataset: shape (3,), dtype uint8>
>>> numpy.asarray(ds)
array([1, 2, 3], dtype=uint8)

Instantiate a dataset with an object convertible to a numpy array of one of the types of navground::sim::Dataset::Scalar.

Parameters:
  • data (numpy.typing.ArrayLike | None) – Copies shape, data and dtype from this numpy array (if specified)

  • dtype (numpy.typing.DTypeLike | None.) – The type of data to store (if specified and if data is None)

  • item_shape (list[int]) – Set the shape of all axis except the first (only if data is None ). Set to an empty list to instantiate a flat dataset.

Append items from (objects convertible to) numpy arrays of one of the types of navground::sim::Dataset::Scalar.

Parameters:
  • values (numpy.typing.ArrayLike) – Append data and dtype from this numpy array

  • reset (bool) – Whether to replace the data instead of appending.

Add an item of one of the types of navground::sim::Dataset::Scalar.

The item will be converted to the current data type, see dtype().

Parameters:

value (numbers.Real) – The value to add

Clear all data.

Writes a buffer with the content of one dataset entry.

Parameters:
  • buffer – The buffer

  • index – The index of the entry

Returns:

True if writing was successful.

Type:

numpy.dtype

The type of the dataset.

Can be set to any object that is convertible to numpy.dtype.

Type:

bool

Determines if valid.

Type:

list[int]

The shape of all axis except the first.

Type:

list[int]

Returns the shape of the multi-dimensional dataset