aare/examples/numpy_write_example.cpp
Bechir Braham 31a20d4f6c
fix ci and add formatting (#48)
* add dependency

* dont run blocking zmq example and add formatting

* format files
2024-04-03 13:47:52 +02:00

28 lines
632 B
C++

// Your First C++ Program
#include "aare/File.hpp"
#include "aare/Frame.hpp"
#include <iostream>
#define AARE_ROOT_DIR_VAR "PROJECT_ROOT_DIR"
using aare::File;
using aare::FileConfig;
using aare::Frame;
int main() {
auto path = std::filesystem::path("/tmp/test.npy");
auto dtype = aare::DType(typeid(uint32_t));
FileConfig cfg = {path, dtype, 100, 100};
File npy(path, "w", cfg);
Frame f(100, 100, dtype.bitdepth());
for (int i = 0; i < 10000; i++) {
f.set<uint32_t>(i / 100, i % 100, i);
}
npy.write(f);
f.set<uint32_t>(0, 0, 77);
npy.write(f);
npy.write(f);
return 0;
}