Skip to content

raghavauppuluri13/pydatatamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pydatatamer

View data_tamer mcap files as numpy array

Supported Platforms

  • Linux (for now)

Quick Start (from source)

  1. Clone pydata_tamer
git clone https://github.com/raghavauppuluri13/pydatatamer.git
cd pydata_tamer
  1. Install pydata_tamer (also builds pybind11)
pip3 install -e .
  1. Run example
cd examples
python3 read_data.py

Add new snapshot types

  1. Update include/mcap_types.hpp with your new snapshot type
struct Point {
    double x;
    double y;

    Point() {}

    inline void update(std::string name,
                       const DataTamerParser::VarNumber &data) {
        if (name == "x")) {
            position = std::get<double>(data);
        } else if (name == "y") {
            velocity = std::get<double>(data);
        } else {
            std::cerr << "unknown series name: " << name << std::endl;
            throw std::runtime_error("Unknown series!");
        }
    }
};
  1. Update mcap_reader.cpp's PYBIND11_MODULE->McapReader with your new snapshot type template
py::class_<Point>(m, "Point")
    .def(py::init<>())
    .def_readwrite("x", &Point::x)
    .def_readwrite("y", &Point::y);
PYBIND11_NUMPY_DTYPE(Point, x, y);
py::class_<McapTamer<Point>>(m, "McapTamer")
    .def(py::init<>())
    .def("init", &McapTamer<Point>::init)
    .def("parse", &McapTamer<Point>::parse);
  1. pip install again to build
  2. Read in python
from pydatatamer.mcap_tamer import McapTamer
import numpy as np
mcap_tamer = McapTamer()
mcap_tamer.init("points.mcap")
# structured array
points_data = mcap_tamer.parse()
print(points)

Credits

About

Fast Python Bindings for data_tamer MCAP files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages