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

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

#include <VariablePsf.h>

Inheritance diagram for SourceXtractor::VariablePsf:
[legend]
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 override
 
int getHeight () const override
 
double getPixelSampling () const override
 
const std::vector< std::string > & getComponents () const override
 
std::shared_ptr< VectorImage< SeFloat > > getPsf (const std::vector< double > &values) const override
 
- Public Member Functions inherited from SourceXtractor::Psf
virtual ~Psf ()=default
 

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< std::stringm_component_names
 
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 PsfEx/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 48 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 std::back_inserter(), calculateExponents(), m_component_names, m_components, selfTest(), and std::transform().

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 42 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 149 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< std::string > & SourceXtractor::VariablePsf::getComponents ( ) const
overridevirtual
Returns
A reference to the list of components

Implements SourceXtractor::Psf.

Definition at line 61 of file VariablePsf.cpp.

References m_component_names.

◆ getHeight()

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

Implements SourceXtractor::Psf.

Definition at line 53 of file VariablePsf.cpp.

References m_coefficients.

Referenced by getPsf().

◆ getPixelSampling()

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

Implements SourceXtractor::Psf.

Definition at line 57 of file VariablePsf.cpp.

References m_pixel_sampling.

◆ getPsf()

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

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

Implements SourceXtractor::Psf.

Definition at line 65 of file VariablePsf.cpp.

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

Here is the call graph for this function:

◆ getWidth()

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

Implements SourceXtractor::Psf.

Definition at line 49 of file VariablePsf.cpp.

References m_coefficients.

Referenced by getPsf().

◆ scaleProperties()

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

Normalizes the values.

Definition at line 136 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 92 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 125 of file VariablePsf.h.

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

◆ m_component_names

std::vector<std::string> SourceXtractor::VariablePsf::m_component_names
private

Definition at line 123 of file VariablePsf.h.

Referenced by getComponents(), and VariablePsf().

◆ m_components

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

Definition at line 122 of file VariablePsf.h.

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

◆ m_exponents

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

Definition at line 126 of file VariablePsf.h.

Referenced by calculateExponents(), and getPsf().

◆ m_group_degrees

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

Definition at line 124 of file VariablePsf.h.

Referenced by calculateExponents(), and selfTest().

◆ m_pixel_sampling

double SourceXtractor::VariablePsf::m_pixel_sampling
private

Definition at line 121 of file VariablePsf.h.

Referenced by getPixelSampling().


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