Skip to content
Snippets Groups Projects
Commit b73a6b86 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

AM_MAINTAINER_MODE([disable]) # work around rebuild rules

parent 534f3500
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign]) # don't insert GNU blala files
AM_MAINTAINER_MODE([disable]) # work around rebuild rules
################################################################################
## Select compiler and preprocessors ##
......
......@@ -1164,33 +1164,33 @@ void NManip::Interpolate()
//* Histogramming *//
//****************************************************************************//
//! Create and fill histograms based on y values.
//! Create and fill histograms based on x values and their y weights.
void NManip::HistoMake()
{
// Determine range:
double ymin=0, ymax=0; // initialized to prevent warning
double xmin=0, xmax=0; // initialized to prevent warning
int npts = 0;
NOlm::IterateD fiter;
while ( POld fin = fiter() ) {
for ( int j=0; j<fin->nJ(); j++ ) {
PSpec sin = fin ->VS(j);
for ( int i=0; i<sin->size(); i++ ) {
double y = sin->y[i];
double x = sin->x[i];
if ( !npts ) {
ymin = y;
ymax = y;
} else if ( y<ymin ) {
ymin = y;
} else if ( y>ymax ) {
ymax = y;
xmin = x;
xmax = x;
} else if ( x<xmin ) {
xmin = x;
} else if ( x>xmax ) {
xmax = x;
}
++npts;
}
}
}
cout << "there are " << npts << " points extending from " << ymin <<
" to " << ymax << "\n";
cout << "there are " << npts << " points extending from " << xmin <<
" to " << xmax << "\n";
// Obtain number of bins:
static int nbin = 32;
......@@ -1202,9 +1202,9 @@ void NManip::HistoMake()
// Set output grid:
vector<double> xout(nbin);
double dx = (ymax-ymin)/(nbin-1);
double dx = (xmax-xmin)/(nbin-1);
for ( int i=0; i<nbin; ++i )
xout[i] = ymin + dx*i;
xout[i] = xmin + dx*i;
// Create and fill output histograms:
fiter.reset();
......@@ -1218,12 +1218,11 @@ void NManip::HistoMake()
sout->copy_z_base( sin );
sout->x = xout;
sout->y = vector<double>(nbin, 0.);
const vector<double>& y = sin->y;
for ( int i=0; i<y.size(); ++i ) {
int iout = lrint( floor((y[i]-ymin)/dx+0.5 ) );
for ( int i=0; i<sin->size(); ++i ) {
int iout = lrint( floor((sin->x[i]-xmin)/dx+0.5 ) );
if ( iout<0 || iout>=nbin )
throw "BUG: invalid iout="+S(iout)+" for y="+S(y[i]);
sout->y[iout] += 1;
throw "BUG: invalid iout="+S(iout)+" for y="+S(sin->x[i]);
sout->y[iout] += sin->y[i];
}
fout->V.push_back(sout);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment