LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
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/geom.h"
38 #include "lsst/afw/image/Image.h"
39 #include "lsst/afw/image/Utils.h"
40 #include "lsst/afw/math/Function.h"
41 #include "lsst/afw/math/traits.h"
42 
44 
45 namespace lsst {
46 namespace afw {
47 
48 namespace math {
49 
112 public:
113  typedef double Pixel;
117 
118  // Traits values for this class of Kernel
120 
126  explicit Kernel();
127 
141  explicit Kernel(int width, int height, unsigned int nKernelParams,
142  SpatialFunction const &spatialFunction = NullSpatialFunction());
143 
155  explicit Kernel(int width, int height, const std::vector<SpatialFunctionPtr> spatialFunctionList);
156 
157  // prevent copying and assignment (to avoid problems from type slicing)
158  Kernel(const Kernel &) = delete;
159  Kernel(Kernel &&) = delete;
160  Kernel &operator=(const Kernel &) = delete;
161  Kernel &operator=(Kernel &&) = delete;
162 
163  ~Kernel() override = default;
164 
176  virtual std::shared_ptr<Kernel> clone() const = 0;
177 
188  virtual std::shared_ptr<Kernel> resized(int width, int height) const = 0;
189 
207  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
208  double y = 0.0) const;
209 
213  lsst::geom::Extent2I const getDimensions() const { return lsst::geom::Extent2I(_width, _height); }
214 
216  _width = dims.getX();
217  _height = dims.getY();
218  }
219  inline void setWidth(int width) { _width = width; }
220  inline void setHeight(int height) { _height = height; }
221 
225  inline int getWidth() const { return _width; }
226 
230  inline int getHeight() const { return _height; }
231 
235  inline lsst::geom::Point2I getCtr() const { return lsst::geom::Point2I(_ctrX, _ctrY); }
236 
242  [[deprecated("Use `getCtr` instead. To be removed after 20.0.0.")]] // DM-22276
243  inline int
244  getCtrX() const {
245  return _ctrX;
246  }
247 
253  [[deprecated("Use `getCtr` instead. To be removed after 20.0.0.")]] // DM-22276
254  inline int
255  getCtrY() const {
256  return _ctrY;
257  }
258 
262  inline lsst::geom::Box2I getBBox() const {
263  return lsst::geom::Box2I(lsst::geom::Point2I(-_ctrX, -_ctrY), lsst::geom::Extent2I(_width, _height));
264  }
265 
269  inline unsigned int getNKernelParameters() const { return _nKernelParams; }
270 
274  inline int getNSpatialParameters() const {
275  return this->isSpatiallyVarying() ? _spatialFunctionList[0]->getNParameters() : 0;
276  }
277 
288  SpatialFunctionPtr getSpatialFunction(unsigned int index) const;
289 
297 
300  virtual double getKernelParameter(unsigned int i) const { return getKernelParameters()[i]; }
301 
310 
319 
331 
335  inline void setCtr(lsst::geom::Point2I ctr) {
336  _ctrX = ctr.getX();
337  _ctrY = ctr.getY();
338  _setKernelXY();
339  }
340 
346  [[deprecated("Use `setCtr` instead. To be removed after 20.0.0.")]] // DM-22276
347  inline void
348  setCtrX(int ctrX) {
349  _ctrX = ctrX;
350  _setKernelXY();
351  }
352 
358  [[deprecated("Use `setCtr` instead. To be removed after 20.0.0.")]] // DM-22276
359  inline void
360  setCtrY(int ctrY) {
361  _ctrY = ctrY;
362  _setKernelXY();
363  }
364 
369  std::vector<std::vector<double>> spatialParams;
371  for (; spFuncIter != _spatialFunctionList.end(); ++spFuncIter) {
372  spatialParams.push_back((*spFuncIter)->getParameters());
373  }
374  return spatialParams;
375  }
376 
380  inline bool isSpatiallyVarying() const { return _spatialFunctionList.size() != 0; }
381 
388  inline void setKernelParameters(std::vector<double> const &params) {
389  if (this->isSpatiallyVarying()) {
390  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Kernel is spatially varying");
391  }
392  const unsigned int nParams = this->getNKernelParameters();
393  if (nParams != params.size()) {
395  (boost::format("Number of parameters is wrong, saw %d expected %d") % nParams %
396  params.size())
397  .str());
398  }
399  for (unsigned int ii = 0; ii < nParams; ++ii) {
400  this->setKernelParameter(ii, params[ii]);
401  }
402  }
403 
410  inline void setKernelParameters(std::pair<double, double> const &params) {
411  this->setKernelParameter(0, params.first);
412  this->setKernelParameter(1, params.second);
413  }
414 
424 
431  void computeKernelParametersFromSpatialModel(std::vector<double> &kernelParams, double x, double y) const;
432 
436  virtual std::string toString(std::string const &prefix = "") const;
437 
444  virtual void computeCache(int const
445  ) {}
446 
450  virtual int getCacheSize() const { return 0; };
451 
452 #if 0 // fails to compile with icc; is it actually used?
453  virtual void toFile(std::string fileName) const;
454 #endif
455 
456  struct PersistenceHelper;
457 
458 protected:
459  std::string getPythonModule() const override;
460 
471  virtual void setKernelParameter(unsigned int ind, double value) const;
472 
481  void setKernelParametersFromSpatialModel(double x, double y) const;
482 
494  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const = 0;
495 
497 
498 private:
499  int _width;
500  int _height;
501  int _ctrX;
502  int _ctrY;
503  unsigned int _nKernelParams;
504 
505  // Set the Kernel's ideas about the x- and y- coordinates
506  virtual void _setKernelXY() {}
507 };
508 
510 
518 class FixedKernel : public afw::table::io::PersistableFacade<FixedKernel>, public Kernel {
519 public:
523  explicit FixedKernel();
524 
529  );
530 
534  explicit FixedKernel(lsst::afw::math::Kernel const &kernel,
535  lsst::geom::Point2D const &pos
536  );
537 
538  FixedKernel(const FixedKernel &) = delete;
539  FixedKernel(FixedKernel &&) = delete;
540  FixedKernel &operator=(const FixedKernel &) = delete;
541  FixedKernel &operator=(FixedKernel &&) = delete;
542 
543  ~FixedKernel() override = default;
544 
545  std::shared_ptr<Kernel> clone() const override;
546 
547  std::shared_ptr<Kernel> resized(int width, int height) const override;
548 
549  std::string toString(std::string const &prefix = "") const override;
550 
551  virtual Pixel getSum() const { return _sum; }
552 
553  bool isPersistable() const noexcept override { return true; }
554 
555  class Factory;
556 
557 protected:
558  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
559 
560  std::string getPersistenceName() const override;
561 
562  void write(OutputArchiveHandle &handle) const override;
563 
564 private:
566  Pixel _sum;
567 };
568 
582 class AnalyticKernel : public afw::table::io::PersistableFacade<AnalyticKernel>, public Kernel {
583 public:
586 
590  explicit AnalyticKernel();
591 
604  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
605  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
606 
620  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
621  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
622 
623  AnalyticKernel(const AnalyticKernel &) = delete;
624  AnalyticKernel(AnalyticKernel &&) = delete;
625  AnalyticKernel &operator=(const AnalyticKernel &) = delete;
627 
628  ~AnalyticKernel() override = default;
629 
630  std::shared_ptr<Kernel> clone() const override;
631 
632  std::shared_ptr<Kernel> resized(int width, int height) const override;
633 
654  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
655  double y = 0.0) const;
656 
657  std::vector<double> getKernelParameters() const override;
658 
662  virtual KernelFunctionPtr getKernelFunction() const;
663 
664  std::string toString(std::string const &prefix = "") const override;
665 
666  bool isPersistable() const noexcept override { return true; }
667 
668  class Factory;
669 
670 protected:
671  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
672 
673  std::string getPersistenceName() const override;
674 
675  void write(OutputArchiveHandle &handle) const override;
676 
677 protected:
678  void setKernelParameter(unsigned int ind, double value) const override;
679 
680  KernelFunctionPtr _kernelFunctionPtr;
681 };
682 
690 class DeltaFunctionKernel : public afw::table::io::PersistableFacade<DeltaFunctionKernel>, public Kernel {
691 public:
692  // Traits values for this class of Kernel
694 
704  explicit DeltaFunctionKernel(int width, int height, lsst::geom::Point2I const &point);
705 
706  DeltaFunctionKernel(const DeltaFunctionKernel &) = delete;
710 
711  ~DeltaFunctionKernel() override = default;
712 
713  std::shared_ptr<Kernel> clone() const override;
714 
715  std::shared_ptr<Kernel> resized(int width, int height) const override;
716 
717  lsst::geom::Point2I getPixel() const { return _pixel; }
718 
719  std::string toString(std::string const &prefix = "") const override;
720 
721  bool isPersistable() const noexcept override { return true; }
722 
723  class Factory;
724 
725 protected:
726  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
727 
728  std::string getPersistenceName() const override;
729 
730  void write(OutputArchiveHandle &handle) const override;
731 
732 private:
733  lsst::geom::Point2I _pixel;
734 };
735 
750 class LinearCombinationKernel : public afw::table::io::PersistableFacade<LinearCombinationKernel>,
751  public Kernel {
752 public:
756  explicit LinearCombinationKernel();
757 
764  explicit LinearCombinationKernel(KernelList const &kernelList,
765  std::vector<double> const &kernelParameters);
766 
774  explicit LinearCombinationKernel(KernelList const &kernelList,
775  Kernel::SpatialFunction const &spatialFunction);
776 
786  explicit LinearCombinationKernel(KernelList const &kernelList,
787  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
788 
793 
794  ~LinearCombinationKernel() override = default;
795 
796  std::shared_ptr<Kernel> clone() const override;
797 
798  std::shared_ptr<Kernel> resized(int width, int height) const override;
799 
800  std::vector<double> getKernelParameters() const override;
801 
805  virtual KernelList const &getKernelList() const;
806 
810  std::vector<double> getKernelSumList() const;
811 
815  int getNBasisKernels() const { return static_cast<int>(_kernelList.size()); };
816 
822  void checkKernelList(const KernelList &kernelList) const;
823 
827  bool isDeltaFunctionBasis() const { return _isDeltaFunctionBasis; };
828 
863  std::shared_ptr<Kernel> refactor() const;
864 
865  std::string toString(std::string const &prefix = "") const override;
866 
867  bool isPersistable() const noexcept override { return true; }
868 
869  class Factory;
870 
871 protected:
872  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
873 
874  std::string getPersistenceName() const override;
875 
876  void write(OutputArchiveHandle &handle) const override;
877 
878  void setKernelParameter(unsigned int ind, double value) const override;
879 
880 private:
884  void _setKernelList(KernelList const &kernelList);
885 
886  KernelList _kernelList;
889  std::vector<double> _kernelSumList;
890  mutable std::vector<double> _kernelParams;
891  bool _isDeltaFunctionBasis;
892 };
893 
907 class SeparableKernel : public afw::table::io::PersistableFacade<SeparableKernel>, public Kernel {
908 public:
911 
915  explicit SeparableKernel();
916 
929  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
930  KernelFunction const &kernelRowFunction,
931  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
932 
946  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
947  KernelFunction const &kernelRowFunction,
948  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
949 
950  SeparableKernel(const SeparableKernel &) = delete;
951  SeparableKernel(SeparableKernel &&) = delete;
952  SeparableKernel &operator=(const SeparableKernel &) = delete;
954 
955  ~SeparableKernel() override = default;
956 
957  std::shared_ptr<Kernel> clone() const override;
958 
959  std::shared_ptr<Kernel> resized(int width, int height) const override;
960 
977  double computeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList, bool doNormalize,
978  double x = 0.0, double y = 0.0) const;
979 
980  double getKernelParameter(unsigned int i) const override {
981  unsigned int const ncol = _kernelColFunctionPtr->getNParameters();
982  if (i < ncol) {
983  return _kernelColFunctionPtr->getParameter(i);
984  } else {
985  i -= ncol;
986  return _kernelRowFunctionPtr->getParameter(i);
987  }
988  }
989  std::vector<double> getKernelParameters() const override;
990 
994  KernelFunctionPtr getKernelColFunction() const;
995 
999  KernelFunctionPtr getKernelRowFunction() const;
1000 
1001  std::string toString(std::string const &prefix = "") const override;
1002 
1003  /***
1004  * Compute a cache of values for the x and y kernel functions
1005  *
1006  * A value of 0 disables the cache for maximum accuracy.
1007  * 10,000 typically results in a warping error of a fraction of a count.
1008  * 100,000 typically results in a warping error of less than 0.01 count.
1009  *
1010  * @param cacheSize cache size (number of double precision array elements in the x and y caches)
1011  */
1012  void computeCache(int const cacheSize) override;
1013 
1017  int getCacheSize() const override;
1018 
1019 protected:
1020  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
1021 
1022  void setKernelParameter(unsigned int ind, double value) const override;
1023 
1024 private:
1038  double basicComputeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList,
1039  bool doNormalize) const;
1040 
1041  KernelFunctionPtr _kernelColFunctionPtr;
1042  KernelFunctionPtr _kernelRowFunctionPtr;
1043  mutable std::vector<Pixel> _localColList; // used by doComputeImage
1044  mutable std::vector<Pixel> _localRowList;
1045  mutable std::vector<double> _kernelX; // used by SeparableKernel::basicComputeVectors
1046  mutable std::vector<double> _kernelY;
1047  //
1048  // Cached values of the row- and column- kernels
1049  //
1050  mutable std::vector<std::vector<double>> _kernelRowCache;
1051  mutable std::vector<std::vector<double>> _kernelColCache;
1052 
1053  virtual void _setKernelXY() override {
1054  lsst::geom::Extent2I const dim = getDimensions();
1055  lsst::geom::Point2I const ctr = getCtr();
1056 
1057  assert(dim[0] == static_cast<int>(_kernelX.size()));
1058  for (int i = 0; i != dim.getX(); ++i) {
1059  _kernelX[i] = i - ctr.getX();
1060  }
1061 
1062  assert(dim[1] == static_cast<int>(_kernelY.size()));
1063  for (int i = 0; i != dim.getY(); ++i) {
1064  _kernelY[i] = i - ctr.getY();
1065  }
1066  }
1067 };
1068 } // namespace math
1069 } // namespace afw
1070 } // namespace lsst
1071 
1072 #endif // !defined(LSST_AFW_MATH_KERNEL_H)
AmpInfoBoxKey bbox
Definition: Amplifier.cc:117
virtual int getCacheSize() const
Get the current size of the kernel cache (0 if none or if caches not supported)
Definition: Kernel.h:450
int getHeight() const
Return the Kernel&#39;s height.
Definition: Kernel.h:230
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
int getCtrX() const
Return x index of kernel&#39;s center.
Definition: Kernel.h:244
int getCtrY() const
Return y index of kernel&#39;s center.
Definition: Kernel.h:255
std::shared_ptr< KernelFunction > KernelFunctionPtr
Definition: Kernel.h:910
afw::table::Key< int > cacheSize
Definition: CoaddPsf.cc:339
virtual Pixel getSum() const
Definition: Kernel.h:551
virtual void computeCache(int const)
Compute a cache of Kernel values, if desired.
Definition: Kernel.h:444
void setWidth(int width)
Definition: Kernel.h:219
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:224
lsst::afw::math::Function1< Pixel > KernelFunction
Definition: Kernel.h:909
virtual double getKernelParameter(unsigned int i) const
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:300
void setKernelParameters(std::vector< double > const &params)
Set the kernel parameters of a spatially invariant kernel.
Definition: Kernel.h:388
Kernel & operator=(const Kernel &)=delete
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Definition: Kernel.h:907
int y
Definition: SpanSet.cc:49
std::shared_ptr< lsst::afw::math::Function2< double > > SpatialFunctionPtr
Definition: Kernel.h:114
double getKernelParameter(unsigned int i) const override
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:980
void setHeight(int height)
Definition: Kernel.h:220
bool isDeltaFunctionBasis() const
Return true if all basis kernels are instances of DeltaFunctionKernel.
Definition: Kernel.h:827
lsst::afw::math::NullFunction2< double > NullSpatialFunction
Definition: Kernel.h:116
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:235
lsst::afw::math::Function2< double > SpatialFunction
Definition: Kernel.h:115
A Function taking two arguments.
Definition: Function.h:259
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:553
int getNBasisKernels() const
Get the number of basis kernels.
Definition: Kernel.h:815
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:721
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:380
void setCtrY(int ctrY)
Set y index of kernel&#39;s center.
Definition: Kernel.h:360
KernelFunctionPtr _kernelFunctionPtr
Definition: Kernel.h:680
A base class for image defects.
std::vector< SpatialFunctionPtr > getSpatialFunctionList() const
Return a list of clones of the spatial functions.
Definition: Kernel.cc:166
lsst::geom::Box2I getBBox() const
return parent bounding box, with XY0 = -center
Definition: Kernel.h:262
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:177
void setCtrX(int ctrX)
Set x index of kernel&#39;s center.
Definition: Kernel.h:348
void computeKernelParametersFromSpatialModel(std::vector< double > &kernelParams, double x, double y) const
Compute the kernel parameters at a specified point.
Definition: Kernel.cc:144
A kernel that is a linear combination of fixed basis kernels.
Definition: Kernel.h:750
void setKernelParameters(std::pair< double, double > const &params)
Set the kernel parameters of a 2-component spatially invariant kernel.
Definition: Kernel.h:410
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:202
lsst::geom::Point2I getCtr() const
Return index of kernel&#39;s center.
Definition: Kernel.h:235
SpatialFunctionPtr getSpatialFunction(unsigned int index) const
Return a clone of the specified spatial function (one component of the spatial model) ...
Definition: Kernel.cc:153
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:85
void setDimensions(lsst::geom::Extent2I dims)
Definition: Kernel.h:215
void setCtr(lsst::geom::Point2I ctr)
Set index of kernel&#39;s center.
Definition: Kernel.h:335
virtual std::vector< double > getKernelParameters() const
Return the current kernel parameters.
Definition: Kernel.cc:175
Point< int, 2 > Point2I
Definition: Point.h:321
generic_kernel_tag kernel_fill_factor
Definition: Kernel.h:119
double x
void setKernelParametersFromSpatialModel(double x, double y) const
Set the kernel parameters from the spatial model (if any).
Definition: Kernel.cc:228
int getWidth() const
Return the Kernel&#39;s width.
Definition: Kernel.h:225
lsst::geom::Extent2I const getDimensions() const
Return the Kernel&#39;s dimensions (width, height)
Definition: Kernel.h:213
unsigned int getNKernelParameters() const
Return the number of kernel parameters (0 if none)
Definition: Kernel.h:269
void setSpatialParameters(const std::vector< std::vector< double >> params)
Set the parameters of all spatial functions.
Definition: Kernel.cc:119
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:183
std::vector< std::shared_ptr< Kernel > > KernelList
Definition: Kernel.h:509
std::vector< SpatialFunctionPtr > _spatialFunctionList
Definition: Kernel.h:496
lsst::afw::math::Function2< Pixel > KernelFunction
Definition: Kernel.h:584
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:274
Reports invalid arguments.
Definition: Runtime.h:66
std::string prefix
Definition: SchemaMapper.cc:79
std::vector< std::vector< double > > getSpatialParameters() const
Return the spatial parameters parameters (an empty vector if not spatially varying) ...
Definition: Kernel.h:368
~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:717
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:867
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:666
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
deltafunction_kernel_tag kernel_fill_factor
Definition: Kernel.h:693
A kernel described by a function.
Definition: Kernel.h:582
std::shared_ptr< lsst::afw::math::Function2< Pixel > > KernelFunctionPtr
Definition: Kernel.h:585
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:111
An integer coordinate rectangle.
Definition: Box.h:55
A kernel that has only one non-zero pixel (of value 1)
Definition: Kernel.h:690
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:195
Tags carrying information about Kernels Kernel with no special properties.
Definition: traits.h:53
A kernel created from an Image.
Definition: Kernel.h:518
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104