SourceXtractorPlusPlus  0.10
Please provide a description of the project.
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SourceXtractor::VariablePsf Class Reference

Implements a variable PSF using an arbitrary number of components (i.e. X, Y), and degrees. More...

#include <VariablePsf.h>

Collaboration diagram for SourceXtractor::VariablePsf:
[legend]

Classes

struct  Component
 

Public Member Functions

 VariablePsf (double pixel_sampling, const std::vector< Component > &components, const std::vector< int > &group_degrees, const std::vector< std::shared_ptr< VectorImage< SeFloat >>> &coefficients)
 
 VariablePsf (double pixel_sampling, const std::shared_ptr< VectorImage< SeFloat >> &constant)
 
virtual ~VariablePsf ()=default
 
int getWidth () const
 
int getHeight () const
 
double getPixelSampling () const
 
const std::vector< Component > & getComponents () const
 
std::shared_ptr< VectorImage< SeFloat > > getPsf (const std::vector< double > &values) const
 

Private Member Functions

void selfTest ()
 Verify that the preconditions of getPsf are met at construction time. More...
 
std::vector< double > scaleProperties (const std::vector< double > &values) const
 Normalizes the values. More...
 
void calculateExponents ()
 

Private Attributes

double m_pixel_sampling
 
std::vector< Componentm_components
 
std::vector< int > m_group_degrees
 
std::vector< std::shared_ptr< VectorImage< SeFloat > > > m_coefficients
 
std::vector< std::vector< int > > m_exponents
 

Detailed Description

Implements a variable PSF using an arbitrary number of components (i.e. X, Y), and degrees.

It is based on SExtractor logic, so based on a polynomial where the variables are some attributes of a source. For instance, if the components were X and Y, both in the same group, and the degree 2, the polynomial would be

 \f$C + X + X^2 + XY + Y + Y^2\f$

The coefficients must be given on that order (note that the constant would be the first element)

Definition at line 49 of file VariablePsf.h.

Constructor & Destructor Documentation

◆ VariablePsf() [1/2]

SourceXtractor::VariablePsf::VariablePsf ( double  pixel_sampling,
const std::vector< Component > &  components,
const std::vector< int > &  group_degrees,
const std::vector< std::shared_ptr< VectorImage< SeFloat >>> &  coefficients 
)

Constructor

Parameters
pixel_samplingUnused by the class itself, it is an attribute of the PSF. It is the sampling step size of the PSF on image pixels. i.e. a value of 0.5 means that a PSF pixel has been sampled every 0.5 pixels on the corresponding image.
componentsList of components (or variables) to be used by the Variable PSF
group_degreesPolynomial degree. Each group has its own degree, so there has to be as many as different group_id there are on the components

Definition at line 31 of file VariablePsf.cpp.

References calculateExponents(), and selfTest().

Here is the call graph for this function:

◆ VariablePsf() [2/2]

SourceXtractor::VariablePsf::VariablePsf ( double  pixel_sampling,
const std::shared_ptr< VectorImage< SeFloat >> &  constant 
)

Convenience constructor that initializes the variable PSF with just a constant value (So it is not variable anymore)

Definition at line 40 of file VariablePsf.cpp.

◆ ~VariablePsf()

virtual SourceXtractor::VariablePsf::~VariablePsf ( )
virtualdefault

Destructor

Member Function Documentation

◆ calculateExponents()

void SourceXtractor::VariablePsf::calculateExponents ( )
private

Calculates the exponents for each component per term of the polynomial.

For instance, for (X, Y) degree 2, this would generate the matrix

[0, 0] // constant
[1, 0] // X
[2, 0] // X^2
[1, 1] // XY
[0, 1] // Y
[0, 2] // Y^2

Definition at line 152 of file VariablePsf.cpp.

References std::vector< T >::begin(), e, std::vector< T >::end(), std::exp(), m_coefficients, m_components, m_exponents, m_group_degrees, and std::vector< T >::resize().

Referenced by VariablePsf().

Here is the call graph for this function:

◆ getComponents()

const std::vector< VariablePsf::Component > & SourceXtractor::VariablePsf::getComponents ( ) const
Returns
A reference to the list of components

Definition at line 59 of file VariablePsf.cpp.

References m_components.

Referenced by TestImage::mainMethod().

◆ getHeight()

int SourceXtractor::VariablePsf::getHeight ( ) const
Returns
The height of the PSF

Definition at line 51 of file VariablePsf.cpp.

References m_coefficients.

Referenced by getPsf(), and TestImage::mainMethod().

◆ getPixelSampling()

double SourceXtractor::VariablePsf::getPixelSampling ( ) const
Returns
The pixel sampling

Definition at line 55 of file VariablePsf.cpp.

References m_pixel_sampling.

Referenced by TestImage::mainMethod().

◆ getPsf()

std::shared_ptr< VectorImage< SeFloat > > SourceXtractor::VariablePsf::getPsf ( const std::vector< double > &  values) const

Reconstructs a PSF based on the given values for each of the component.

Parameters
valuesComponent values. Note that they have to be in the same order (and as many) as components were passed to the constructor (none for constant PSF).
Returns
The reconstructed PSF
Exceptions
Ifthe number of values does not match the number of components

Definition at line 63 of file VariablePsf.cpp.

References SourceXtractor::VectorImage< T >::create(), std::exp(), getHeight(), getWidth(), m_coefficients, m_exponents, std::pow(), scaleProperties(), x, and y.

Referenced by TestImage::mainMethod().

Here is the call graph for this function:

◆ getWidth()

int SourceXtractor::VariablePsf::getWidth ( ) const
Returns
The width of the PSF

Definition at line 47 of file VariablePsf.cpp.

References m_coefficients.

Referenced by getPsf(), and TestImage::mainMethod().

◆ scaleProperties()

std::vector< double > SourceXtractor::VariablePsf::scaleProperties ( const std::vector< double > &  values) const
private

Normalizes the values.

Definition at line 139 of file VariablePsf.cpp.

References m_components, and std::vector< T >::size().

Referenced by getPsf().

Here is the call graph for this function:

◆ selfTest()

void SourceXtractor::VariablePsf::selfTest ( )
private

Verify that the preconditions of getPsf are met at construction time.

Definition at line 95 of file VariablePsf.cpp.

References g, m_coefficients, m_components, m_group_degrees, and std::vector< T >::size().

Referenced by VariablePsf().

Here is the call graph for this function:

Member Data Documentation

◆ m_coefficients

std::vector<std::shared_ptr<VectorImage<SeFloat> > > SourceXtractor::VariablePsf::m_coefficients
private

Definition at line 126 of file VariablePsf.h.

Referenced by calculateExponents(), getHeight(), getPsf(), getWidth(), and selfTest().

◆ m_components

std::vector<Component> SourceXtractor::VariablePsf::m_components
private

Definition at line 124 of file VariablePsf.h.

Referenced by calculateExponents(), getComponents(), scaleProperties(), and selfTest().

◆ m_exponents

std::vector<std::vector<int> > SourceXtractor::VariablePsf::m_exponents
private

Definition at line 127 of file VariablePsf.h.

Referenced by calculateExponents(), and getPsf().

◆ m_group_degrees

std::vector<int> SourceXtractor::VariablePsf::m_group_degrees
private

Definition at line 125 of file VariablePsf.h.

Referenced by calculateExponents(), and selfTest().

◆ m_pixel_sampling

double SourceXtractor::VariablePsf::m_pixel_sampling
private

Definition at line 123 of file VariablePsf.h.

Referenced by getPixelSampling().


The documentation for this class was generated from the following files: