Module ouster.sdk.osf

ouster.sdk.osf.multi

Warning

Deprecated since version 0.15.0 The ouster.osf.multi has been renamed to ouster.osf.osf_scan_source under the ouster.osf package. THIS FILE WILL BE REMOVED IN NEXT RELEASE.

ouster.sdk.osf

Copyright (c) 2021, Ouster, Inc. All rights reserved.

API to work with OSF files

class OsfScanSource(self: ouster.sdk._bindings.osf.OsfScanSource, file: str, **kwargs)

Bases: ScanSource

class Writer(*args, **kwargs)

Bases: pybind11_object

Simple writer interface for OSF file

All jobs are done with MetadataStore for adding metadata entries and stream interfaces that encodes messages and passes them to internal chunks writer.

Overloaded function.

  1. __init__(self: ouster.sdk._bindings.osf.Writer, file_name: str, chunk_size: int = 0) -> None

    Creates a Writer with specified chunk_size.

    Default chunk_size is 2 MB.

  2. __init__(self: ouster.sdk._bindings.osf.Writer, filename: str, info: ouster.sdk._bindings.client.SensorInfo, fields_to_write: list[str] = [], chunk_size: int = 0, encoder: ouster::osf::Encoder = None) -> None

    Creates a Writer with deafault STREAMING layout chunks writer.

    Using default chunk_size of 2MB.

    Args:

    filename (str): The filename to output to. info (sensor_info): The sensor info vector to use for a multi stream OSF

    file.

    chunk_size (int): The chunk size in bytes to use for the OSF file. This arg

    is optional, and if not provided the default value of 2MB is used. If the current chunk being written exceeds the chunk_size, a new chunk will be started on the next call to save. This allows an application to tune the number of messages (e.g. lidar scans) per chunk, which affects the granularity of the message index stored in the StreamingInfo in the file metadata. A smaller chunk_size means more messages are indexed and a larger number of index entries. A more granular index allows for more precise seeking at the slight expense of a larger file.

    fields_to_write (List[str]): The fields from scans to

    actually save into the OSF. If not provided uses the fields from the first saved lidar scan for each stream. This parameter is optional.

  3. __init__(self: ouster.sdk._bindings.osf.Writer, filename: str, info: list[ouster.sdk._bindings.client.SensorInfo], fields_to_write: list[str] = [], chunk_size: int = 0, encoder: ouster::osf::Encoder = None) -> None

    Creates a Writer with specified chunk_size.

    Default chunk_size is 2MB.

    Args:

    filename (str): The filename to output to. info (List[sensor_info]): The sensor info vector to use for a

    multi stream OSF file.

    fields_to_write (List[str]): The fields from scans to

    actually save into the OSF. If not provided uses the fields from the first saved lidar scan for each stream. This parameter is optional.

    chunk_size (int): The chunksize to use for the OSF file, this arg

    is optional.

add_metadata(self: ouster.sdk._bindings.osf.Writer, m: object) int

Add metadata entry to a file

add_sensor(self: ouster.sdk._bindings.osf.Writer, info: ouster.sdk._bindings.client.SensorInfo, fields_to_write: list[str] = []) int

Add a sensor to the OSF file.

Parameters:
  • info (sensor_info) – Sensor to add.

  • fields_to_write (List[str]) – The fields from scans to actually save into the OSF. If not provided uses the fields from the first saved lidar scan for each stream. This parameter is optional.

Returns (int):

The stream index to use to write scans to this sensor.

close(self: ouster.sdk._bindings.osf.Writer) None

Finish OSF file and flush everything to disk.

filename(self: ouster.sdk._bindings.osf.Writer) str

Return the osf file name.

Returns (str):

The OSF filename.

is_closed(self: ouster.sdk._bindings.osf.Writer) bool

Return the closed status of the writer.

Returns (bool):

The closed status of the writer.

property meta_store

Returns the metadata store that gives an access to all metadata entries in the file.

metadata_id(self: ouster.sdk._bindings.osf.Writer) str

Return the metadata identifier string.

Returns (str):

The OSF metadata identifier string.

save(*args, **kwargs)

Overloaded function.

  1. save(self: ouster.sdk._bindings.osf.Writer, stream_index: int, scan: ouster.sdk._bindings.client.LidarScan) -> None

    Save a lidar scan to the OSF file.

    Args:
    stream_index (int): The index of the corresponding

    sensor_info to use.

    scan (LidarScan): The scan to save.

  2. save(self: ouster.sdk._bindings.osf.Writer, stream_index: int, scan: ouster.sdk._bindings.client.LidarScan, ts: int) -> None

    Save a lidar scan to the OSF file.

    Args:
    stream_index (int): The index of the corresponding

    sensor_info to use.

    scan (LidarScan): The scan to save. ts (int): The timestamp to index the scan with.

  3. save(self: ouster.sdk._bindings.osf.Writer, scan: list[ouster.sdk._bindings.client.LidarScan]) -> None

    Save a set of lidar scans to the OSF file.

    Args:
    scans (List[LidarScan]): The scans to save. This will correspond

    to the list of sensor_infos.

  4. save(self: ouster.sdk._bindings.osf.Writer, stream_index: int, scan: ouster.sdk._bindings.client.LidarScan) -> None

    Save a lidar scan to the OSF file.

    Args:
    stream_index (int): The index of the corresponding

    sensor_info to use.

    scan (LidarScan): The scan to save.

  5. save(self: ouster.sdk._bindings.osf.Writer, scan: list[ouster.sdk._bindings.client.LidarScan]) -> None

    Save a set of lidar scans to the OSF file.

    Args:
    scans (List[LidarScan]): The scans to save. This will correspond

    to the list of sensor_infos.

save_message(*args, **kwargs)

Overloaded function.

  1. save_message(self: ouster.sdk._bindings.osf.Writer, stream_id: int, receive_ts: int, sensor_ts: int, buffer: numpy.ndarray[numpy.uint8]) -> None

    Low-level save message routine.

    Directly saves the message buffer with id and ts (ns) without any further checks.

  2. save_message(self: ouster.sdk._bindings.osf.Writer, stream_id: int, receive_ts: int, sensor_ts: int, buffer: Buffer) -> None

    Low-level save message routine.

    Directly saves the message buffer with id and ts (ns) without any further checks.

sensor_info(*args, **kwargs)

Overloaded function.

  1. sensor_info(self: ouster.sdk._bindings.osf.Writer) -> list[ouster.sdk._bindings.client.SensorInfo]

    Return the sensor info list.

    Returns (List[sensor_info]):

    The sensor info list.

  2. sensor_info(self: ouster.sdk._bindings.osf.Writer, stream_index: int) -> ouster.sdk._bindings.client.SensorInfo

    Return the sensor info of the specifed stream_index.

    Args:
    stream_index (in): The index of the sensor to return

    info about.

    Returns (sensor_info):

    The correct sensor info

sensor_info_count(self: ouster.sdk._bindings.osf.Writer) int

Return the number of sensor_info objects.

Returns (int):

The number of sensor_info objects.

set_metadata_id(self: ouster.sdk._bindings.osf.Writer, arg0: str) None

Set the metadata identifier string.

class AsyncWriter(self: ouster.sdk._bindings.osf.AsyncWriter, filename: str, info: list[ouster.sdk._bindings.client.SensorInfo], fields_to_write: list[str] = [], chunk_size: int = 0, encoder: ouster::osf::Encoder = None)

Bases: pybind11_object

Creates an AsyncWriter with specified chunk_size.

Default chunk_size is 2MB.

Parameters:
  • filename (str) – The filename to output to.

  • info (List[sensor_info]) – The sensor info vector to use for a multi stream OSF file.

  • fields_to_write (List[str]) – The fields from scans to actually save into the OSF. If not provided uses the fields from the first saved lidar scan for each stream. This parameter is optional.

  • chunk_size (int) – The chunksize to use for the OSF file, this arg is optional.

  • encoder (Encoder) – an optional encoder instance, used to configure how writer encodes the OSF.

close(self: ouster.sdk._bindings.osf.AsyncWriter) None

Finish OSF file and flush everything to disk.

save(*args, **kwargs)

Overloaded function.

  1. save(self: ouster.sdk._bindings.osf.AsyncWriter, stream_index: int, scan: ouster.sdk._bindings.client.LidarScan) -> FutureWrapper

    Save a lidar scan to the OSF file.

    Args:
    stream_index (int): The index of the corresponding

    sensor_info to use.

    scan (LidarScan): The scan to save.

    Returns: a future.

  2. save(self: ouster.sdk._bindings.osf.AsyncWriter, stream_index: int, scan: ouster.sdk._bindings.client.LidarScan, ts: int) -> FutureWrapper

    Save a lidar scan to the OSF file.

    Args:
    stream_index (int): The index of the corresponding

    sensor_info to use.

    scan (LidarScan): The scan to save. ts (int): The timestamp to index the scan with.

    Returns: a future.

  3. save(self: ouster.sdk._bindings.osf.AsyncWriter, scan: list[ouster.sdk._bindings.client.LidarScan]) -> list[FutureWrapper]

    Save a set of lidar scans to the OSF file.

    Args:
    scans (List[LidarScan]): The scans to save. This will correspond

    to the list of sensor_infos.

    Returns: a list of futures.