Beispiel #1
0
    void pyExportSBProfile(PY_MODULE& _galsim)
    {
        py::class_<GSParams>(GALSIM_COMMA "GSParams" BP_NOINIT)
            .def(py::init<
                 int, int, double, double, double, double, double, double, double, double,
                 double, double, double>());

        py::class_<SBProfile> pySBProfile(GALSIM_COMMA "SBProfile" BP_NOINIT);
        pySBProfile
            .def("xValue", &SBProfile::xValue)
            .def("kValue", &SBProfile::kValue)
            .def("maxK", &SBProfile::maxK)
            .def("stepK", &SBProfile::stepK)
            .def("centroid", &SBProfile::centroid)
            .def("getFlux", &SBProfile::getFlux)
            .def("getPositiveFlux", &SBProfile::getPositiveFlux)
            .def("getNegativeFlux", &SBProfile::getNegativeFlux)
            .def("maxSB", &SBProfile::maxSB)
            .def("shoot", &SBProfile::shoot);
        WrapTemplates<float>(pySBProfile);
        WrapTemplates<double>(pySBProfile);
    }
Beispiel #2
0
        static void wrap() {
            static char const * doc = 
                "\n"
                "SBProfile is an abstract base class represented all of the 2d surface\n"
                "brightness that we know how to draw.  Every SBProfile knows how to\n"
                "draw an Image<float> of itself in real and k space.  Each also knows\n"
                "what is needed to prevent aliasing or truncation of itself when drawn.\n"
                "\n"
                "Note that when you use the SBProfile::draw() routines you will get an\n"
                "image of **surface brightness** values in each pixel, not the flux\n"
                "that fell into the pixel.  To get flux, you must multiply the image by\n"
                "(dx*dx).\n"
                "\n"
                "drawK() routines are normalized such that I(0,0) is the total flux.\n"
                "\n"
                "Currently we have the following possible implementations of SBProfile:\n"
                "Basic shapes: SBBox, SBGaussian, SBExponential, SBAiry, SBSersic\n"
                "SBLaguerre: Gauss-Laguerre expansion\n"
                "SBTransform: affine transformation of another SBProfile\n"
                "SBAdd: sum of SBProfiles\n"
                "SBConvolve: convolution of other SBProfiles\n"
                "\n"
                "==== Drawing routines ==== \n"
                "Grid on which SBProfile is drawn has pitch dx, which is taken from the\n"
                "image's scale parameter.\n"
                "\n"
                "Note that in an FFT the image may be calculated internally on a\n"
                "larger grid than the provided image to avoid folding.\n"
                "Specifying wmult > 1 will draw an image that is wmult times larger than the \n"
                "default choice, i.e. it will have finer sampling in k space and have less \n"
                "folding.\n"
                ;

            bp::class_<SBProfile> pySBProfile("SBProfile", doc, bp::no_init);
            pySBProfile
                .def(bp::init<const SBProfile &>())
                .def("xValue", &SBProfile::xValue,
                     "Return value of SBProfile at a chosen 2d position in real space.\n"
                     "May not be implemented for derived classes (e.g. SBConvolve) that\n"
                     "require an FFT to determine real-space values.")
                .def("kValue", &SBProfile::kValue,
                     "Return value of SBProfile at a chosen 2d position in k-space.")
                .def("maxK", &SBProfile::maxK, "Value of k beyond which aliasing can be neglected")
                .def("nyquistDx", &SBProfile::nyquistDx,
                     "Image pixel spacing that does not alias maxK")
                .def("getGoodImageSize", &SBProfile::getGoodImageSize,
                     "A good image size for drawing the SBProfile")
                .def("stepK", &SBProfile::stepK,
                     "Sampling in k space necessary to avoid folding of image in x space")
                .def("isAxisymmetric", &SBProfile::isAxisymmetric)
                .def("hasHardEdges", &SBProfile::hasHardEdges)
                .def("isAnalyticX", &SBProfile::isAnalyticX,
                     "True if real-space values can be determined immediately at any position "
                     "without DFT.")
                .def("isAnalyticK", &SBProfile::isAnalyticK,
                     "True if k-space values can be determined immediately at any position "
                     "without DFT.")
                .def("centroid", &SBProfile::centroid)
                .def("getFlux", &SBProfile::getFlux)
                .def("scaleFlux", &SBProfile::scaleFlux, bp::args("fluxRatio"))
                .def("setFlux", &SBProfile::setFlux, bp::args("flux"))
                .def("applyTransformation", &SBProfile::applyTransformation, bp::args("e"))
                .def("applyShear",
                     (void (SBProfile::*)(CppShear))&SBProfile::applyShear,
                     (bp::arg("s")))
                .def("applyRotation", &SBProfile::applyRotation, bp::args("theta"))
                .def("applyShift", &SBProfile::applyShift, bp::args("dx", "dy"))
                .def("shoot", &SBProfile::shoot, bp::args("n", "u"))
                ;
            wrapTemplates<float>(pySBProfile);
            wrapTemplates<double>(pySBProfile);
        }