lsst.meas.extensions.psfex g33ac35c1f1+1b55dad530
Loading...
Searching...
No Matches
PsfexPsf.h
Go to the documentation of this file.
1// -*- lsst-c++ -*-
2/*
3 * LSST Data Management System
4 * Copyright 2008-2013 LSST Corporation.
5 *
6 * This product includes software developed by the
7 * LSST Project (http://www.lsst.org/).
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the LSST License Statement and
20 * the GNU General Public License along with this program. If not,
21 * see <http://www.lsstcorp.org/LegalNotices/>.
22 */
23
24# if !defined(LSST_MEAS_EXTENSIONS_PSFEX_PSFEX_H)
25#define LSST_MEAS_EXTENSIONS_PSFEX_PSFEX_H 1
26
27#include "ndarray.h"
28#include "lsst/geom/Box.h"
30#include "lsst/meas/extensions/psfex/psf.hh"
31
32namespace lsst { namespace meas { namespace extensions { namespace psfex {
33 namespace detail {
34 class PsfexPsfFactory;
35 }
36
37
39 double average_x = 0.0;
40 double average_y = 0.0;
41 double pixel_step = 0.0;
47 ndarray::Array<float, 1, 1> comp = ndarray::Array<float, 1, 1>();
48 ndarray::Array<double, 2, 2> context = ndarray::Array<double, 2, 2>();
49};
50
57public:
61 explicit PsfexPsf(
62 lsst::meas::extensions::psfex::Psf const& psf,
63 lsst::geom::Point2D const & averagePosition=lsst::geom::Point2D()
65 );
66 ~PsfexPsf() override;
67
70
72 std::shared_ptr<afw::detection::Psf> resized(int width, int height) const override;
73
75 lsst::geom::Point2D getAveragePosition() const override { return _averagePosition; }
76
82
84 bool isPersistable() const noexcept override { return true; }
85
86 void write(lsst::afw::table::io::OutputArchiveHandle & handle) const override;
87
89 int getNdim() const;
90
93
96
97private:
98 lsst::geom::Point2D _averagePosition;
99 // Here are the unpacked fields from the psfex psf struct
100 struct poly *_poly; // Polynom describing the PSF variations
101 float _pixstep; // Mask oversampling (pixel)
102 std::vector<int> _size; // PSF dimensions
103 std::vector<float> _comp; // Complete pix. data (PSF components)
104 std::vector<std::pair<double, double> > _context; // Offset/scale to apply to context data
105 mutable std::shared_ptr<lsst::afw::math::LinearCombinationKernel> _kernel; // keep a reference to getKernel()'s kernel
106
108 explicit PsfexPsf();
109
112 lsst::geom::Point2D const & position,
113 lsst::afw::image::Color const& color,
114 lsst::geom::Point2D const& center
115 ) const;
116
119 lsst::geom::Point2D const & position,
120 lsst::afw::image::Color const& color
121 ) const override;
122
125 lsst::geom::Point2D const & position,
126 lsst::afw::image::Color const& color
127 ) const override;
128
131 lsst::geom::Point2D const & position,
132 lsst::afw::image::Color const & color
133 ) const override;
134
138 lsst::geom::Box2I _doComputeBBox(
139 lsst::geom::Point2D const & position,
140 lsst::geom::Point2D const & center
141 ) const;
142
144 std::string getPersistenceName() const override;
146 std::string getPythonModule() const override;
147};
148
149}}}}
150
151#endif // !LSST_MEAS_EXTENSIONS_PSFEX_PSFEX_H
Represent a PSF as a linear combination of PSFEX (== Karhunen-Loeve) basis functions.
Definition PsfexPsf.h:55
std::shared_ptr< lsst::afw::math::LinearCombinationKernel const > getKernel(lsst::geom::Point2D=lsst::geom::Point2D(std::numeric_limits< double >::quiet_NaN())) const
Return the PSF's basis functions as a spatially-invariant LinearCombinationKernel with unit weights.
Definition PsfexPsf.cc:118
void write(lsst::afw::table::io::OutputArchiveHandle &handle) const override
Definition PsfexPsf.cc:483
lsst::geom::Box2I doComputeBBox(lsst::geom::Point2D const &position, lsst::afw::image::Color const &color) const override
Compute the bbox of the kernel image at the specified position/color.
Definition PsfexPsf.cc:200
PsfexPsf(lsst::meas::extensions::psfex::Psf const &psf, lsst::geom::Point2D const &averagePosition=lsst::geom::Point2D())
Constructor for a PsfexPsf.
Definition PsfexPsf.cc:64
std::shared_ptr< lsst::afw::detection::Psf::Image > doComputeImage(lsst::geom::Point2D const &position, lsst::afw::image::Color const &color) const override
Compute an image of the Psf at the specified position/colour, at pixel position in the output image.
Definition PsfexPsf.cc:188
int getNdim() const
Return the number of dependency parameters in the psfex polynomial fit.
Definition PsfexPsf.cc:113
lsst::geom::Point2D getAveragePosition() const override
Return average position of stars; used as default position.
Definition PsfexPsf.h:75
std::shared_ptr< lsst::afw::detection::Psf > clone() const override
Polymorphic deep copy; should usually be unnecessary as Psfs are immutable.x.
Definition PsfexPsf.cc:104
virtual std::shared_ptr< lsst::afw::detection::Psf::Image > _doComputeImage(lsst::geom::Point2D const &position, lsst::afw::image::Color const &color, lsst::geom::Point2D const &center) const
Compute an image of the Psf at the specified position/colour, at pixel position in the output image.
Definition PsfexPsf.cc:229
PsfexPsfSerializationData getSerializationData() const
Return a representation suitable for serialization.
Definition PsfexPsf.cc:575
std::shared_ptr< lsst::afw::detection::Psf::Image > doComputeKernelImage(lsst::geom::Point2D const &position, lsst::afw::image::Color const &color) const override
Compute an image of the Psf at the specified position/colour, at pixel (0.0, 0.0) in the output image...
Definition PsfexPsf.cc:194
std::string getPersistenceName() const override
Name used in table persistence.
Definition PsfexPsf.cc:481
std::shared_ptr< afw::detection::Psf > resized(int width, int height) const override
Return a clone with specified kernel dimensions.
Definition PsfexPsf.cc:109
std::string getPythonModule() const override
The python module name (for use in table persistence)
Definition PsfexPsf.cc:479
bool isPersistable() const noexcept override
Is this object persistable?
Definition PsfexPsf.h:84
static std::shared_ptr< PsfexPsf > fromSerializationData(PsfexPsfSerializationData const &data)
Construct from serialization data.
Definition PsfexPsf.cc:549
Point< double, 2 > Point2D
T quiet_NaN(T... args)