Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 220 → Rev 221

/cvi/instr/HISTO/H2D.c
118,8 → 118,8
h2[h2d]->minx = minx;
h2[h2d]->miny = miny;
h2[h2d]->stepx = (nx>1)?(maxx-minx)/(nx-1):0;
h2[h2d]->stepy = (nx>1)?(maxy-miny)/(ny-1):0;
h2[h2d]->stepx = (nx>0)?(maxx-minx)/(nx):0;
h2[h2d]->stepy = (nx>0)?(maxy-miny)/(ny):0;
h2[h2d]->size = h2[h2d]->nx*h2[h2d]->ny*sizeof(double);
h2[h2d]->data = (double *) malloc(h2[h2d]->size);
131,11 → 131,11
}
 
double _VI_FUNC H2D_GetXBinCenter(int h2d,int xbin) {
return h2[h2d]->minx+xbin*h2[h2d]->stepx;
return h2[h2d]->minx+(xbin+0.5)*h2[h2d]->stepx;
}
 
double _VI_FUNC H2D_GetYBinCenter(int h2d,int ybin) {
return h2[h2d]->miny+ybin*h2[h2d]->stepy;
return h2[h2d]->miny+(ybin+0.5)*h2[h2d]->stepy;
}
 
int _VI_FUNC H2D_Write2File(int h2d,FILE *fp) {
292,9 → 292,9
H2D_GetNbinsY(histogram),
VAL_DOUBLE,
H2D_GetStepY(histogram),
H2D_GetMinY(histogram),
H2D_GetYBinCenter(histogram,0),
H2D_GetStepX(histogram),
H2D_GetMinX(histogram),
H2D_GetXBinCenter(histogram,0),
colormap->array,
colormap->HiColor,
colormap->numberofColors, 1, 0);
/cvi/instr/HISTO/H3D.c
146,9 → 146,9
h3[h3d]->miny = miny;
h3[h3d]->minz = minz;
 
h3[h3d]->stepx = (nx>1)?(maxx-minx)/(nx-1):0;
h3[h3d]->stepy = (nx>1)?(maxy-miny)/(ny-1):0;
h3[h3d]->stepz = (nx>1)?(maxz-minz)/(nz-1):0;
h3[h3d]->stepx = (nx>1)?(maxx-minx)/(nx):0;
h3[h3d]->stepy = (nx>1)?(maxy-miny)/(ny):0;
h3[h3d]->stepz = (nx>1)?(maxz-minz)/(nz):0;
 
h3[h3d]->size = h3[h3d]->nx*h3[h3d]->ny*h3[h3d]->nz*sizeof(double);
h3[h3d]->data = (double *) malloc(h3[h3d]->size);
204,27 → 204,27
}
 
double _VI_FUNC H3D_GetMaxX(int h){
return h3[h]->minx+(h3[h]->nx-1)*h3[h]->stepx;
return h3[h]->minx+(h3[h]->nx)*h3[h]->stepx;
}
 
double _VI_FUNC H3D_GetMaxY(int h){
return h3[h]->miny+(h3[h]->ny-1)*h3[h]->stepy;
return h3[h]->miny+(h3[h]->ny)*h3[h]->stepy;
}
 
double _VI_FUNC H3D_GetMaxZ(int h){
return h3[h]->minz+(h3[h]->nz-1)*h3[h]->stepz;
return h3[h]->minz+(h3[h]->nz)*h3[h]->stepz;
}
 
double _VI_FUNC H3D_GetXBinCenter(int h3d,int xbin) {
return h3[h3d]->minx+xbin*h3[h3d]->stepx;
return h3[h3d]->minx+(xbin+0.5)*h3[h3d]->stepx;
}
 
double _VI_FUNC H3D_GetYBinCenter(int h3d,int ybin) {
return h3[h3d]->miny+ybin*h3[h3d]->stepy;
return h3[h3d]->miny+(ybin+0.5)*h3[h3d]->stepy;
}
 
double _VI_FUNC H3D_GetZBinCenter(int h3d,int zbin) {
return h3[h3d]->minz+zbin*h3[h3d]->stepz;
return h3[h3d]->minz+(zbin+0.5)*h3[h3d]->stepz;
}
 
 
392,10 → 392,10
if (H3D_GetNbinsY(histogram)==1|| H3D_GetNbinsX(histogram)==1) {
if (H3D_GetNbinsY(histogram)==1) {
H1D_Init(499,"projection","projection", H3D_GetNbinsX(histogram), H3D_GetMinX(histogram),H3D_GetStepX(histogram));
H1D_Init(499,"projection","projection", H3D_GetNbinsX(histogram), H3D_GetMinX(histogram),H3D_GetMaxX(histogram));
for (int i=0; i < H3D_GetNbinsX(histogram); i++ ) H1D_SetBinContent(499,i,H3D_GetBinContent(histogram,i,0,slice));
} else {
H1D_Init(499,"projection","projection", H3D_GetNbinsY(histogram), H3D_GetMinY(histogram),H3D_GetStepY(histogram));
H1D_Init(499,"projection","projection", H3D_GetNbinsY(histogram), H3D_GetMinY(histogram),H3D_GetMaxY(histogram));
for (int i=0; i < H3D_GetNbinsY(histogram); i++ ) H1D_SetBinContent(499,i,H3D_GetBinContent(histogram,0,i,slice));
}
H1D_Draw(499, panel, control, plothandle);
409,9 → 409,9
H3D_GetNbinsY(histogram),
VAL_DOUBLE,
H3D_GetStepY(histogram),
H3D_GetMinY(histogram),
H3D_GetYBinCenter(histogram,0),
H3D_GetStepX(histogram),
H3D_GetMinX(histogram),
H3D_GetXBinCenter(histogram,0),
colormap->array,
colormap->HiColor,
colormap->numberofColors, 1, 0);