ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhinfo.c
(Generate patch)

Comparing ray/src/hd/rhinfo.c (file contents):
Revision 3.14 by greg, Fri Oct 5 19:19:16 2018 UTC vs.
Revision 3.16 by greg, Wed Dec 20 23:09:34 2023 UTC

# Line 52 | Line 52 | gethdinfo(             /* get information on holodeck */
52          off_t   nextloc, fsiz;
53          int     n;
54                                          /* open holodeck file */
55 <        if ((fp = fopen(fname, "r")) == NULL) {
55 >        if ((fp = fopen(fname, "rb")) == NULL) {
56                  sprintf(errmsg, "cannot open \"%s\"", fname);
57                  error(SYSTEM, errmsg);
58          }
# Line 95 | Line 95 | psectstats(            /* print statistical information for sect
95          int     scount[NHBINS];
96          int     minsamp = 10000, maxsamp = 0;
97          FVECT   vt;
98 <        double  sqrtmaxp;
98 >        double  sqrtmaxp, median;
99          int     bmin, bmax, cnt;
100          int     i;
101  
# Line 119 | Line 119 | psectstats(            /* print statistical information for sect
119          for (i = NHBINS; i--; )
120                  scount[i] = 0;
121          for (i = nbeams(hp); i > 0; i--)
122 <                scount[(int)(NHBINS*sqrt((double)hp->bi[i].nrd)/sqrtmaxp)]++;
123 <        for (cnt = 0, i = 0; i < NHBINS && cnt<<1 < nbeams(hp); i++)
122 >                scount[(int)((NHBINS-FTINY)*sqrt((double)hp->bi[i].nrd)/sqrtmaxp)]++;
123 >        for (cnt = i = 0; i < NHBINS && cnt<<1 < nbeams(hp); i++)
124                  cnt += scount[i];
125 +        median = (i-.5)*(i-.5)*(maxsamp+1)*(1./(NHBINS*NHBINS));
126 +        if (median < minsamp) median = minsamp;
127          fprintf(fp, "\tSamples per beam:        [min,med,max]= [%d,%.0f,%d]\n",
128 <                        minsamp,
127 <                        (i-.5)*(i-.5)*(maxsamp+1)/(NHBINS*NHBINS),
128 <                        maxsamp);
128 >                        minsamp, median, maxsamp);
129          fprintf(fp, "\tHistogram: [minsamp,maxsamp)= #beams\n");
130          bmax = 0;
131          for (i = 0; i < NHBINS; i++) {
132                  bmin = bmax;
133 <                bmax = (i+1)*(i+1)*(maxsamp+1)/(NHBINS*NHBINS);
133 >                bmax = (i+1)*(i+1)*(maxsamp+1)*(1./(NHBINS*NHBINS));
134                  fprintf(fp, "\t\t[%d,%d)= %d\n", bmin, bmax, scount[i]);
135          }
136   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines