LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
Functions
interpolate.cc File Reference
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "ndarray/pybind11.h"
#include "lsst/afw/math/Interpolate.h"

Go to the source code of this file.

Functions

 PYBIND11_MODULE (interpolate, mod)
 

Function Documentation

◆ PYBIND11_MODULE()

PYBIND11_MODULE ( interpolate  ,
mod   
)

Definition at line 36 of file interpolate.cc.

36  {
37  py::class_<Interpolate, std::shared_ptr<Interpolate>> clsInterpolate(mod, "Interpolate");
38  py::enum_<Interpolate::Style>(clsInterpolate, "Style")
39  .value("UNKNOWN", Interpolate::Style::UNKNOWN)
40  .value("CONSTANT", Interpolate::Style::CONSTANT)
41  .value("LINEAR", Interpolate::Style::LINEAR)
42  .value("NATURAL_SPLINE", Interpolate::Style::NATURAL_SPLINE)
43  .value("CUBIC_SPLINE", Interpolate::Style::CUBIC_SPLINE)
44  .value("CUBIC_SPLINE_PERIODIC", Interpolate::Style::CUBIC_SPLINE_PERIODIC)
45  .value("AKIMA_SPLINE", Interpolate::Style::AKIMA_SPLINE)
46  .value("AKIMA_SPLINE_PERIODIC", Interpolate::Style::AKIMA_SPLINE_PERIODIC)
47  .value("NUM_STYLES", Interpolate::Style::NUM_STYLES)
48  .export_values();
49 
50  clsInterpolate.def("interpolate", [](Interpolate &t, double const x) {
51  /*
52  We use a lambda function here because interpolate (with a double) is a virtual function and therefor
53  cannot be wrapped directly.
54  */
55  return t.interpolate(x);
56  });
57 
58  clsInterpolate.def("interpolate",
60  Interpolate::interpolate);
61  clsInterpolate.def(
62  "interpolate",
63  (ndarray::Array<double, 1> (Interpolate::*)(ndarray::Array<double const, 1> const &) const) &
64  Interpolate::interpolate);
65 
66  mod.def("makeInterpolate",
69  "x"_a, "y"_a, "style"_a = Interpolate::AKIMA_SPLINE);
70  mod.def("makeInterpolate", (std::shared_ptr<Interpolate>(*)(ndarray::Array<double const, 1> const &,
71  ndarray::Array<double const, 1> const &y,
73  "x"_a, "y"_a, "style"_a = Interpolate::AKIMA_SPLINE);
74 
75  mod.def("stringToInterpStyle", stringToInterpStyle, "style"_a);
76  mod.def("lookupMaxInterpStyle", lookupMaxInterpStyle, "n"_a);
77  mod.def("lookupMinInterpPoints", lookupMinInterpPoints, "style"_a);
78 }
y
int y
Definition: SpanSet.cc:49
lsst::afw::math::stringToInterpStyle
Interpolate::Style stringToInterpStyle(std::string const &style)
Conversion function to switch a string to an Interpolate::Style.
Definition: Interpolate.cc:257
lsst::afw::math::makeInterpolate
std::shared_ptr< Interpolate > makeInterpolate(std::vector< double > const &x, std::vector< double > const &y, Interpolate::Style const style=Interpolate::AKIMA_SPLINE)
A factory function to make Interpolate objects.
Definition: Interpolate.cc:343
std::shared_ptr
STL class.
std::vector< double >
lsst::afw::math::Interpolate::Style
Style
Definition: Interpolate.h:38
x
double x
Definition: ChebyshevBoundedField.cc:277
lsst::afw::math::lookupMinInterpPoints
int lookupMinInterpPoints(Interpolate::Style const style)
Get the minimum number of points needed to use the requested interpolation style.
Definition: Interpolate.cc:314
lsst::afw::math::lookupMaxInterpStyle
Interpolate::Style lookupMaxInterpStyle(int const n)
Get the highest order Interpolation::Style available for 'n' points.
Definition: Interpolate.cc:275
lsst::afw::math::Interpolate
Definition: Interpolate.h:36
lsst::afw::math::Interpolate::interpolate
virtual double interpolate(double const x) const =0