LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
ShapeletKernel.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_MEAS_ALGORITHMS_SHAPELETKERNEL_H
3 #define LSST_MEAS_ALGORITHMS_SHAPELETKERNEL_H
4 
5 /*
6  * LSST Data Management System
7  * Copyright 2008, 2009, 2010 LSST Corporation.
8  *
9  * This product includes software developed by the
10  * LSST Project (http://www.lsst.org/).
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the LSST License Statement and
23  * the GNU General Public License along with this program. If not,
24  * see <http://www.lsstcorp.org/LegalNotices/>.
25  */
26 
39 #include "boost/shared_ptr.hpp"
40 
41 #include "lsst/afw/math/Kernel.h"
42 #include "lsst/afw/image/Image.h"
43 #include "lsst/afw/image/Wcs.h"
44 #include "lsst/afw/geom/Point.h"
47 
48 namespace lsst {
49 namespace meas {
50 namespace algorithms {
51 
53  {
54  /* @brief LocalShapeletKernel has no spatial variation
55  *
56  * LocalShapeletKernel is appropriate for a small patch of an image
57  * where the variation is expected to be minimal (e.g. over the size
58  * of a galaxy).
59  *
60  * It uses a shapelet description of the PSF for its underlying
61  * implementation. As such, the functional form is an analytic
62  * function f(x,y) = Sum_pq b_pq psi_pq(x,y,sigma).
63  * (See the Shapelet class for more details.)
64  *
65  * The method computeImage is the best way to use this class.
66  *
67  * The Kernel classes allows for individual pixels to be
68  * calculated one at a time, so we are forced to implement
69  * this as well, but it is much less efficient than calculating
70  * the whole image at once.
71  *
72  * There is a suggestion that we also include a method to
73  * calculate the Fourier transform directly. This would likely
74  * be more efficient than going through the normal image
75  * via an FFT, since shapelets are their own Fourier transforms
76  * (modulo factors of i).
77  * One concern about this, which needs to be considered more
78  * carefully, is the effect of the telescope distortion (the Wcs).
79  * The shapelets are defined in sky coordinates. However, the
80  * appropriate image is in chip coordinates. So there is a
81  * local distortion that is applied. This means that the
82  * direct Fourier transform is not quite as simple as I had
83  * initially thought. However, I do suspect that this detail
84  * can be correctly calculated analytically and the method
85  * could be written that is significantly more efficient than
86  * the FFT.
87  */
88 
89  public :
90  typedef boost::shared_ptr<LocalShapeletKernel> Ptr;
91  typedef boost::shared_ptr<const LocalShapeletKernel> ConstPtr;
92 
98 
116  Shapelet::ConstPtr shapelet,
117  const Wcs::ConstPtr& wcsPtr,
118  const Extent& size
119  );
120 
122  Shapelet::ConstPtr shapelet,
123  const Wcs::ConstPtr& wcsPtr
124  );
125 
135  double computeImage(
136  Image& image,
137  bool doNormalize,
138  double x = 0.0,
139  double y = 0.0
140  ) const;
141 
142  private :
143 
146  };
147 
148 
150  {
151  /* @brief ShapeletKernel includes spatial variation
152  *
153  * A ShapeletKernel is basically a function that can return
154  * a LocalShapeletKernel for any location on an Image.
155  * This is the most efficient way to use this class.
156  * Namely to get the LocalShapeletKernel appropriate for a
157  * particular galaxy, and then convolve with that over a
158  * small patch around the galaxy.
159  *
160  * Convolving a larger image is probably not efficient the
161  * way that AnalyticKernel seems to be implemented. AnalyticKernel
162  * defines a number of functions that seem to be used for
163  * convolution, like determining the parameters of the
164  * analytic function separately. The interpolation is faster
165  * to calculate the full local function as a complete vector
166  * rather than one component at a time.
167  */
168  public :
169  typedef boost::shared_ptr<ShapeletKernel> Ptr;
170  typedef boost::shared_ptr<const ShapeletKernel> ConstPtr;
171 
177 
196  const Wcs::ConstPtr& wcsPtr,
197  const Extent& size
198  );
201  const Wcs::ConstPtr& wcsPtr
202  );
203 
210  const Point& pos
211  ) const;
212 
222  double computeImage(
223  Image& image,
224  bool doNormalize,
225  double x = 0.0,
226  double y = 0.0
227  ) const;
228 
229  private :
230 
233  };
234 
235 }}}
236 
237 
238 #endif
int y
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.
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.
Declare the Kernel class and subclasses.
A coordinate class intended to represent absolute positions.
lsst::afw::math::AnalyticKernel base
boost::shared_ptr< LocalShapeletKernel > Ptr
ShapeletInterpolation::ConstPtr _interp
boost::shared_ptr< Wcs > Ptr
Definition: Wcs.h:113
boost::shared_ptr< const LocalShapeletKernel > ConstPtr
lsst::afw::image::Image< double > Image
Defines the Shapelet class.
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:107
boost::shared_ptr< const Shapelet > ConstPtr
Definition: Shapelet.h:95
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
boost::shared_ptr< Wcs const > ConstPtr
Definition: Wcs.h:114
Defines the ShapeletInterpolation class.
Support for 2-D images.
lsst::afw::geom::Extent2I Extent
lsst::afw::math::AnalyticKernel base
int x
boost::shared_ptr< const ShapeletInterpolation > ConstPtr
lsst::afw::image::Image< double > Image
LocalShapeletKernel::ConstPtr getLocalKernel(const Point &pos) const
Get the LocalShapeletKernel at a given point.
ShapeletKernel(ShapeletInterpolation::ConstPtr interp, const Wcs::ConstPtr &wcsPtr, const Extent &size)
Constructor from a ShapeletInterpolation.
boost::shared_ptr< const ShapeletKernel > ConstPtr
A kernel described by a function.
Definition: Kernel.h:628
A class to represent a 2-dimensional array of pixels.
Definition: PSF.h:43
boost::shared_ptr< ShapeletKernel > Ptr