LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
lsst::gauss2d Namespace Reference

Namespaces

namespace  detail
 
namespace  fit
 
namespace  python
 
namespace  utils
 

Classes

class  Centroid
 A 2D coordinate representing the center of a plane figure. More...
 
class  CentroidData
 Interface for an object storing Centroid data. More...
 
class  CentroidValues
 A CentroidData storing centroid values as shared_ptrs. More...
 
class  ConvolvedGaussian
 A convolution of a Gaussian source and kernel. More...
 
class  ConvolvedGaussians
 A collection of ConvolvedGaussian objects. More...
 
class  CoordinateSystem
 A coordinate system specifying image scale and orientation. More...
 
class  Covariance
 A representation of a 2D Gaussian with x and y standard deviations and a covariance value. More...
 
class  Ellipse
 An Ellipse with sigma_x, sigma_y, and rho values. More...
 
class  EllipseData
 Interface for an object storing Ellipse data. More...
 
class  EllipseMajor
 An Ellipse with r_major, axrat and angle values. More...
 
class  EllipseValues
 An EllipseData storing sigma_x, sigma_y, rho values as shared_ptrs. More...
 
class  Gaussian
 A 2D Gaussian with a Centroid, Ellipse, and integral. More...
 
class  GaussianEvaluator
 A class that evaluates 2D Gaussians and renders them in images. More...
 
class  GaussianIntegral
 Interface for the normalization (total integrated value) of a 2D Gaussian. More...
 
class  GaussianIntegralValue
 A GaussianIntegral storing a float value. More...
 
class  Gaussians
 An array of Gaussian objects. More...
 
class  Image
 A 2D image with scalar numeric values, using CRTP. More...
 
class  ImageArray
 An array of compatible Images. More...
 
class  Object
 A generic object from the gauss2d library. More...
 
class  VectorImage
 

Typedefs

typedef size_t idx_type
 

Enumerations

enum class  BackgroundType : unsigned char { none = 0 , constant = 1 }
 
enum class  OutputType : unsigned char { none = 0 , overwrite = 1 , add = 2 }
 
enum class  GradientType : unsigned char { none = 0 , loglike = 1 , jacobian = 2 }
 

Functions

template<typename T , class Data , class Indices >
std::shared_ptr< Data > make_gaussians_pixel (const std::shared_ptr< const ConvolvedGaussians > gaussians, std::shared_ptr< Data > output=nullptr, const unsigned int n_rows=0, const unsigned int n_cols=0, const std::shared_ptr< const CoordinateSystem > coordsys=nullptr, bool to_add=false)
 Add gaussians to an image, creating one if needed.
 
template<typename T1 , class C1 , typename T2 , class C2 >
bool images_compatible (const Image< T1, C1 > &img1, const Image< T2, C2 > &img2, bool compare_coordsys=true, std::string *msg=nullptr)
 Return if two images are compatible.
 
template<typename T >
std::string repr_ptr (T ptr, bool name_keywords, std::string_view namespace_separator)
 
template<typename T >
std::string repr_iter_ptr (const T &container, bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR)
 
template<bool is_wrapper, typename T >
std::string repr_iter_ref (const T &container, bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR)
 
template<bool is_wrapper, typename T >
std::string repr_map_ref (const T &container, bool name_keywords=false, std::string_view namespace_separator=Object::CC_NAMESPACE_SEPARATOR)
 
template<typename T >
std::string str_ptr (T ptr)
 
template<typename T >
std::string str_iter_ptr (const T &container)
 
template<bool is_wrapper, typename T >
std::string str_iter_ref (const T &container)
 
template<bool is_wrapper, typename T >
std::string str_map_ref (const T &container)
 
template<typename T >
void stream_iter_ref (const T &container, std::ostream &stream)
 
template<typename T , typename R >
std::string replace_all (std::string target, T token, R replacement)
 Replace a token inside a target string with another string.
 
template<typename T >
std::string replace_all_none (std::string target, T token)
 Replace a token inside a target string with nothing.
 
template std::string replace_all< const std::string, const std::string > (std::string target, const std::string token, const std::string replacement)
 
template std::string replace_all< std::string_view, const std::string > (std::string target, std::string_view token, const std::string replacement)
 
template std::string replace_all< const std::string, std::string_view > (std::string target, const std::string token, std::string_view replacement)
 
template std::string replace_all< std::string_view, std::string_view > (std::string target, std::string_view token, std::string_view replacement)
 
template std::string replace_all_none< const std::string > (std::string target, const std::string token)
 
template std::string replace_all_none< std::string_view > (std::string target, std::string_view token)
 
template<typename T >
std::string to_string_float (const T value, const int precision=6, const bool scientific=true)
 
template<template< typename... > class Container, class Value >
std::string to_string_float_iter (const Container< Value > &container, const int precision=6, const bool scientific=true)
 
template<template< typename... > class Container, class Value >
std::string to_string_iter (const Container< Value > &container)
 
template<typename T >
constexpr std::string_view type_name ()
 Get a string representation of an arbitrary C++ type.
 
template<>
constexpr std::string_view type_name< void > ()
 
template<typename T >
std::string type_name_str (bool strip_namespace=false, std::string_view namespace_str=detail::NAMESPACE_SEPARATOR)
 Get a string representation of an arbitrary C++ type, potentially modifying its namespace prefix.
 
template<class S >
std::pair< S, S > sincos (S arg)
 
std::ostreamoperator<< (std::ostream &out, const Covariance &obj)
 
std::pair< double, double > get_x_pm (double sigma_x_sq, double sigma_y_sq, double cov_xy)
 
void init (EllipseMajor &ellipse, const Covariance &covar, bool degrees)
 
std::ostreamoperator<< (std::ostream &out, const Gaussian &g)
 

Variables

const double M_HWHM_SIGMA = 1.1774100225154746910115693264599
 
const double M_SIGMA_HWHM = 0.84932180028801904272150283410295
 
const double M_PI_180 = M_PI / 180.
 
const double M_180_PI = 180. / M_PI
 
const size_t N_EXTRA_MAP = 2
 
const size_t N_EXTRA_FACTOR = 3
 
const size_t N_PARAMS_GAUSS2D = 6
 

Typedef Documentation

◆ idx_type

typedef size_t lsst::gauss2d::idx_type

Definition at line 43 of file image.h.

Enumeration Type Documentation

◆ BackgroundType

enum class lsst::gauss2d::BackgroundType : unsigned char
strong
Enumerator
none 
constant 

Definition at line 44 of file evaluate.h.

44 : unsigned char {
45 none = 0,
46 constant = 1,
47};

◆ GradientType

enum class lsst::gauss2d::GradientType : unsigned char
strong
Enumerator
none 
loglike 
jacobian 

Definition at line 53 of file evaluate.h.

53 : unsigned char {
54 none = 0,
55 loglike = 1,
56 jacobian = 2,
57};

◆ OutputType

enum class lsst::gauss2d::OutputType : unsigned char
strong
Enumerator
none 
overwrite 
add 

Definition at line 48 of file evaluate.h.

48 : unsigned char {
49 none = 0,
50 overwrite = 1,
51 add = 2,
52};

Function Documentation

◆ get_x_pm()

std::pair< double, double > lsst::gauss2d::get_x_pm ( double sigma_x_sq,
double sigma_y_sq,
double cov_xy )

Definition at line 327 of file ellipse.cc.

327 {
328 double apc = sigma_x_sq + sigma_y_sq;
329 double x = apc / 2;
330 // TODO: Write tests for this with inputs returning close to zero
331 // Probably most efficient but unstable, e.g.:
332 // sigma_x, sigma_y, rho = 1.58113883008419, 1.5811388300841895, 0
333 // ... yields -3.552713678800501e-15 inside the sqrt
334 // double pm = sqrt(apc*apc - 4*(sigma_x_sq*sigma_y_sq - cov_xy*cov_xy))/2;
335 // Two more multiplications, but seemingly more stable
336 // Cancels out cross term from apc (2*sigma_x_sq*sigma_y_sq)
337 double pm = (sigma_x_sq * sigma_x_sq + sigma_y_sq * sigma_y_sq
338 - 2 * (sigma_x_sq * sigma_y_sq - 2 * cov_xy * cov_xy));
339 // Return zero if the result is negative
340 // TODO: Consider checking if < -machine_eps?
341 pm = (pm > 0) ? sqrt(pm) / 2 : 0;
342 return {x, pm};
343}

◆ images_compatible()

template<typename T1 , class C1 , typename T2 , class C2 >
bool lsst::gauss2d::images_compatible ( const Image< T1, C1 > & img1,
const Image< T2, C2 > & img2,
bool compare_coordsys = true,
std::string * msg = nullptr )

Return if two images are compatible.

Compatible means that they have the same dimensions in both axes and equivalent coordinate systems.

Template Parameters
T1The data type of C1.
C1The class of the first Image.
T2The data type of C2.
C2The class of the second Image.
Parameters
img1The first image.
img2The second image.
msgA string to append error messages to, if not null.
Returns
true If images are compatible.

Definition at line 70 of file image.h.

71 {
72 bool coordsys_equal = !compare_coordsys || (img1.get_coordsys() == img2.get_coordsys());
73 bool return_msg = msg != nullptr;
74 if (!return_msg && !coordsys_equal) return false;
75 bool cols_equal = img1.get_n_cols() == img2.get_n_cols();
76 bool rows_equal = img1.get_n_rows() == img2.get_n_rows();
77 bool passed = coordsys_equal && cols_equal && rows_equal;
78 if (!passed) {
79 if (return_msg) {
80 if (!coordsys_equal) {
81 *msg += img1.get_coordsys().str() + "!=" + img2.get_coordsys().str() + ",";
82 }
83 if (!cols_equal) {
84 *msg += std::to_string(img1.get_n_cols()) + "!=" + std::to_string(img2.get_n_cols()) + ",";
85 }
86 if (!rows_equal) {
87 *msg += std::to_string(img1.get_n_rows()) + "!=" + std::to_string(img2.get_n_rows());
88 }
89 }
90 return false;
91 }
92 return true;
93}
std::string str() const override
Return a brief, human-readable string representation of this.
const CoordinateSystem & get_coordsys() const
Definition image.h:142
size_t get_n_rows() const
Definition image.h:147
size_t get_n_cols() const
Definition image.h:145
T to_string(T... args)

◆ init()

void lsst::gauss2d::init ( EllipseMajor & ellipse,
const Covariance & covar,
bool degrees )

Definition at line 345 of file ellipse.cc.

345 {
346 double sigma_x_sq = covar.get_sigma_x_sq();
347 double sigma_y_sq = covar.get_sigma_y_sq();
348 if (sigma_x_sq == 0 && sigma_y_sq == 0) return;
349 double cov_xy = covar.get_cov_xy();
350 auto [x, pm] = get_x_pm(sigma_x_sq, sigma_y_sq, cov_xy);
351 double r_major = x + pm;
352 if (r_major == 0) return;
353
354 double axrat = sqrt((x - pm) / r_major);
355 r_major = sqrt(r_major);
356 double ang = atan2(2 * cov_xy, sigma_x_sq - sigma_y_sq) / 2;
357 if (degrees) ang *= M_180_PI;
358 ellipse.set(r_major, axrat, ang);
359}
double get_cov_xy() const
Get the covariance.
Definition ellipse.h:79
double get_sigma_x_sq() const
Get the square of sigma_x.
Definition ellipse.h:75
double get_sigma_y_sq() const
Get the square of sigma_y.
Definition ellipse.h:77
void set(double r_major, double axrat, double angle)
Definition ellipse.cc:374
const double M_180_PI
Definition ellipse.h:41
std::pair< double, double > get_x_pm(double sigma_x_sq, double sigma_y_sq, double cov_xy)
Definition ellipse.cc:327

◆ make_gaussians_pixel()

template<typename T , class Data , class Indices >
std::shared_ptr< Data > lsst::gauss2d::make_gaussians_pixel ( const std::shared_ptr< const ConvolvedGaussians > gaussians,
std::shared_ptr< Data > output = nullptr,
const unsigned int n_rows = 0,
const unsigned int n_cols = 0,
const std::shared_ptr< const CoordinateSystem > coordsys = nullptr,
bool to_add = false )

Add gaussians to an image, creating one if needed.

Template Parameters
tThe data type (e.g. float, int)
DataThe data array class
IndicesThe index array class (usually a size_t array)
Parameters
gaussiansThe gaussians to add
outputThe image to add gaussians to. If null, it will be initialized
n_rowsThe number of rows, if creating a new image
n_colsThe number of columns, if creating a new image
coordsysThe image's coordinate system
to_addWhether to add to an existing image. throws if output is nullptr.
Returns
std::shared_ptr<Data> The output pointer, assigned if originally null

Definition at line 1233 of file evaluate.h.

1237 {
1238 if (output == nullptr) {
1239 if (to_add) {
1240 throw std::invalid_argument("Cannot set to_add if output is nullptr");
1241 }
1242 output = std::make_shared<Data>(n_rows, n_cols, nullptr, coordsys);
1243 }
1244 auto evaluator
1245 = std::make_unique<GaussianEvaluator<T, Data, Indices>>(gaussians, nullptr, nullptr, output);
1246 evaluator->loglike_pixel(to_add);
1247 return output;
1248}

◆ operator<<() [1/2]

std::ostream & lsst::gauss2d::operator<< ( std::ostream & out,
const Covariance & obj )

Definition at line 137 of file ellipse.cc.

137 {
138 out << obj.str();
139 return out;
140}

◆ operator<<() [2/2]

std::ostream & lsst::gauss2d::operator<< ( std::ostream & out,
const Gaussian & g )

Definition at line 103 of file gaussian.cc.

103 {
104 out << g.str();
105 return out;
106}

◆ replace_all()

template<typename T , typename R >
std::string lsst::gauss2d::replace_all ( std::string target,
T token,
R replacement )

Replace a token inside a target string with another string.

Parameters
targetThe string to replace and return.
tokenThe token to replace.
replacementThe token to replace with.
Returns
The target with replacements, if any.

Definition at line 23 of file string_utils.h.

23 {
24 auto pos = target.find(token, 0);
25 const auto n_token = token.size();
26 const auto n_replace = replacement.size();
27 while (pos != std::string::npos) {
28 target.replace(pos, n_token, replacement);
29 pos += n_replace;
30 pos = target.find(token, pos);
31 }
32 return target;
33}
Key< Flag > const & target

◆ replace_all< const std::string, const std::string >()

template std::string lsst::gauss2d::replace_all< const std::string, const std::string > ( std::string target,
const std::string token,
const std::string replacement )

◆ replace_all< const std::string, std::string_view >()

template std::string lsst::gauss2d::replace_all< const std::string, std::string_view > ( std::string target,
const std::string token,
std::string_view replacement )

◆ replace_all< std::string_view, const std::string >()

template std::string lsst::gauss2d::replace_all< std::string_view, const std::string > ( std::string target,
std::string_view token,
const std::string replacement )

◆ replace_all< std::string_view, std::string_view >()

template std::string lsst::gauss2d::replace_all< std::string_view, std::string_view > ( std::string target,
std::string_view token,
std::string_view replacement )

◆ replace_all_none()

template<typename T >
std::string lsst::gauss2d::replace_all_none ( std::string target,
T token )

Replace a token inside a target string with nothing.

Parameters
targetThe string to replace and return.
tokenThe token to replace with an empty string.
Returns
The target with replacements, if any.

Definition at line 43 of file string_utils.h.

43 {
44 auto pos = target.find(token, 0);
45 const auto n_token = token.size();
46 while (pos != std::string::npos) {
47 target.replace(pos, n_token, "");
48 pos = target.find(token, pos);
49 }
50 return target;
51}

◆ replace_all_none< const std::string >()

◆ replace_all_none< std::string_view >()

template std::string lsst::gauss2d::replace_all_none< std::string_view > ( std::string target,
std::string_view token )

◆ repr_iter_ptr()

template<typename T >
std::string lsst::gauss2d::repr_iter_ptr ( const T & container,
bool name_keywords = false,
std::string_view namespace_separator = Object::CC_NAMESPACE_SEPARATOR )

Definition at line 88 of file object.h.

89 {
90 std::string str = "[";
91 for (auto &obj : container) {
92 str += repr_ptr(obj, name_keywords, namespace_separator) + ", ";
93 }
94 auto size_str = str.size();
95 if (size_str > 1) str = str.substr(0, size_str - 2);
96 return str + "]";
97}
std::string repr_ptr(T ptr, bool name_keywords, std::string_view namespace_separator)
Definition object.h:82
T size(T... args)

◆ repr_iter_ref()

template<bool is_wrapper, typename T >
std::string lsst::gauss2d::repr_iter_ref ( const T & container,
bool name_keywords = false,
std::string_view namespace_separator = Object::CC_NAMESPACE_SEPARATOR )

Definition at line 101 of file object.h.

102 {
103 std::string str = "[";
104 for (const auto &obj : container) {
105 if constexpr (is_wrapper) {
106 str += obj.get().repr(name_keywords, namespace_separator);
107 } else {
108 str += obj.repr(name_keywords, namespace_separator);
109 }
110 str += ", ";
111 }
112 auto size_str = str.size();
113 if (size_str > 1) str = str.substr(0, size_str - 2);
114 return str + "]";
115}

◆ repr_map_ref()

template<bool is_wrapper, typename T >
std::string lsst::gauss2d::repr_map_ref ( const T & container,
bool name_keywords = false,
std::string_view namespace_separator = Object::CC_NAMESPACE_SEPARATOR )

Definition at line 118 of file object.h.

119 {
120 std::string str = "{";
121 for (const auto &[obj, value] : container) {
122 if constexpr (is_wrapper) {
123 str += obj.get().repr(name_keywords, namespace_separator) + ": " + std::to_string(value) + ", ";
124 } else {
125 str += obj.repr(name_keywords, namespace_separator) + ": " + std::to_string(value) + ", ";
126 }
127 }
128 return str.substr(0, str.size() - 2 * (container.size() > 0)) + "}";
129}

◆ repr_ptr()

template<typename T >
std::string lsst::gauss2d::repr_ptr ( T ptr,
bool name_keywords,
std::string_view namespace_separator )

Definition at line 82 of file object.h.

82 {
83 return ptr ? ptr->repr(name_keywords, namespace_separator)
84 : std::string(Object::null_str(namespace_separator));
85}
std::uint64_t * ptr
Definition RangeSet.cc:95

◆ sincos()

template<class S >
std::pair< S, S > lsst::gauss2d::sincos ( S arg)

Definition at line 36 of file ellipse.cc.

36 {
37 return {std::sin(arg), std::cos(arg)};
38}
T cos(T... args)
T sin(T... args)

◆ str_iter_ptr()

template<typename T >
std::string lsst::gauss2d::str_iter_ptr ( const T & container)

Definition at line 137 of file object.h.

137 {
138 std::string str = "[";
139 for (const auto &obj : container) {
140 str += str_ptr(obj) + ", ";
141 }
142 auto size_str = str.size();
143 if (size_str > 1) str = str.substr(0, size_str - 2);
144 return str + "]";
145}
std::string str_ptr(T ptr)
Definition object.h:132

◆ str_iter_ref()

template<bool is_wrapper, typename T >
std::string lsst::gauss2d::str_iter_ref ( const T & container)

Definition at line 148 of file object.h.

148 {
149 std::string str = "[";
150 for (const auto &obj : container) {
151 if constexpr (is_wrapper) {
152 str += obj.get().str();
153 } else {
154 str += obj.str();
155 }
156 str += ", ";
157 }
158 auto size_str = str.size();
159 if (size_str > 1) str = str.substr(0, size_str - 2);
160 return str + "]";
161}

◆ str_map_ref()

template<bool is_wrapper, typename T >
std::string lsst::gauss2d::str_map_ref ( const T & container)

Definition at line 164 of file object.h.

164 {
165 std::string str = "{";
166 for (const auto &[obj, value] : container) {
167 if constexpr (is_wrapper) {
168 str += obj.get().str() + ": " + std::to_string(value) + ", ";
169 } else {
170 str += obj.str() + ": " + std::to_string(value) + ", ";
171 }
172 }
173 return str.substr(0, str.size() - 2 * (container.size() > 0)) + "}";
174}

◆ str_ptr()

template<typename T >
std::string lsst::gauss2d::str_ptr ( T ptr)

Definition at line 132 of file object.h.

132 {
133 return ptr ? ptr->str() : std::string(Object::NULL_STR_GENERAL);
134}

◆ stream_iter_ref()

template<typename T >
void lsst::gauss2d::stream_iter_ref ( const T & container,
std::ostream & stream )

Definition at line 177 of file object.h.

177 {
178 stream << "[";
179 for (const auto &obj : container) stream << obj << ",";
180 stream << "]";
181}

◆ to_string_float()

template<typename T >
std::string lsst::gauss2d::to_string_float ( const T value,
const int precision = 6,
const bool scientific = true )

Definition at line 15 of file to_string.h.

15 {
17 out.precision(precision);
18 if (scientific) {
19 out << std::scientific;
20 } else {
21 out << std::fixed;
22 }
23 out << value;
24 return std::move(out).str();
25}
T scientific(T... args)
T move(T... args)
T precision(T... args)

◆ to_string_float_iter()

template<template< typename... > class Container, class Value >
std::string lsst::gauss2d::to_string_float_iter ( const Container< Value > & container,
const int precision = 6,
const bool scientific = true )

Definition at line 28 of file to_string.h.

29 {
30 std::string str = "[";
31 for (const auto& value : container) {
32 str += to_string_float(value, precision, scientific) + ", ";
33 }
34 return str.substr(0, str.size() - 2 * (container.size() > 0)) + "]";
35}
std::string to_string_float(const T value, const int precision=6, const bool scientific=true)
Definition to_string.h:15
T substr(T... args)

◆ to_string_iter()

template<template< typename... > class Container, class Value >
std::string lsst::gauss2d::to_string_iter ( const Container< Value > & container)

Definition at line 38 of file to_string.h.

38 {
39 std::string str = "[";
40 for (const auto& value : container) {
41 str += std::to_string(value) + ", ";
42 }
43 return str.substr(0, str.size() - 2 * (container.size() > 0)) + "]";
44}

◆ type_name()

template<typename T >
constexpr std::string_view lsst::gauss2d::type_name ( )
constexpr

Get a string representation of an arbitrary C++ type.

Template Parameters
TThe type to stringify
Returns
A string representation of the type's name
Note
Adapted from https://stackoverflow.com/a/64490578

Definition at line 84 of file type_name.h.

84 {
85 constexpr auto wrapped_name = detail::wrapped_type_name<T>();
86 constexpr auto prefix_length = detail::wrapped_type_name_prefix_length();
87 constexpr auto suffix_length = detail::wrapped_type_name_suffix_length();
88 constexpr auto type_name_length = wrapped_name.length() - prefix_length - suffix_length;
89 return wrapped_name.substr(prefix_length, type_name_length);
90}

◆ type_name< void >()

template<>
constexpr std::string_view lsst::gauss2d::type_name< void > ( )
constexpr

Definition at line 39 of file type_name.h.

39 {
40 return "void";
41}

◆ type_name_str()

template<typename T >
std::string lsst::gauss2d::type_name_str ( bool strip_namespace = false,
std::string_view namespace_str = detail::NAMESPACE_SEPARATOR )

Get a string representation of an arbitrary C++ type, potentially modifying its namespace prefix.

Template Parameters
TThe type to stringify.
Parameters
strip_namespaceWhether to strip the namespace prefix entirely.
namespace_strA string to replace the standard C++ namespace separator (i.e. ::) with; generally . for Python.
Returns
A string representation of the type's name, with modified namespace prefix.

Definition at line 104 of file type_name.h.

105 {
106 std::string name = std::string(type_name<T>());
107 if (strip_namespace) {
108 // Find the first template specifier (if any), then find the last colon
109 auto prefix = name.substr(0, name.find_first_of('<'));
110 return name.substr(prefix.find_last_of(':') + 1, std::string::npos);
111 } else if (namespace_str != detail::NAMESPACE_SEPARATOR) {
112 name = replace_all(name, detail::NAMESPACE_SEPARATOR, namespace_str);
113 }
114 return name;
115}
table::Key< std::string > name
Definition Amplifier.cc:116
std::string prefix
T find_last_of(T... args)

Variable Documentation

◆ M_180_PI

const double lsst::gauss2d::M_180_PI = 180. / M_PI

Definition at line 41 of file ellipse.h.

◆ M_HWHM_SIGMA

const double lsst::gauss2d::M_HWHM_SIGMA = 1.1774100225154746910115693264599

Definition at line 38 of file ellipse.h.

◆ M_PI_180

const double lsst::gauss2d::M_PI_180 = M_PI / 180.

Definition at line 40 of file ellipse.h.

◆ M_SIGMA_HWHM

const double lsst::gauss2d::M_SIGMA_HWHM = 0.84932180028801904272150283410295

Definition at line 39 of file ellipse.h.

◆ N_EXTRA_FACTOR

const size_t lsst::gauss2d::N_EXTRA_FACTOR = 3

Definition at line 60 of file evaluate.h.

◆ N_EXTRA_MAP

const size_t lsst::gauss2d::N_EXTRA_MAP = 2

Definition at line 59 of file evaluate.h.

◆ N_PARAMS_GAUSS2D

const size_t lsst::gauss2d::N_PARAMS_GAUSS2D = 6

Definition at line 61 of file evaluate.h.