LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
Kernel.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008-2016 AURA/LSST.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 #ifndef LSST_AFW_MATH_KERNEL_H
26 #define LSST_AFW_MATH_KERNEL_H
27 /*
28  * Declare the Kernel class and subclasses.
29  */
30 #include <memory>
31 #include <type_traits>
32 #include <utility>
33 #include <vector>
34 
35 #include "boost/mpl/or.hpp"
36 
37 #include "lsst/daf/base/Citizen.h"
38 #include "lsst/geom.h"
39 #include "lsst/afw/image/Image.h"
40 #include "lsst/afw/image/Utils.h"
41 #include "lsst/afw/math/Function.h"
42 #include "lsst/afw/math/traits.h"
43 
45 
46 namespace lsst {
47 namespace afw {
48 
49 namespace math {
50 
113  public afw::table::io::PersistableFacade<Kernel>,
115 public:
116  typedef double Pixel;
120 
121  // Traits values for this class of Kernel
123 
129  explicit Kernel();
130 
144  explicit Kernel(int width, int height, unsigned int nKernelParams,
145  SpatialFunction const &spatialFunction = NullSpatialFunction());
146 
158  explicit Kernel(int width, int height, const std::vector<SpatialFunctionPtr> spatialFunctionList);
159 
160  // prevent copying and assignment (to avoid problems from type slicing)
161  Kernel(const Kernel &) = delete;
162  Kernel(Kernel &&) = delete;
163  Kernel &operator=(const Kernel &) = delete;
164  Kernel &operator=(Kernel &&) = delete;
165 
166  ~Kernel() override = default;
167 
179  virtual std::shared_ptr<Kernel> clone() const = 0;
180 
191  virtual std::shared_ptr<Kernel> resized(int width, int height) const = 0;
192 
210  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
211  double y = 0.0) const;
212 
216  lsst::geom::Extent2I const getDimensions() const { return lsst::geom::Extent2I(_width, _height); }
217 
219  _width = dims.getX();
220  _height = dims.getY();
221  }
222  inline void setWidth(int width) { _width = width; }
223  inline void setHeight(int height) { _height = height; }
224 
228  inline int getWidth() const { return _width; }
229 
233  inline int getHeight() const { return _height; }
234 
238  inline lsst::geom::Point2I getCtr() const { return lsst::geom::Point2I(_ctrX, _ctrY); }
239 
245  inline int getCtrX() const { return _ctrX; }
246 
252  inline int getCtrY() const { return _ctrY; }
253 
257  inline lsst::geom::Box2I getBBox() const {
258  return lsst::geom::Box2I(lsst::geom::Point2I(-_ctrX, -_ctrY), lsst::geom::Extent2I(_width, _height));
259  }
260 
264  inline unsigned int getNKernelParameters() const { return _nKernelParams; }
265 
269  inline int getNSpatialParameters() const {
270  return this->isSpatiallyVarying() ? _spatialFunctionList[0]->getNParameters() : 0;
271  }
272 
283  SpatialFunctionPtr getSpatialFunction(unsigned int index) const;
284 
292 
295  virtual double getKernelParameter(unsigned int i) const { return getKernelParameters()[i]; }
296 
305 
314 
326 
330  inline void setCtr(lsst::geom::Point2I ctr) {
331  _ctrX = ctr.getX();
332  _ctrY = ctr.getY();
333  _setKernelXY();
334  }
335 
341  inline void setCtrX(int ctrX) {
342  _ctrX = ctrX;
343  _setKernelXY();
344  }
345 
351  inline void setCtrY(int ctrY) {
352  _ctrY = ctrY;
353  _setKernelXY();
354  }
355 
360  std::vector<std::vector<double>> spatialParams;
362  for (; spFuncIter != _spatialFunctionList.end(); ++spFuncIter) {
363  spatialParams.push_back((*spFuncIter)->getParameters());
364  }
365  return spatialParams;
366  }
367 
371  inline bool isSpatiallyVarying() const { return _spatialFunctionList.size() != 0; }
372 
379  inline void setKernelParameters(std::vector<double> const &params) {
380  if (this->isSpatiallyVarying()) {
381  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Kernel is spatially varying");
382  }
383  const unsigned int nParams = this->getNKernelParameters();
384  if (nParams != params.size()) {
386  (boost::format("Number of parameters is wrong, saw %d expected %d") % nParams %
387  params.size())
388  .str());
389  }
390  for (unsigned int ii = 0; ii < nParams; ++ii) {
391  this->setKernelParameter(ii, params[ii]);
392  }
393  }
394 
401  inline void setKernelParameters(std::pair<double, double> const &params) {
402  this->setKernelParameter(0, params.first);
403  this->setKernelParameter(1, params.second);
404  }
405 
415 
422  void computeKernelParametersFromSpatialModel(std::vector<double> &kernelParams, double x, double y) const;
423 
427  virtual std::string toString(std::string const &prefix = "") const;
428 
435  virtual void computeCache(int const
436  ) {}
437 
441  virtual int getCacheSize() const { return 0; };
442 
443 #if 0 // fails to compile with icc; is it actually used?
444  virtual void toFile(std::string fileName) const;
445 #endif
446 
447  struct PersistenceHelper;
448 
449 protected:
450  std::string getPythonModule() const override;
451 
462  virtual void setKernelParameter(unsigned int ind, double value) const;
463 
472  void setKernelParametersFromSpatialModel(double x, double y) const;
473 
485  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const = 0;
486 
488 
489 private:
490  int _width;
491  int _height;
492  int _ctrX;
493  int _ctrY;
494  unsigned int _nKernelParams;
495 
496  // Set the Kernel's ideas about the x- and y- coordinates
497  virtual void _setKernelXY() {}
498 };
499 
501 
509 class FixedKernel : public afw::table::io::PersistableFacade<FixedKernel>, public Kernel {
510 public:
514  explicit FixedKernel();
515 
520  );
521 
525  explicit FixedKernel(lsst::afw::math::Kernel const &kernel,
526  lsst::geom::Point2D const &pos
527  );
528 
529  FixedKernel(const FixedKernel &) = delete;
530  FixedKernel(FixedKernel &&) = delete;
531  FixedKernel &operator=(const FixedKernel &) = delete;
532  FixedKernel &operator=(FixedKernel &&) = delete;
533 
534  ~FixedKernel() override = default;
535 
536  std::shared_ptr<Kernel> clone() const override;
537 
538  std::shared_ptr<Kernel> resized(int width, int height) const override;
539 
540  std::string toString(std::string const &prefix = "") const override;
541 
542  virtual Pixel getSum() const { return _sum; }
543 
544  bool isPersistable() const noexcept override { return true; }
545 
546  class Factory;
547 
548 protected:
549  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
550 
551  std::string getPersistenceName() const override;
552 
553  void write(OutputArchiveHandle &handle) const override;
554 
555 private:
557  Pixel _sum;
558 };
559 
573 class AnalyticKernel : public afw::table::io::PersistableFacade<AnalyticKernel>, public Kernel {
574 public:
577 
581  explicit AnalyticKernel();
582 
595  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
596  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
597 
611  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
612  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
613 
614  AnalyticKernel(const AnalyticKernel &) = delete;
615  AnalyticKernel(AnalyticKernel &&) = delete;
616  AnalyticKernel &operator=(const AnalyticKernel &) = delete;
618 
619  ~AnalyticKernel() override = default;
620 
621  std::shared_ptr<Kernel> clone() const override;
622 
623  std::shared_ptr<Kernel> resized(int width, int height) const override;
624 
645  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
646  double y = 0.0) const;
647 
648  std::vector<double> getKernelParameters() const override;
649 
653  virtual KernelFunctionPtr getKernelFunction() const;
654 
655  std::string toString(std::string const &prefix = "") const override;
656 
657  bool isPersistable() const noexcept override { return true; }
658 
659  class Factory;
660 
661 protected:
662  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
663 
664  std::string getPersistenceName() const override;
665 
666  void write(OutputArchiveHandle &handle) const override;
667 
668 protected:
669  void setKernelParameter(unsigned int ind, double value) const override;
670 
671  KernelFunctionPtr _kernelFunctionPtr;
672 };
673 
681 class DeltaFunctionKernel : public afw::table::io::PersistableFacade<DeltaFunctionKernel>, public Kernel {
682 public:
683  // Traits values for this class of Kernel
685 
695  explicit DeltaFunctionKernel(int width, int height, lsst::geom::Point2I const &point);
696 
697  DeltaFunctionKernel(const DeltaFunctionKernel &) = delete;
701 
702  ~DeltaFunctionKernel() override = default;
703 
704  std::shared_ptr<Kernel> clone() const override;
705 
706  std::shared_ptr<Kernel> resized(int width, int height) const override;
707 
708  lsst::geom::Point2I getPixel() const { return _pixel; }
709 
710  std::string toString(std::string const &prefix = "") const override;
711 
712  bool isPersistable() const noexcept override { return true; }
713 
714  class Factory;
715 
716 protected:
717  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
718 
719  std::string getPersistenceName() const override;
720 
721  void write(OutputArchiveHandle &handle) const override;
722 
723 private:
724  lsst::geom::Point2I _pixel;
725 };
726 
741 class LinearCombinationKernel : public afw::table::io::PersistableFacade<LinearCombinationKernel>,
742  public Kernel {
743 public:
747  explicit LinearCombinationKernel();
748 
755  explicit LinearCombinationKernel(KernelList const &kernelList,
756  std::vector<double> const &kernelParameters);
757 
765  explicit LinearCombinationKernel(KernelList const &kernelList,
766  Kernel::SpatialFunction const &spatialFunction);
767 
777  explicit LinearCombinationKernel(KernelList const &kernelList,
778  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
779 
784 
785  ~LinearCombinationKernel() override = default;
786 
787  std::shared_ptr<Kernel> clone() const override;
788 
789  std::shared_ptr<Kernel> resized(int width, int height) const override;
790 
791  std::vector<double> getKernelParameters() const override;
792 
796  virtual KernelList const &getKernelList() const;
797 
801  std::vector<double> getKernelSumList() const;
802 
806  int getNBasisKernels() const { return static_cast<int>(_kernelList.size()); };
807 
813  void checkKernelList(const KernelList &kernelList) const;
814 
818  bool isDeltaFunctionBasis() const { return _isDeltaFunctionBasis; };
819 
854  std::shared_ptr<Kernel> refactor() const;
855 
856  std::string toString(std::string const &prefix = "") const override;
857 
858  bool isPersistable() const noexcept override { return true; }
859 
860  class Factory;
861 
862 protected:
863  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
864 
865  std::string getPersistenceName() const override;
866 
867  void write(OutputArchiveHandle &handle) const override;
868 
869  void setKernelParameter(unsigned int ind, double value) const override;
870 
871 private:
875  void _setKernelList(KernelList const &kernelList);
876 
877  KernelList _kernelList;
880  std::vector<double> _kernelSumList;
881  mutable std::vector<double> _kernelParams;
882  bool _isDeltaFunctionBasis;
883 };
884 
898 class SeparableKernel : public afw::table::io::PersistableFacade<SeparableKernel>, public Kernel {
899 public:
902 
906  explicit SeparableKernel();
907 
920  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
921  KernelFunction const &kernelRowFunction,
922  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
923 
937  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
938  KernelFunction const &kernelRowFunction,
939  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
940 
941  SeparableKernel(const SeparableKernel &) = delete;
942  SeparableKernel(SeparableKernel &&) = delete;
943  SeparableKernel &operator=(const SeparableKernel &) = delete;
945 
946  ~SeparableKernel() override = default;
947 
948  std::shared_ptr<Kernel> clone() const override;
949 
950  std::shared_ptr<Kernel> resized(int width, int height) const override;
951 
968  double computeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList, bool doNormalize,
969  double x = 0.0, double y = 0.0) const;
970 
971  double getKernelParameter(unsigned int i) const override {
972  unsigned int const ncol = _kernelColFunctionPtr->getNParameters();
973  if (i < ncol) {
974  return _kernelColFunctionPtr->getParameter(i);
975  } else {
976  i -= ncol;
977  return _kernelRowFunctionPtr->getParameter(i);
978  }
979  }
980  std::vector<double> getKernelParameters() const override;
981 
985  KernelFunctionPtr getKernelColFunction() const;
986 
990  KernelFunctionPtr getKernelRowFunction() const;
991 
992  std::string toString(std::string const &prefix = "") const override;
993 
994  /***
995  * Compute a cache of values for the x and y kernel functions
996  *
997  * A value of 0 disables the cache for maximum accuracy.
998  * 10,000 typically results in a warping error of a fraction of a count.
999  * 100,000 typically results in a warping error of less than 0.01 count.
1000  *
1001  * @param cacheSize cache size (number of double precision array elements in the x and y caches)
1002  */
1003  void computeCache(int const cacheSize) override;
1004 
1008  int getCacheSize() const override;
1009 
1010 protected:
1011  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
1012 
1013  void setKernelParameter(unsigned int ind, double value) const override;
1014 
1015 private:
1029  double basicComputeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList,
1030  bool doNormalize) const;
1031 
1032  KernelFunctionPtr _kernelColFunctionPtr;
1033  KernelFunctionPtr _kernelRowFunctionPtr;
1034  mutable std::vector<Pixel> _localColList; // used by doComputeImage
1035  mutable std::vector<Pixel> _localRowList;
1036  mutable std::vector<double> _kernelX; // used by SeparableKernel::basicComputeVectors
1037  mutable std::vector<double> _kernelY;
1038  //
1039  // Cached values of the row- and column- kernels
1040  //
1041  mutable std::vector<std::vector<double>> _kernelRowCache;
1042  mutable std::vector<std::vector<double>> _kernelColCache;
1043 
1044  virtual void _setKernelXY() override {
1045  lsst::geom::Extent2I const dim = getDimensions();
1046  lsst::geom::Point2I const ctr = getCtr();
1047 
1048  assert(dim[0] == static_cast<int>(_kernelX.size()));
1049  for (int i = 0; i != dim.getX(); ++i) {
1050  _kernelX[i] = i - ctr.getX();
1051  }
1052 
1053  assert(dim[1] == static_cast<int>(_kernelY.size()));
1054  for (int i = 0; i != dim.getY(); ++i) {
1055  _kernelY[i] = i - ctr.getY();
1056  }
1057  }
1058 };
1059 } // namespace math
1060 } // namespace afw
1061 } // namespace lsst
1062 
1063 #endif // !defined(LSST_AFW_MATH_KERNEL_H)
virtual int getCacheSize() const
Get the current size of the kernel cache (0 if none or if caches not supported)
Definition: Kernel.h:441
int getHeight() const
Return the Kernel&#39;s height.
Definition: Kernel.h:233
int getCtrX() const
Return x index of kernel&#39;s center.
Definition: Kernel.h:245
int getCtrY() const
Return y index of kernel&#39;s center.
Definition: Kernel.h:252
std::shared_ptr< KernelFunction > KernelFunctionPtr
Definition: Kernel.h:901
afw::table::Key< int > cacheSize
Definition: CoaddPsf.cc:339
virtual Pixel getSum() const
Definition: Kernel.h:542
virtual void computeCache(int const)
Compute a cache of Kernel values, if desired.
Definition: Kernel.h:435
void setWidth(int width)
Definition: Kernel.h:222
An object passed to Persistable::write to allow it to persist itself.
virtual void setKernelParameter(unsigned int ind, double value) const
Set one kernel parameter.
Definition: Kernel.cc:233
lsst::afw::math::Function1< Pixel > KernelFunction
Definition: Kernel.h:900
virtual double getKernelParameter(unsigned int i) const
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:295
void setKernelParameters(std::vector< double > const &params)
Set the kernel parameters of a spatially invariant kernel.
Definition: Kernel.h:379
Kernel & operator=(const Kernel &)=delete
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Definition: Kernel.h:898
int y
Definition: SpanSet.cc:49
std::shared_ptr< lsst::afw::math::Function2< double > > SpatialFunctionPtr
Definition: Kernel.h:117
double getKernelParameter(unsigned int i) const override
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:971
void setHeight(int height)
Definition: Kernel.h:223
bool isDeltaFunctionBasis() const
Return true if all basis kernels are instances of DeltaFunctionKernel.
Definition: Kernel.h:818
lsst::afw::math::NullFunction2< double > NullSpatialFunction
Definition: Kernel.h:119
std::string prefix
Definition: SchemaMapper.cc:79
std::string getPythonModule() const override
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
Definition: Kernel.cc:244
lsst::afw::math::Function2< double > SpatialFunction
Definition: Kernel.h:118
A Function taking two arguments.
Definition: Function.h:261
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:544
int getNBasisKernels() const
Get the number of basis kernels.
Definition: Kernel.h:806
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
Definition: Persistable.cc:38
STL class.
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:712
a class used in function calls to indicate that no Function2 is being provided
Definition: Function.h:458
T push_back(T... args)
bool isSpatiallyVarying() const
Return true iff the kernel is spatially varying (has a spatial function)
Definition: Kernel.h:371
void setCtrY(int ctrY)
Set y index of kernel&#39;s center.
Definition: Kernel.h:351
KernelFunctionPtr _kernelFunctionPtr
Definition: Kernel.h:671
A base class for image defects.
std::vector< SpatialFunctionPtr > getSpatialFunctionList() const
Return a list of clones of the spatial functions.
Definition: Kernel.cc:175
lsst::geom::Box2I getBBox() const
return parent bounding box, with XY0 = -center
Definition: Kernel.h:257
lsst::geom::Box2I growBBox(lsst::geom::Box2I const &bbox) const
Given a bounding box for pixels one wishes to compute by convolving an image with this kernel...
Definition: Kernel.cc:186
void setCtrX(int ctrX)
Set x index of kernel&#39;s center.
Definition: Kernel.h:341
void computeKernelParametersFromSpatialModel(std::vector< double > &kernelParams, double x, double y) const
Compute the kernel parameters at a specified point.
Definition: Kernel.cc:153
A kernel that is a linear combination of fixed basis kernels.
Definition: Kernel.h:741
void setKernelParameters(std::pair< double, double > const &params)
Set the kernel parameters of a 2-component spatially invariant kernel.
Definition: Kernel.h:401
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
virtual std::shared_ptr< Kernel > resized(int width, int height) const =0
Return a pointer to a clone with specified kernel dimensions.
A Function taking one argument.
Definition: Function.h:204
lsst::geom::Point2I getCtr() const
Return index of kernel&#39;s center.
Definition: Kernel.h:238
SpatialFunctionPtr getSpatialFunction(unsigned int index) const
Return a clone of the specified spatial function (one component of the spatial model) ...
Definition: Kernel.cc:162
double computeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize, double x=0.0, double y=0.0) const
Compute an image (pixellized representation of the kernel) in place.
Definition: Kernel.cc:93
void setDimensions(lsst::geom::Extent2I dims)
Definition: Kernel.h:218
void setCtr(lsst::geom::Point2I ctr)
Set index of kernel&#39;s center.
Definition: Kernel.h:330
table::Box2IKey bbox
Definition: Detector.cc:169
virtual std::vector< double > getKernelParameters() const
Return the current kernel parameters.
Definition: Kernel.cc:184
Point< int, 2 > Point2I
Definition: Point.h:321
generic_kernel_tag kernel_fill_factor
Definition: Kernel.h:122
double x
void setKernelParametersFromSpatialModel(double x, double y) const
Set the kernel parameters from the spatial model (if any).
Definition: Kernel.cc:237
int getWidth() const
Return the Kernel&#39;s width.
Definition: Kernel.h:228
lsst::geom::Extent2I const getDimensions() const
Return the Kernel&#39;s dimensions (width, height)
Definition: Kernel.h:216
unsigned int getNKernelParameters() const
Return the number of kernel parameters (0 if none)
Definition: Kernel.h:264
void setSpatialParameters(const std::vector< std::vector< double >> params)
Set the parameters of all spatial functions.
Definition: Kernel.cc:128
T size(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
Extent< int, 2 > Extent2I
Definition: Extent.h:397
STL class.
Kernel has only one non-zero pixel.
Definition: traits.h:56
table::Key< int > kernelFunction
lsst::geom::Box2I shrinkBBox(lsst::geom::Box2I const &bbox) const
Given a bounding box for an image one wishes to convolve with this kernel, return the bounding box fo...
Definition: Kernel.cc:192
std::vector< std::shared_ptr< Kernel > > KernelList
Definition: Kernel.h:500
std::vector< SpatialFunctionPtr > _spatialFunctionList
Definition: Kernel.h:487
lsst::afw::math::Function2< Pixel > KernelFunction
Definition: Kernel.h:575
Kernel()
Construct a null Kernel of size 0,0.
Definition: Kernel.cc:58
virtual double doComputeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize) const =0
Low-level version of computeImage.
int getNSpatialParameters() const
Return the number of spatial parameters (0 if not spatially varying)
Definition: Kernel.h:269
Reports invalid arguments.
Definition: Runtime.h:66
std::vector< std::vector< double > > getSpatialParameters() const
Return the spatial parameters parameters (an empty vector if not spatially varying) ...
Definition: Kernel.h:359
~Kernel() override=default
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
Definition: Persistable.cc:34
lsst::geom::Point2I getPixel() const
Definition: Kernel.h:708
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:858
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:657
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:55
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
deltafunction_kernel_tag kernel_fill_factor
Definition: Kernel.h:684
A kernel described by a function.
Definition: Kernel.h:573
std::shared_ptr< lsst::afw::math::Function2< Pixel > > KernelFunctionPtr
Definition: Kernel.h:576
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:176
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition: Kernel.h:112
An integer coordinate rectangle.
Definition: Box.h:54
A kernel that has only one non-zero pixel (of value 1)
Definition: Kernel.h:681
virtual std::shared_ptr< Kernel > clone() const =0
Return a pointer to a deep copy of this kernel.
virtual std::string toString(std::string const &prefix="") const
Return a string representation of the kernel.
Definition: Kernel.cc:204
Tags carrying information about Kernels Kernel with no special properties.
Definition: traits.h:53
A kernel created from an Image.
Definition: Kernel.h:509
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104