22 #include "pybind11/pybind11.h" 23 #include "pybind11/stl.h" 36 py::str toString(Chunker
const &
self) {
37 return py::str(
"Chunker({!s}, {!s})")
38 .format(
self.getNumStripes(),
self.getNumSubStripesPerStripe());
43 py::class_<Chunker, std::shared_ptr<Chunker>>
cls(mod,
"Chunker");
45 cls.def(py::init<int32_t, int32_t>(),
"numStripes"_a,
46 "numSubStripesPerStripe"_a);
48 cls.def(
"__eq__", &Chunker::operator==, py::is_operator());
49 cls.def(
"__ne__", &Chunker::operator!=, py::is_operator());
51 cls.def_property_readonly(
"numStripes", &Chunker::getNumStripes);
52 cls.def_property_readonly(
"numSubStripesPerStripe",
53 &Chunker::getNumSubStripesPerStripe);
55 cls.def(
"getChunksIntersecting", &Chunker::getChunksIntersecting,
57 cls.def(
"getSubChunksIntersecting",
58 [](Chunker
const &
self, Region
const &
region) {
60 for (
auto const & sc:
self.getSubChunksIntersecting(region)) {
61 results.append(py::make_tuple(sc.chunkId, sc.subChunkIds));
66 cls.def(
"getAllChunks", &Chunker::getAllChunks);
67 cls.def(
"getAllSubChunks", &Chunker::getAllSubChunks,
"chunkId"_a);
69 cls.def(
"__str__", &toString);
70 cls.def(
"__repr__", &toString);
72 cls.def(
"__reduce__", [
cls](Chunker
const &
self) {
73 return py::make_tuple(
cls,
74 py::make_tuple(
self.getNumStripes(),
75 self.getNumSubStripesPerStripe()));
PYBIND11_MODULE(camera, mod)
A base class for image defects.
This file declares a class for partitioning the sky into chunks and sub-chunks.
daf::base::PropertyList * list