Skip to main content

单帧 soc bag 目录的发现与路径解析,仅返回路径信息,不提供文件读写

Project description

socbag-manager

单帧 soc bag 目录的发现与路径解析库,仅返回路径信息,不读取/写入文件内容。

目录约定

  • bag 目录: {base_path}/{bag_path}/,需同时存在 camera/lidar/ 子目录
  • 相机图像: {base}/{bag_path}/camera/{camera_name}/data/{sequence}.png
  • 雷达点云: {base}/{bag_path}/lidar/{lidar_name}/pcd/{sequence}.pcd

安装

pip install socbag-manager

统一设置

所有 API 基于 SocbagManagerSettings,可从代码构造或 YAML 加载(兼容 C03 base_paths/priority_base_path 与 C04 data_dirs/default_main_dir):

from socbag_manager import SocbagManagerSettings

settings = SocbagManagerSettings(
    base_paths={"pandar": "/data/pandar", "at128": "/data/at128"},
    priority_source="pandar",
    bag_name_pattern="*_soc*",
)
# 或
settings = SocbagManagerSettings.from_yaml("/path/to/config.yaml")

主要 API

  • 发现: get_ordered_base_paths, discover_bags, discover_bags_from_scan_root, discover_cameras, discover_lidars, discover_sequences
  • 路径解析: resolve_camera_paths, resolve_lidar_paths, resolve_frame_paths
  • 候选枚举: list_frame_candidates, choose_one_candidateCandidatePath
  • 目录树: TreeNode, build_folder_tree(settings, scope="roots"|"bags"|"sequences", ...)

使用示例

from socbag_manager import (
    SocbagManagerSettings,
    discover_bags,
    discover_sequences,
    resolve_frame_paths,
    build_folder_tree,
)

settings = SocbagManagerSettings.from_yaml("config.yaml")
bag_names = discover_bags(settings)
sequences = discover_sequences(settings, bag_names[0])
paths = resolve_frame_paths(settings, bag_names[0], sequences[0])
# paths["images"], paths["pcds"]

tree_roots = build_folder_tree(settings, scope="bags")
for root in tree_roots:
    for bag in root.children:
        print(bag.name, bag.path)

约束

  • 所有接口仅返回路径(字符串或树节点中的 path),不读取/解析图像或点云文件。
  • 依赖:Python >=3.10,PyYAML。

开发与测试

pip install -e ".[dev]"
python -m pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

socbag_manager-0.0.2.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

socbag_manager-0.0.2-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file socbag_manager-0.0.2.tar.gz.

File metadata

  • Download URL: socbag_manager-0.0.2.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for socbag_manager-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ac916be5734d85ccffe062d44c7d559aba8fbf48ce212ecfeda325adf6c9a68a
MD5 63e65c34848e8edfb57a0e46560d5d8e
BLAKE2b-256 b2f8be101f6629eb48d574d986008ca2abf23154d9a55b0741f7e7a69087fa78

See more details on using hashes here.

File details

Details for the file socbag_manager-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: socbag_manager-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for socbag_manager-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5eb29c85dfdbcf4d492f00e37693f320e7d20097e9253899ff674dd355d8770d
MD5 ea547144010025c4bb07b830baa49fdb
BLAKE2b-256 81b72b905b6760d8b2d95b4635f05d43cc3e6960b039f5ce5f0ae6faa3e690d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page