33 namespace algorithms {
41 typedef boost::shared_ptr<ShapeletKernelFunction>
Ptr;
42 typedef boost::shared_ptr<const ShapeletKernelFunction>
ConstPtr;
45 base(shapelet->size()+1),
46 _order(shapelet->getOrder()),
_size(shapelet->size())
49 std::vector<double> v(
_size+1);
50 for(
int i=0;i<
_size;++i) v[i] = vals(i);
51 v[
_size] = shapelet->getSigma();
66 for(
int i=0;i<
_size;++i) vals(i) = v[i];
83 typedef boost::shared_ptr<ShapeletSpatialFunction>
Ptr;
84 typedef boost::shared_ptr<const ShapeletSpatialFunction>
ConstPtr;
96 {
return _interp->interpolateSingleElement(x,y,
_i); }
105 template <
class ShapeletPtr>
107 {
return size == 0 ? int(
ceil(shapelet->getSigma()*10.)) : size; }
114 _shapelet(shapelet), _wcsPtr(wcsPtr->clone())
122 _shapelet(shapelet), _wcsPtr(wcsPtr->clone())
126 Image&
image,
bool doNormalize,
double ,
double )
const
138 const int nPixels = nX * nY;
142 for(
int i=0;i<nX;++i) {
143 for(
int j=0;j<nY;++j) {
144 std::complex<double> z(i-xCen,j-yCen);
154 double sum = flux.TMV_sumElements();
155 if (doNormalize) flux /=
sum;
158 for(
int i=0;i<nX;++i) {
159 for(
int j=0;j<nY;++j) {
160 image(i,j) = flux(k++);
170 const int nParam = interp->getFitSize();
172 std::vector<SFPtr> ret;
174 for(
int i=0;i<nParam;++i) {
188 _interp(interp), _wcsPtr(wcsPtr->clone())
198 _interp(interp), _wcsPtr(wcsPtr->clone())
202 const Point& pos)
const
207 return localShapeletKernel;
211 Image&
image,
bool doNormalize,
double x,
double y)
const
Eigen::VectorXcd CDVector
double computeImage(Image &image, bool doNormalize, double x=0.0, double y=0.0) const
Make an image of the kernel at a specified location.
boost::shared_ptr< lsst::afw::math::Function2< double > > SpatialFunctionPtr
std::vector< lsst::afw::math::Kernel::SpatialFunctionPtr > buildSetOfSpatialFunctions(ShapeletInterpolation::ConstPtr interp)
double computeImage(Image &image, bool doNormalize, double x=0.0, double y=0.0) const
Make an image of the kernel.
LocalShapeletKernel(Shapelet::ConstPtr shapelet, const Wcs::ConstPtr &wcsPtr, const Extent &size)
Constructor from a Shapelet.
boost::shared_ptr< ShapeletSpatialFunction > Ptr
base::Ptr clone() const
Return a pointer to a deep copy of this function.
lsst::afw::math::Function2< double > base
ShapeletInterpolation::ConstPtr _interp
boost::shared_ptr< const LocalShapeletKernel > ConstPtr
int getCtrY() const
Return y index of kernel's center.
ShapeletKernelFunction(Shapelet::ConstPtr shapelet)
double evaluateAt(const PointD &pos)
Evaluate f(x,y)
std::vector< double > const & getParameters() const
Return all function parameters.
int getCtrX() const
Return x index of kernel's center.
const ShapeletInterpolation::ConstPtr _interp
Extent< int, N > ceil(Extent< double, N > const &input)
A Function taking two arguments.
boost::shared_ptr< const Shapelet > ConstPtr
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
int getImageSize(ShapeletPtr shapelet, int size)
int getHeight() const
Return the Kernel's height.
afw::table::Key< double > sigma
table::Key< table::Array< Kernel::Pixel > > image
int getWidth() const
Return the Kernel's width.
void makePsi(DMatrix &psi, CDVectorView z, int order, const DVector *coeff=0)
boost::shared_ptr< Wcs const > ConstPtr
boost::shared_ptr< const ShapeletKernelFunction > ConstPtr
Shapelet::ConstPtr _shapelet
boost::shared_ptr< Function2< double > > Ptr
double operator()(double x, double y) const
boost::shared_ptr< ShapeletKernelFunction > Ptr
boost::shared_ptr< const ShapeletSpatialFunction > ConstPtr
ShapeletSpatialFunction(ShapeletInterpolation::ConstPtr interp, int i)
ShapeletKernelFunction(int order, int size)
base::Ptr clone() const
Return a pointer to a deep copy of this function.
boost::shared_ptr< const ShapeletInterpolation > ConstPtr
void setParameters(std::vector< double > const ¶ms)
Set all function parameters.
LocalShapeletKernel::ConstPtr getLocalKernel(const Point &pos) const
Get the LocalShapeletKernel at a given point.
lsst::afw::math::Function2< double > base
Define the basic Function classes.
Eigen::VectorXd ShapeletVector
ShapeletKernel(ShapeletInterpolation::ConstPtr interp, const Wcs::ConstPtr &wcsPtr, const Extent &size)
Constructor from a ShapeletInterpolation.
double operator()(double x, double y) const
A kernel described by a function.
A class to represent a 2-dimensional array of pixels.
Defines LocalShapeletKernel and ShapeletKernel.