-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #588 from lsst/tickets/DM-28716
DM-28716: Add pybind wrapper to afw archive that handles adding set of HDUs
- Loading branch information
Showing
9 changed files
with
129 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Developed for the LSST Data Management System. | ||
* This product includes software developed by the LSST Project | ||
* (https://www.lsst.org). | ||
* See the COPYRIGHT file at the top-level directory of this distribution | ||
* for details of code ownership. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "pybind11/pybind11.h" | ||
|
||
#include "lsst/utils/python.h" | ||
|
||
#include "lsst/afw/table/io/InputArchive.h" | ||
#include "lsst/afw/fits.h" | ||
|
||
namespace py = pybind11; | ||
using namespace py::literals; | ||
|
||
namespace lsst { | ||
namespace afw { | ||
namespace table { | ||
namespace io { | ||
|
||
using PyInputArchive = py::class_<InputArchive, std::shared_ptr<InputArchive>>; | ||
|
||
void wrapInputArchive(utils::python::WrapperCollection &wrappers) { | ||
wrappers.wrapType(PyInputArchive(wrappers.module, "InputArchive"), [](auto &mod, auto &cls) { | ||
cls.def("get", &InputArchive::get<Persistable>); | ||
cls.def("readFits", &InputArchive::readFits); | ||
}); | ||
} | ||
|
||
} // namespace io | ||
} // namespace table | ||
} // namespace afw | ||
} // namespace lsst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Developed for the LSST Data Management System. | ||
* This product includes software developed by the LSST Project | ||
* (https://www.lsst.org). | ||
* See the COPYRIGHT file at the top-level directory of this distribution | ||
* for details of code ownership. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "pybind11/pybind11.h" | ||
|
||
#include "lsst/utils/python.h" | ||
|
||
#include "lsst/afw/table/io/OutputArchive.h" | ||
#include "lsst/afw/fits.h" | ||
#include "lsst/afw/table/io/Persistable.h" | ||
|
||
namespace py = pybind11; | ||
using namespace py::literals; | ||
|
||
namespace lsst { | ||
namespace afw { | ||
namespace table { | ||
namespace io { | ||
|
||
using PyOutputArchive = py::class_<OutputArchive, std::shared_ptr<OutputArchive>>; | ||
|
||
void wrapOutputArchive(utils::python::WrapperCollection &wrappers) { | ||
wrappers.wrapType(PyOutputArchive(wrappers.module, "OutputArchive"), [](auto &mod, auto &cls) { | ||
cls.def(py::init<>()); | ||
cls.def("put", | ||
py::overload_cast<std::shared_ptr<Persistable const>, bool>(&OutputArchive::put), | ||
"obj"_a, "permissive"_a=false | ||
); | ||
cls.def("writeFits", &OutputArchive::writeFits); | ||
}); | ||
} | ||
|
||
} // namespace io | ||
} // namespace table | ||
} // namespace afw | ||
} // namespace lsst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters