LSSTApplications  17.0+124,17.0+14,17.0+73,18.0.0+37,18.0.0+80,18.0.0-4-g68ffd23+4,18.1.0-1-g0001055+12,18.1.0-1-g03d53ef+5,18.1.0-1-g1349e88+55,18.1.0-1-g2505f39+44,18.1.0-1-g5315e5e+4,18.1.0-1-g5e4b7ea+14,18.1.0-1-g7e8fceb+4,18.1.0-1-g85f8cd4+48,18.1.0-1-g8ff0b9f+4,18.1.0-1-ga2c679d+1,18.1.0-1-gd55f500+35,18.1.0-10-gb58edde+2,18.1.0-11-g0997b02+4,18.1.0-13-gfe4edf0b+12,18.1.0-14-g259bd21+21,18.1.0-19-gdb69f3f+2,18.1.0-2-g5f9922c+24,18.1.0-2-gd3b74e5+11,18.1.0-2-gfbf3545+32,18.1.0-26-g728bddb4+5,18.1.0-27-g6ff7ca9+2,18.1.0-3-g52aa583+25,18.1.0-3-g8ea57af+9,18.1.0-3-gb69f684+42,18.1.0-3-gfcaddf3+6,18.1.0-32-gd8786685a,18.1.0-4-gf3f9b77+6,18.1.0-5-g1dd662b+2,18.1.0-5-g6dbcb01+41,18.1.0-6-gae77429+3,18.1.0-7-g9d75d83+9,18.1.0-7-gae09a6d+30,18.1.0-9-gc381ef5+4,w.2019.45
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  inline int getCtrX() const { return _ctrX; }
243 
249  inline int getCtrY() const { return _ctrY; }
250 
254  inline lsst::geom::Box2I getBBox() const {
255  return lsst::geom::Box2I(lsst::geom::Point2I(-_ctrX, -_ctrY), lsst::geom::Extent2I(_width, _height));
256  }
257 
261  inline unsigned int getNKernelParameters() const { return _nKernelParams; }
262 
266  inline int getNSpatialParameters() const {
267  return this->isSpatiallyVarying() ? _spatialFunctionList[0]->getNParameters() : 0;
268  }
269 
280  SpatialFunctionPtr getSpatialFunction(unsigned int index) const;
281 
289 
292  virtual double getKernelParameter(unsigned int i) const { return getKernelParameters()[i]; }
293 
302 
311 
323 
327  inline void setCtr(lsst::geom::Point2I ctr) {
328  _ctrX = ctr.getX();
329  _ctrY = ctr.getY();
330  _setKernelXY();
331  }
332 
338  inline void setCtrX(int ctrX) {
339  _ctrX = ctrX;
340  _setKernelXY();
341  }
342 
348  inline void setCtrY(int ctrY) {
349  _ctrY = ctrY;
350  _setKernelXY();
351  }
352 
357  std::vector<std::vector<double>> spatialParams;
359  for (; spFuncIter != _spatialFunctionList.end(); ++spFuncIter) {
360  spatialParams.push_back((*spFuncIter)->getParameters());
361  }
362  return spatialParams;
363  }
364 
368  inline bool isSpatiallyVarying() const { return _spatialFunctionList.size() != 0; }
369 
376  inline void setKernelParameters(std::vector<double> const &params) {
377  if (this->isSpatiallyVarying()) {
378  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Kernel is spatially varying");
379  }
380  const unsigned int nParams = this->getNKernelParameters();
381  if (nParams != params.size()) {
383  (boost::format("Number of parameters is wrong, saw %d expected %d") % nParams %
384  params.size())
385  .str());
386  }
387  for (unsigned int ii = 0; ii < nParams; ++ii) {
388  this->setKernelParameter(ii, params[ii]);
389  }
390  }
391 
398  inline void setKernelParameters(std::pair<double, double> const &params) {
399  this->setKernelParameter(0, params.first);
400  this->setKernelParameter(1, params.second);
401  }
402 
412 
419  void computeKernelParametersFromSpatialModel(std::vector<double> &kernelParams, double x, double y) const;
420 
424  virtual std::string toString(std::string const &prefix = "") const;
425 
432  virtual void computeCache(int const
433  ) {}
434 
438  virtual int getCacheSize() const { return 0; };
439 
440 #if 0 // fails to compile with icc; is it actually used?
441  virtual void toFile(std::string fileName) const;
442 #endif
443 
444  struct PersistenceHelper;
445 
446 protected:
447  std::string getPythonModule() const override;
448 
459  virtual void setKernelParameter(unsigned int ind, double value) const;
460 
469  void setKernelParametersFromSpatialModel(double x, double y) const;
470 
482  virtual double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const = 0;
483 
485 
486 private:
487  int _width;
488  int _height;
489  int _ctrX;
490  int _ctrY;
491  unsigned int _nKernelParams;
492 
493  // Set the Kernel's ideas about the x- and y- coordinates
494  virtual void _setKernelXY() {}
495 };
496 
498 
506 class FixedKernel : public afw::table::io::PersistableFacade<FixedKernel>, public Kernel {
507 public:
511  explicit FixedKernel();
512 
517  );
518 
522  explicit FixedKernel(lsst::afw::math::Kernel const &kernel,
523  lsst::geom::Point2D const &pos
524  );
525 
526  FixedKernel(const FixedKernel &) = delete;
527  FixedKernel(FixedKernel &&) = delete;
528  FixedKernel &operator=(const FixedKernel &) = delete;
529  FixedKernel &operator=(FixedKernel &&) = delete;
530 
531  ~FixedKernel() override = default;
532 
533  std::shared_ptr<Kernel> clone() const override;
534 
535  std::shared_ptr<Kernel> resized(int width, int height) const override;
536 
537  std::string toString(std::string const &prefix = "") const override;
538 
539  virtual Pixel getSum() const { return _sum; }
540 
541  bool isPersistable() const noexcept override { return true; }
542 
543  class Factory;
544 
545 protected:
546  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
547 
548  std::string getPersistenceName() const override;
549 
550  void write(OutputArchiveHandle &handle) const override;
551 
552 private:
554  Pixel _sum;
555 };
556 
570 class AnalyticKernel : public afw::table::io::PersistableFacade<AnalyticKernel>, public Kernel {
571 public:
574 
578  explicit AnalyticKernel();
579 
592  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
593  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
594 
608  explicit AnalyticKernel(int width, int height, KernelFunction const &kernelFunction,
609  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
610 
611  AnalyticKernel(const AnalyticKernel &) = delete;
612  AnalyticKernel(AnalyticKernel &&) = delete;
613  AnalyticKernel &operator=(const AnalyticKernel &) = delete;
615 
616  ~AnalyticKernel() override = default;
617 
618  std::shared_ptr<Kernel> clone() const override;
619 
620  std::shared_ptr<Kernel> resized(int width, int height) const override;
621 
642  double computeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize, double x = 0.0,
643  double y = 0.0) const;
644 
645  std::vector<double> getKernelParameters() const override;
646 
650  virtual KernelFunctionPtr getKernelFunction() const;
651 
652  std::string toString(std::string const &prefix = "") const override;
653 
654  bool isPersistable() const noexcept override { return true; }
655 
656  class Factory;
657 
658 protected:
659  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
660 
661  std::string getPersistenceName() const override;
662 
663  void write(OutputArchiveHandle &handle) const override;
664 
665 protected:
666  void setKernelParameter(unsigned int ind, double value) const override;
667 
668  KernelFunctionPtr _kernelFunctionPtr;
669 };
670 
678 class DeltaFunctionKernel : public afw::table::io::PersistableFacade<DeltaFunctionKernel>, public Kernel {
679 public:
680  // Traits values for this class of Kernel
682 
692  explicit DeltaFunctionKernel(int width, int height, lsst::geom::Point2I const &point);
693 
694  DeltaFunctionKernel(const DeltaFunctionKernel &) = delete;
698 
699  ~DeltaFunctionKernel() override = default;
700 
701  std::shared_ptr<Kernel> clone() const override;
702 
703  std::shared_ptr<Kernel> resized(int width, int height) const override;
704 
705  lsst::geom::Point2I getPixel() const { return _pixel; }
706 
707  std::string toString(std::string const &prefix = "") const override;
708 
709  bool isPersistable() const noexcept override { return true; }
710 
711  class Factory;
712 
713 protected:
714  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
715 
716  std::string getPersistenceName() const override;
717 
718  void write(OutputArchiveHandle &handle) const override;
719 
720 private:
721  lsst::geom::Point2I _pixel;
722 };
723 
738 class LinearCombinationKernel : public afw::table::io::PersistableFacade<LinearCombinationKernel>,
739  public Kernel {
740 public:
744  explicit LinearCombinationKernel();
745 
752  explicit LinearCombinationKernel(KernelList const &kernelList,
753  std::vector<double> const &kernelParameters);
754 
762  explicit LinearCombinationKernel(KernelList const &kernelList,
763  Kernel::SpatialFunction const &spatialFunction);
764 
774  explicit LinearCombinationKernel(KernelList const &kernelList,
775  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
776 
781 
782  ~LinearCombinationKernel() override = default;
783 
784  std::shared_ptr<Kernel> clone() const override;
785 
786  std::shared_ptr<Kernel> resized(int width, int height) const override;
787 
788  std::vector<double> getKernelParameters() const override;
789 
793  virtual KernelList const &getKernelList() const;
794 
798  std::vector<double> getKernelSumList() const;
799 
803  int getNBasisKernels() const { return static_cast<int>(_kernelList.size()); };
804 
810  void checkKernelList(const KernelList &kernelList) const;
811 
815  bool isDeltaFunctionBasis() const { return _isDeltaFunctionBasis; };
816 
851  std::shared_ptr<Kernel> refactor() const;
852 
853  std::string toString(std::string const &prefix = "") const override;
854 
855  bool isPersistable() const noexcept override { return true; }
856 
857  class Factory;
858 
859 protected:
860  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
861 
862  std::string getPersistenceName() const override;
863 
864  void write(OutputArchiveHandle &handle) const override;
865 
866  void setKernelParameter(unsigned int ind, double value) const override;
867 
868 private:
872  void _setKernelList(KernelList const &kernelList);
873 
874  KernelList _kernelList;
877  std::vector<double> _kernelSumList;
878  mutable std::vector<double> _kernelParams;
879  bool _isDeltaFunctionBasis;
880 };
881 
895 class SeparableKernel : public afw::table::io::PersistableFacade<SeparableKernel>, public Kernel {
896 public:
899 
903  explicit SeparableKernel();
904 
917  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
918  KernelFunction const &kernelRowFunction,
919  Kernel::SpatialFunction const &spatialFunction = NullSpatialFunction());
920 
934  explicit SeparableKernel(int width, int height, KernelFunction const &kernelColFunction,
935  KernelFunction const &kernelRowFunction,
936  std::vector<Kernel::SpatialFunctionPtr> const &spatialFunctionList);
937 
938  SeparableKernel(const SeparableKernel &) = delete;
939  SeparableKernel(SeparableKernel &&) = delete;
940  SeparableKernel &operator=(const SeparableKernel &) = delete;
942 
943  ~SeparableKernel() override = default;
944 
945  std::shared_ptr<Kernel> clone() const override;
946 
947  std::shared_ptr<Kernel> resized(int width, int height) const override;
948 
965  double computeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList, bool doNormalize,
966  double x = 0.0, double y = 0.0) const;
967 
968  double getKernelParameter(unsigned int i) const override {
969  unsigned int const ncol = _kernelColFunctionPtr->getNParameters();
970  if (i < ncol) {
971  return _kernelColFunctionPtr->getParameter(i);
972  } else {
973  i -= ncol;
974  return _kernelRowFunctionPtr->getParameter(i);
975  }
976  }
977  std::vector<double> getKernelParameters() const override;
978 
982  KernelFunctionPtr getKernelColFunction() const;
983 
987  KernelFunctionPtr getKernelRowFunction() const;
988 
989  std::string toString(std::string const &prefix = "") const override;
990 
991  /***
992  * Compute a cache of values for the x and y kernel functions
993  *
994  * A value of 0 disables the cache for maximum accuracy.
995  * 10,000 typically results in a warping error of a fraction of a count.
996  * 100,000 typically results in a warping error of less than 0.01 count.
997  *
998  * @param cacheSize cache size (number of double precision array elements in the x and y caches)
999  */
1000  void computeCache(int const cacheSize) override;
1001 
1005  int getCacheSize() const override;
1006 
1007 protected:
1008  double doComputeImage(lsst::afw::image::Image<Pixel> &image, bool doNormalize) const override;
1009 
1010  void setKernelParameter(unsigned int ind, double value) const override;
1011 
1012 private:
1026  double basicComputeVectors(std::vector<Pixel> &colList, std::vector<Pixel> &rowList,
1027  bool doNormalize) const;
1028 
1029  KernelFunctionPtr _kernelColFunctionPtr;
1030  KernelFunctionPtr _kernelRowFunctionPtr;
1031  mutable std::vector<Pixel> _localColList; // used by doComputeImage
1032  mutable std::vector<Pixel> _localRowList;
1033  mutable std::vector<double> _kernelX; // used by SeparableKernel::basicComputeVectors
1034  mutable std::vector<double> _kernelY;
1035  //
1036  // Cached values of the row- and column- kernels
1037  //
1038  mutable std::vector<std::vector<double>> _kernelRowCache;
1039  mutable std::vector<std::vector<double>> _kernelColCache;
1040 
1041  virtual void _setKernelXY() override {
1042  lsst::geom::Extent2I const dim = getDimensions();
1043  lsst::geom::Point2I const ctr = getCtr();
1044 
1045  assert(dim[0] == static_cast<int>(_kernelX.size()));
1046  for (int i = 0; i != dim.getX(); ++i) {
1047  _kernelX[i] = i - ctr.getX();
1048  }
1049 
1050  assert(dim[1] == static_cast<int>(_kernelY.size()));
1051  for (int i = 0; i != dim.getY(); ++i) {
1052  _kernelY[i] = i - ctr.getY();
1053  }
1054  }
1055 };
1056 } // namespace math
1057 } // namespace afw
1058 } // namespace lsst
1059 
1060 #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:438
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:242
int getCtrY() const
Return y index of kernel&#39;s center.
Definition: Kernel.h:249
std::shared_ptr< KernelFunction > KernelFunctionPtr
Definition: Kernel.h:898
afw::table::Key< int > cacheSize
Definition: CoaddPsf.cc:339
virtual Pixel getSum() const
Definition: Kernel.h:539
virtual void computeCache(int const)
Compute a cache of Kernel values, if desired.
Definition: Kernel.h:432
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:897
virtual double getKernelParameter(unsigned int i) const
Return a particular Kernel Parameter (no bounds checking).
Definition: Kernel.h:292
void setKernelParameters(std::vector< double > const &params)
Set the kernel parameters of a spatially invariant kernel.
Definition: Kernel.h:376
Kernel & operator=(const Kernel &)=delete
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Definition: Kernel.h:895
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:968
void setHeight(int height)
Definition: Kernel.h:220
bool isDeltaFunctionBasis() const
Return true if all basis kernels are instances of DeltaFunctionKernel.
Definition: Kernel.h:815
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:541
int getNBasisKernels() const
Get the number of basis kernels.
Definition: Kernel.h:803
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:709
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:368
void setCtrY(int ctrY)
Set y index of kernel&#39;s center.
Definition: Kernel.h:348
KernelFunctionPtr _kernelFunctionPtr
Definition: Kernel.h:668
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:254
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:338
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:738
void setKernelParameters(std::pair< double, double > const &params)
Set the kernel parameters of a 2-component spatially invariant kernel.
Definition: Kernel.h:398
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:327
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:261
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:497
std::vector< SpatialFunctionPtr > _spatialFunctionList
Definition: Kernel.h:484
lsst::afw::math::Function2< Pixel > KernelFunction
Definition: Kernel.h:572
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:266
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:356
~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:705
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:855
bool isPersistable() const noexcept override
Return true if this particular object can be persisted using afw::table::io.
Definition: Kernel.h:654
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
deltafunction_kernel_tag kernel_fill_factor
Definition: Kernel.h:681
A kernel described by a function.
Definition: Kernel.h:570
std::shared_ptr< lsst::afw::math::Function2< Pixel > > KernelFunctionPtr
Definition: Kernel.h:573
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:678
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:506
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104