{"id":13486474,"url":"https://github.com/ADVRHumanoids/MatLogger2","last_synced_at":"2025-03-27T20:33:25.068Z","repository":{"id":41283793,"uuid":"164446288","full_name":"ADVRHumanoids/MatLogger2","owner":"ADVRHumanoids","description":"Library for logging of numeric data to HDF5 MAT-files, which is RT-safe and multithreaded.","archived":false,"fork":false,"pushed_at":"2024-04-22T13:40:22.000Z","size":10494,"stargazers_count":27,"open_issues_count":9,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-22T04:41:45.363Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ADVRHumanoids.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-07T14:42:16.000Z","updated_at":"2025-03-02T07:42:40.000Z","dependencies_parsed_at":"2024-10-30T21:32:16.530Z","dependency_job_id":"c914e813-945f-41ae-aca1-59de5aec8367","html_url":"https://github.com/ADVRHumanoids/MatLogger2","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FMatLogger2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FMatLogger2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FMatLogger2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2FMatLogger2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ADVRHumanoids","download_url":"https://codeload.github.com/ADVRHumanoids/MatLogger2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245920827,"owners_count":20694170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T18:00:46.847Z","updated_at":"2025-03-27T20:33:24.643Z","avatar_url":"https://github.com/ADVRHumanoids.png","language":"C","funding_links":[],"categories":["Various robotics-tailored cpp utilities to perform signal processing, parameter identification and more"],"sub_categories":[],"readme":"# MatLogger2\nLibrary for logging of numeric data to HDF5 MAT-files, which is RT-safe and multithreaded.\n\n## Building MatLogger2 from source\nStandard cmake workflow:\n - git clone the repo to *SOURCE_DIR*\n - create a build folder *BUILD_DIR*\n - cd *BUILD_DIR* \u0026\u0026 cmake *SOURCE_DIR*\n - make\n - make install\n \n## Installing the binary release\n  - go to [GitHub release page](https://github.com/ADVRHumanoids/MatLogger2/releases) and download the latest binary\n  - sudo dpkg -i matlogger2-X.Y.Z-Linux.deb\n  \nThe binary release has been tested only with Ubuntu 16.04\n\n## Linking against MatLogger2\n```cmake\nfind_package(matlogger2 REQUIRED)\ntarget_link_libraries(mytarget matlogger2::matlogger2)\n```\n\n ## Quick start\n ### Circular-buffer mode\n ```c++\n #include \u003cmatlogger2/matlogger2.h\u003e\n \n int main()\n {\n    auto logger = XBot::MatLogger2::MakeLogger(\"/tmp/my_log\"); // date-time automatically appended\n    logger-\u003eset_buffer_mode(XBot::VariableBuffer::Mode::circular_buffer);\n    \n    for(int i = 0; i \u003c 1e5; i++)\n    {\n        Eigen::VectorXd vec(10);\n        Eigen::MatrixXd mat(6,8);\n        \n        logger-\u003eadd(\"my_vec_var\", vec);\n        logger-\u003eadd(\"my_scalar_var\", M_PI);\n        logger-\u003eadd(\"my_mat_var\", mat);\n    }\n    \n } // destructor flushes to disk\n ```\n \n  ### Producer-consumer mode (default)\n ```c++\n #include \u003cmatlogger2/matlogger2.h\u003e\n #include \u003cmatlogger2/utils/mat_appender.h\u003e\n \n int main()\n {\n    auto logger = XBot::MatLogger2::MakeLogger(\"/tmp/my_log.mat\"); // extension provided -\u003e date-time NOT appended\n    auto appender = XBot::MatAppender::MakeInstance();\n    appender-\u003eadd_logger(logger);\n    appender-\u003estart_flush_thread();\n    \n    for(int i = 0; i \u003c 1e5; i++)\n    {\n        Eigen::VectorXd vec(10);\n        Eigen::MatrixXd mat(6,8);\n        \n        logger-\u003eadd(\"my_vec_var\", vec);\n        logger-\u003eadd(\"my_scalar_var\", M_PI);\n        logger-\u003eadd(\"my_mat_var\", mat);\n        \n        usleep(1000);\n    }\n    \n }\n ```\n \n ### Custom buffer size and compression\n ```c++\n #include \u003cmatlogger2/matlogger2.h\u003e\n \n int main()\n {\n    XBot::MatLogger2::Options opt;\n    opt.default_buffer_size = 1e4; // set default buffer size\n    opt.enable_compression = true; // enable ZLIB compression\n                                   // this can be computationally expensive\n    auto logger = XBot::MatLogger2::MakeLogger(\"/tmp/my_log\", opt);\n    \n    logger-\u003ecreate(\"my_vec_var\", 10); // this pre-allocates the buffer with default buffer size\n    \n    logger-\u003ecreate(\"my_mat_var\", 6, 8, 1e3); // custom buffer size can be set variable-wise\n    \n    for(int i = 0; i \u003c 1e5; i++)\n    {\n        Eigen::VectorXd vec(10);\n        Eigen::MatrixXd mat(6,8);\n        \n        logger-\u003eadd(\"my_vec_var\", vec);\n        logger-\u003eadd(\"my_scalar_var\", M_PI);\n        logger-\u003eadd(\"my_mat_var\", mat);\n        \n        usleep(1000);\n    }\n    \n    logger.reset(); // manually destroy the logger in order to flush to disk\n    \n } \n ```\n \n ### Python bindings\n If [`pybind11`](https://pybind11.readthedocs.io/en/stable/) can be found on your system, python2.7 bindings will be generated and installed. It'll then be possible to log `numpy` arrays and python lists in the same way as the C++ API works with `Eigen3` types and STL classes.\n #### Python API vs C++\n Main differences are:\n  - factories are replaced by simple constructors\n #### Example\n ```python\nimport matlogger2.matlogger as ml\n\nlogger = ml.MatLogger2(file='/tmp/my_log', \n                      enable_compression=True,# default value is False\n                      default_buffer_size=int(1e5)) # default value is 1e4\n              \nlogger.setBufferMode(ml.BufferMode.ProducerConsumer) # this is already the default choice\n\nap = ml.MatAppender()\nap.add_logger(logger)\nap.start_flush_thread()\n\nlogger.create('myvar', 5, 1, buffer_size=1000) # 5x1 variable\nlogger.add('myvar', [0, 1, 2, 3, 4])\n\ndel(logger) # destroy to force flushing\n\n```\n \n ## Documentation\n Header files are documented with doxygen! An [**online version**](https://advrhumanoids.github.io/MatLogger2/classXBot_1_1MatLogger2.html) is also available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FADVRHumanoids%2FMatLogger2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FADVRHumanoids%2FMatLogger2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FADVRHumanoids%2FMatLogger2/lists"}