LSST Applications g0d97872fb5+4fd969bb9d,g1653933729+34a971ddd9,g28da252d5a+072f89fe25,g2bbee38e9b+a99b0ab4cd,g2bc492864f+a99b0ab4cd,g2ca4be77d2+c0e3b27cd8,g2cdde0e794+704103fe75,g3156d2b45e+6e87dc994a,g347aa1857d+a99b0ab4cd,g35bb328faa+34a971ddd9,g3a166c0a6a+a99b0ab4cd,g3e281a1b8c+8ec26ec694,g4005a62e65+ba0306790b,g414038480c+9ed5ed841a,g569e0e2b34+cb4faa46ad,g5a97de2502+520531a62c,g717e5f8c0f+29153700a5,g7ede599f99+367733290c,g80478fca09+17051a22cc,g82479be7b0+f2f1ea0a87,g858d7b2824+29153700a5,g8b782ad322+29153700a5,g8cd86fa7b1+05420e7f7d,g9125e01d80+34a971ddd9,ga5288a1d22+e7f674aaf3,gae0086650b+34a971ddd9,gae74b0b5c6+45ef5cdc51,gb58c049af0+ace264a4f2,gc28159a63d+a99b0ab4cd,gcf0d15dbbd+8051a81198,gda6a2b7d83+8051a81198,gdaeeff99f8+7774323b41,gdf4d240d4a+34a971ddd9,ge2409df99d+cb167bac99,ge33fd446bb+29153700a5,ge79ae78c31+a99b0ab4cd,gf0baf85859+890af219f9,gf5289d68f6+9faa5c5784,w.2024.36
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
lsst::gauss2d::fit::LinearSersicMixInterpolator Class Reference

A SersicMixInterpolator that uses linear interpolation between knots. More...

#include <linearsersicmixinterpolator.h>

Inheritance diagram for lsst::gauss2d::fit::LinearSersicMixInterpolator:
lsst::gauss2d::fit::SersicMixInterpolator lsst::gauss2d::Object

Public Member Functions

 LinearSersicMixInterpolator (unsigned short order=SERSICMIX_ORDER_DEFAULT)
 
 ~LinearSersicMixInterpolator ()
 
std::vector< IntegralSizeget_integralsizes (double sersicindex) const override
 Get the vector of IntegralSize values for a given Sersic index.
 
std::vector< IntegralSizeget_integralsizes_derivs (double sersicindex) const override
 
const std::vector< SersicMixValues > & get_knots () const
 The knot positions and values.
 
InterpType get_interptype () const override
 
unsigned short get_order () const override
 
double get_sersicindex_min () const
 
double get_sersicindex_max () const
 
std::string repr (bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR) const override
 Return a full, callable string representation of this.
 
std::string str () const override
 Return a brief, human-readable string representation of this.
 

Static Public Member Functions

static std::string_view null_str (const std::string_view &namespace_separator)
 

Static Public Attributes

static constexpr std::string_view CC_NAMESPACE_SEPARATOR = "::"
 The C++ namespace separator.
 
static constexpr std::string_view NULL_STR_GENERAL = "None"
 
static constexpr std::string_view PY_NAMESPACE_SEPARATOR = "."
 

Detailed Description

A SersicMixInterpolator that uses linear interpolation between knots.

Definition at line 11 of file linearsersicmixinterpolator.h.

Constructor & Destructor Documentation

◆ LinearSersicMixInterpolator()

lsst::gauss2d::fit::LinearSersicMixInterpolator::LinearSersicMixInterpolator ( unsigned short order = SERSICMIX_ORDER_DEFAULT)
explicit

Definition at line 13 of file linearsersicmixinterpolator.cc.

14 : _order(order),
16 _sersicindex_min(_knots[0].sersicindex),
17 _sersicindex_max(_knots.back().sersicindex) {}
const std::vector< SersicMixValues > & get_sersic_mix_knots(unsigned short order)
Definition sersicmix.cc:50
table::Key< int > order

◆ ~LinearSersicMixInterpolator()

lsst::gauss2d::fit::LinearSersicMixInterpolator::~LinearSersicMixInterpolator ( )

Definition at line 19 of file linearsersicmixinterpolator.cc.

19{}

Member Function Documentation

◆ get_integralsizes()

std::vector< IntegralSize > lsst::gauss2d::fit::LinearSersicMixInterpolator::get_integralsizes ( double sersicindex) const
overridevirtual

Get the vector of IntegralSize values for a given Sersic index.

Parameters
sersicindexThe Sersic index value.
Returns
The vector of IntegralSize values for sersicindex.

Implements lsst::gauss2d::fit::SersicMixInterpolator.

Definition at line 21 of file linearsersicmixinterpolator.cc.

21 {
22 if (!((sersicindex >= _sersicindex_min) && (sersicindex <= _sersicindex_max))) {
23 throw std::invalid_argument("sersicindex=" + to_string_float(sersicindex)
24 + " !(>=" + to_string_float(_sersicindex_min)
25 + "&& <=" + to_string_float(_sersicindex_max));
26 }
27
28 if (sersicindex == _sersicindex_min)
29 return _knots[0].values;
30 else if (sersicindex == _sersicindex_max)
31 return _knots.back().values;
32
33 auto found = std::lower_bound(_knots.begin(), _knots.end(), sersicindex);
34 auto high = *found;
35 auto low = *(--found);
36
37 if (sersicindex == high.sersicindex) return high.values;
38 double frac_low = (high.sersicindex - sersicindex) / (high.sersicindex - low.sersicindex);
39 if (!((frac_low >= 0) && (frac_low <= 1))) {
40 throw std::logic_error("Got invalid frac_low=" + std::to_string(frac_low)
41 + " with n, lo, hi=" + to_string_float(sersicindex) + ","
42 + to_string_float(low.sersicindex) + "," + to_string_float(high.sersicindex));
43 }
44 double frac_high = 1 - frac_low;
45
47 result.reserve(_order);
48 for (size_t i = 0; i < _order; ++i) {
49 result.push_back(IntegralSize(frac_low * low.values[i].integral + frac_high * high.values[i].integral,
50 frac_low * low.values[i].sigma + frac_high * high.values[i].sigma));
51 }
52
53 return result;
54}
py::object result
Definition _schema.cc:429
T lower_bound(T... args)
std::string to_string_float(const T value, const int precision=6, const bool scientific=true)
Definition to_string.h:15
T reserve(T... args)
T to_string(T... args)

◆ get_integralsizes_derivs()

std::vector< IntegralSize > lsst::gauss2d::fit::LinearSersicMixInterpolator::get_integralsizes_derivs ( double sersicindex) const
overridevirtual

Implements lsst::gauss2d::fit::SersicMixInterpolator.

Definition at line 56 of file linearsersicmixinterpolator.cc.

56 {
57 if (!((sersicindex >= _sersicindex_min) && (sersicindex <= _sersicindex_max))) {
58 throw std::invalid_argument("sersicindex=" + to_string_float(sersicindex)
59 + " !(>=" + to_string_float(_sersicindex_min)
60 + "&& <=" + to_string_float(_sersicindex_max));
61 }
62
63 auto found = sersicindex == _sersicindex_min
64 ? ++_knots.begin()
65 : ((sersicindex == _sersicindex_max)
66 ? --_knots.end()
67 : std::upper_bound(_knots.begin(), _knots.end(), sersicindex));
68 auto& high = *found;
69 auto& low = *(--found);
70
71 double dn_inv = 1. / (high.sersicindex - low.sersicindex);
72
74 result.reserve(_order);
75 for (size_t i = 0; i < _order; ++i) {
76 result.push_back(IntegralSize((high.values[i].integral - low.values[i].integral) * dn_inv,
77 (high.values[i].sigma - low.values[i].sigma) * dn_inv));
78 }
79
80 return result;
81}
T upper_bound(T... args)

◆ get_interptype()

InterpType lsst::gauss2d::fit::LinearSersicMixInterpolator::get_interptype ( ) const
overridevirtual

Implements lsst::gauss2d::fit::SersicMixInterpolator.

Definition at line 83 of file linearsersicmixinterpolator.cc.

83{ return InterpType::linear; }
@ linear
Linear interpolation.

◆ get_knots()

const std::vector< SersicMixValues > & lsst::gauss2d::fit::LinearSersicMixInterpolator::get_knots ( ) const

The knot positions and values.

Definition at line 85 of file linearsersicmixinterpolator.cc.

85{ return _knots; }

◆ get_order()

unsigned short lsst::gauss2d::fit::LinearSersicMixInterpolator::get_order ( ) const
overridevirtual

Implements lsst::gauss2d::fit::SersicMixInterpolator.

Definition at line 87 of file linearsersicmixinterpolator.cc.

87{ return _order; }

◆ get_sersicindex_max()

double lsst::gauss2d::fit::LinearSersicMixInterpolator::get_sersicindex_max ( ) const

Definition at line 91 of file linearsersicmixinterpolator.cc.

91{ return _sersicindex_max; }

◆ get_sersicindex_min()

double lsst::gauss2d::fit::LinearSersicMixInterpolator::get_sersicindex_min ( ) const

Definition at line 89 of file linearsersicmixinterpolator.cc.

89{ return _sersicindex_min; }

◆ null_str()

static std::string_view lsst::gauss2d::Object::null_str ( const std::string_view & namespace_separator)
inlinestaticinherited

Definition at line 49 of file object.h.

49 {
50 return namespace_separator == CC_NAMESPACE_SEPARATOR ? "nullptr" : NULL_STR_GENERAL;
51 }
static constexpr std::string_view CC_NAMESPACE_SEPARATOR
The C++ namespace separator.
Definition object.h:45
static constexpr std::string_view NULL_STR_GENERAL
Definition object.h:46

◆ repr()

std::string lsst::gauss2d::fit::LinearSersicMixInterpolator::repr ( bool name_keywords = false,
std::string_view namespace_separator = Object::CC_NAMESPACE_SEPARATOR ) const
overridevirtual

Return a full, callable string representation of this.

Parameters
name_keywordsWhether to prefix arguments with "{name}=", where name is the arg name in the header (as with keyword arguments in Python).
namespace_separatorThe string to use to delimit namespaces, i.e. :: in C++ and . in Python.
Returns
A callable string representation of this, which should return an an identical object to this.
Note
The representation with name_keywords=false must be callable in C++. The representation with name_keywords=true should be callable in Python, if there are any bindings.

Implements lsst::gauss2d::Object.

Definition at line 93 of file linearsersicmixinterpolator.cc.

94 {
95 return type_name_str<LinearSersicMixInterpolator>(false, namespace_separator) + "("
96 + (name_keywords ? "order=" : "") + std::to_string(_order) + ")";
97}

◆ str()

std::string lsst::gauss2d::fit::LinearSersicMixInterpolator::str ( ) const
overridevirtual

Return a brief, human-readable string representation of this.

Implements lsst::gauss2d::Object.

Definition at line 99 of file linearsersicmixinterpolator.cc.

99 {
100 return type_name_str<LinearSersicMixInterpolator>(true) + "(order=" + std::to_string(_order) + ")";
101}

Member Data Documentation

◆ CC_NAMESPACE_SEPARATOR

constexpr std::string_view lsst::gauss2d::Object::CC_NAMESPACE_SEPARATOR = "::"
staticconstexprinherited

The C++ namespace separator.

Definition at line 45 of file object.h.

◆ NULL_STR_GENERAL

constexpr std::string_view lsst::gauss2d::Object::NULL_STR_GENERAL = "None"
staticconstexprinherited

Definition at line 46 of file object.h.

◆ PY_NAMESPACE_SEPARATOR

constexpr std::string_view lsst::gauss2d::Object::PY_NAMESPACE_SEPARATOR = "."
staticconstexprinherited

Definition at line 47 of file object.h.


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