1 #ifndef NPSTAT_ABSMARGINALSMOOTHERBASE_HH_
2 #define NPSTAT_ABSMARGINALSMOOTHERBASE_HH_
18 #include "geners/AbsArchive.hh"
23 #include "npstat/wrap/arrayNDToNumpy.hh"
24 #include "npstat/wrap/histoBinCoords.hh"
33 const char* axisLabel = 0);
37 void setAxisLabel(
const char* axisLabel);
41 inline unsigned nBins()
const {
return nbins_;}
42 inline double xMin()
const {
return xmin_;}
43 inline double xMax()
const {
return xmax_;}
44 inline double binWidth()
const {
return (xmax_ - xmin_)/nbins_;}
45 inline const std::string& getAxisLabel()
const {
return axlabel_;}
46 inline gs::AbsArchive* getArchive()
const {
return ar_;}
47 inline const std::string& getArchiveCategory()
const
58 void setArchive(gs::AbsArchive* ar,
const char* category = 0);
68 template <
typename Numeric>
70 const std::vector<Numeric>& inputPoints,
71 double minValue = -std::numeric_limits<double>::max(),
72 double maxValue = std::numeric_limits<double>::max(),
73 double* bandwidthUsed = 0);
83 template <
typename Numeric>
85 unsigned long uniqueId,
unsigned dimNumber,
86 const std::vector<Numeric>& inputPoints,
87 double minValue = -std::numeric_limits<double>::max(),
88 double maxValue = std::numeric_limits<double>::max(),
89 double* bandwidthUsed = 0);
96 template <
typename Numeric>
98 const std::vector<std::pair<Numeric,double> >& inputPoints,
99 double minValue = -std::numeric_limits<double>::max(),
100 double maxValue = std::numeric_limits<double>::max(),
101 double* bandwidthUsed = 0);
111 template <
typename Numeric>
113 unsigned long uniqueId,
unsigned multivariatePointDimNumber,
114 const std::vector<std::pair<Numeric,double> >& inputPoints,
115 double minValue = -std::numeric_limits<double>::max(),
116 double maxValue = std::numeric_limits<double>::max(),
117 double* bandwidthUsed = 0);
125 void storeHisto(
unsigned long uniqueId,
unsigned dim,
double bw)
const;
129 double effectiveSampleSize,
130 double* bandwidthUsed,
131 bool isSampleWeighted) = 0;
137 std::string category_;
138 std::string axlabel_;
148 x = histoBinCenters(h.
axis(0));
151 catch (
const std::exception& e)
157 return Py_BuildValue(
"(OOd)", x, array, lastBw_);
162 template <
typename Vec>
163 inline PyObject* smooth2(
const Vec& inputPoints)
165 const HistoND<double>& h =
smooth(inputPoints);
166 return buildResultFromHisto(h);
170 template <
typename Vec>
171 inline PyObject* smoothArch(
172 const Vec& inputPoints,
unsigned long uniqueId,
unsigned dimNumber)
174 if (!ar_)
throw std::runtime_error(
175 "In npstat::AbsMarginalSmootherBase::smoothArch: "
176 "archive is not set");
177 const HistoND<double>& h =
smooth(uniqueId, dimNumber, inputPoints);
178 return buildResultFromHisto(h);
182 template <
typename Vec>
183 inline PyObject* weightedSmooth2(
const Vec& inputPoints)
186 return buildResultFromHisto(h);
190 template <
typename Vec>
191 inline PyObject* weightedSmoothArch(
192 const Vec& inputPoints,
unsigned long uniqueId,
unsigned dimNumber)
194 if (!ar_)
throw std::runtime_error(
195 "In npstat::AbsMarginalSmootherBase::weightedSmoothArch: "
196 "archive is not set");
197 const HistoND<double>& h =
weightedSmooth(uniqueId, dimNumber, inputPoints);
198 return buildResultFromHisto(h);
204 #include "npstat/stat/AbsMarginalSmootherBase.icc"
Arbitrary-dimensional histogram template.
Definition: AbsMarginalSmootherBase.hh:29
const HistoND< double > & smooth(const std::vector< Numeric > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
unsigned nBins() const
Definition: AbsMarginalSmootherBase.hh:41
double lastBandwidth() const
Definition: AbsMarginalSmootherBase.hh:55
const HistoND< double > & smooth(unsigned long uniqueId, unsigned dimNumber, const std::vector< Numeric > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
void unsetArchive()
Definition: AbsMarginalSmootherBase.hh:61
AbsMarginalSmootherBase(unsigned nbins, double xmin, double xmax, const char *axisLabel=0)
const HistoND< double > & weightedSmooth(unsigned long uniqueId, unsigned multivariatePointDimNumber, const std::vector< std::pair< Numeric, double > > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
void setArchive(gs::AbsArchive *ar, const char *category=0)
const HistoND< double > & weightedSmooth(const std::vector< std::pair< Numeric, double > > &inputPoints, double minValue=-std::numeric_limits< double >::max(), double maxValue=std::numeric_limits< double >::max(), double *bandwidthUsed=0)
const Axis & axis(const unsigned i) const
Definition: HistoND.hh:222
const ArrayND< Numeric > & binContents() const
Definition: HistoND.hh:197
Definition: AbsArrayProjector.hh:14