LSST Applications  21.0.0-1-g8760c09+64c1bc5aa5,21.0.0-1-ga51b5d4+9915f4c1f0,21.0.0-111-gf06e6c5c+fee76ed8f6,21.0.0-14-g3bd782b+25c619aa25,21.0.0-17-gd94932e+0bf297642c,21.0.0-2-g103fe59+ccc08e5a44,21.0.0-2-g45278ab+64c1bc5aa5,21.0.0-2-g5242d73+7a03d65b13,21.0.0-2-g7f82c8f+cb30300d2e,21.0.0-2-gde069b7+4f46bdaea8,21.0.0-2-gfc62afb+7a03d65b13,21.0.0-20-g1e553c2+8d8bef21d9,21.0.0-20-g3b2d1f0+b95b9e7887,21.0.0-21-g51ee50f4+27a29155c2,21.0.0-21-gc8894c7+552aca6dca,21.0.0-27-gcbf119a+71dcc0c312,21.0.0-3-g1b65d06+c212a16cbd,21.0.0-3-g357aad2+6b2f77ef8c,21.0.0-3-g4a4ce7f+7a03d65b13,21.0.0-3-g4be5c26+7a03d65b13,21.0.0-3-ge02ed75+552aca6dca,21.0.0-3-gf9d8b05+cb30300d2e,21.0.0-30-g727f315e+692e5d6c44,21.0.0-4-g7dab645+80ff539b09,21.0.0-45-g119a6608a+532d44eec1,21.0.0-5-g5f8d297+a12ef938c8,21.0.0-5-g8c1d971+7e5b4c34a6,21.0.0-5-gcc89fd6+b18c5f6b76,21.0.0-5-gd00fb1e+cabc0fa2dc,21.0.0-6-g1930a60+b18c5f6b76,21.0.0-6-gc54ca17+f4e773f57d,21.0.0-6-gc675373+7a03d65b13,21.0.0-7-g0503b2e+18535a8d22,21.0.0-7-g7aa11f2+552aca6dca,21.0.0-7-gdf92d54+64c1bc5aa5,21.0.0-9-g7058be7+2d726afa20,master-ga86695c5c8+552aca6dca,master-gcc5351303a+ccc08e5a44,w.2021.25
LSST Data Management Base Package
python.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * See COPYRIGHT file at the top of the source tree.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_AFW_TABLE_IO_PYTHON_H
25 #define LSST_AFW_TABLE_IO_PYTHON_H
26 
27 #include "pybind11/pybind11.h"
28 
29 #include <memory>
30 #include <string>
31 
32 #include "lsst/afw/fits.h"
34 
35 namespace py = pybind11;
36 using namespace py::literals;
37 
38 namespace lsst {
39 namespace afw {
40 namespace table {
41 namespace io {
42 namespace python {
43 
55 template <typename Class, typename... Args>
56 void addPersistableMethods(pybind11::class_<Class, Args...> &cls) {
57  cls.def_static("readFits",
59  "fileName"_a, "hdu"_a = fits::DEFAULT_HDU);
60  cls.def_static(
61  "readFits",
63  "manager"_a, "hdu"_a = fits::DEFAULT_HDU);
64  cls.def("writeFits", (void (Class::*)(std::string const &, std::string const &) const) & Class::writeFits,
65  "fileName"_a, "mode"_a = "w");
66  cls.def("writeFits",
67  (void (Class::*)(fits::MemFileManager &, std::string const &) const) & Class::writeFits,
68  "manager"_a, "mode"_a = "w");
69  cls.def("isPersistable", &Class::isPersistable);
70 }
71 } // namespace python
72 } // namespace io
73 } // namespace table
74 } // namespace afw
75 } // namespace lsst
76 
77 #endif
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:121
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
const int DEFAULT_HDU
Specify that the default HDU should be read.
Definition: fitsDefaults.h:18
void addPersistableMethods(pybind11::class_< Class, Args... > &cls)
Add table::io::Persistable and PersistableFacade methods to the pybind11 wrapper for a class.
Definition: python.h:56
def writeFits(filename, stamps, metadata, type_name, write_mask, write_variance, write_archive=False)
Definition: stamps.py:42
A base class for image defects.