functions in histo.i -
_histo_sum
|
n= _histo_sum(data, x, order, hx, h0, h1, h2); Worker for histo_stat routine: sum moments of response DATA with respect to explanatory variable X. See documentation of histo_stat for further explanations and description of keywords. Return number of elements in output arrays (if N=0, outputs can be discarded...). ARGUMENTS: DATA -> Response data to average. X -> Value of explanatory variable for each data measurement (same geometry as DATA). HX <- Value of X in each bin. H0 <- Sum of WEIGHT in each bin. H1 <- Sum of WEIGHT*DATA in each bin. H2 <- Sum of WEIGHT*DATA^2 in each bin. H3 <- Sum of WEIGHT*WEIGHT in each bin. ORDER-> 0 to compute only HX and H0, >=1 to also compute H1 >=2 to also compute H2 >=3 to also compute H3. KEYWORDS: binsize, xmin, xmax, weight, interp. | |
SEE ALSO: | histo_stat, histogram, digitize |
histo2
|
hy= histo2(data, hx); Returns histogram of DATA, the histogram abscissae get stored into pure output HX (don't forget to declare it as `local', unless you don't care of side effects). The size of the bins can be given by keyword BINSIZE (default 1.0). The minimum and maximum abscissae to consider can specified with keywords BINMIN and BINMAX. Keyword WEIGHT gives data point weights (default all 1). If keyword INTERP is set with a non-zero value, linear interpolation is used to get the weights of the data points to each bin. If keyword AVERAGE is set with a non-zero value, returns an average rather than a sum of the weithed data points. Note that with no weights or uniform weights, the average value will be an array of 1's (now you know!). Averaging is useful for instance to compute the radial profile (average along azimuth direction): x= indgen(xdim)-x0; // abscissa y= indgen(ydim)-y0; // ordinate r= abs(x, y(-,)); // radius a= exp(-r*r/50.0)+(random(xdim, ydim) - 0.5)/10.0; local px; py= histo2(r, px, weight=a, average=1, interp=1); plg, py, px, color="red"; plg, exp(-px*px/50.0), px, color="green"; You can call histo2 one more time to compute the sample noise: py_sigma= sqrt(histo2(r, weight=a*a, average=1, interp=1) - py*py); | |
SEE ALSO: | histogram |
histo_plot
|
histo_plot, data; Compute (with histo2) an histogram of DATA and plot it (with plh). All keywords of plh and histo2 can be used. Further keywords PRENORMALIZE and POSTNORMALIZE can be used to normalize the histogram so that its sum is equal to PRE/POSTNORMALIZE: normalization to PRENORMALIZE (POSTNORMALIZE) is performed *BEFORE* (respectively *AFTER*) data values less than BINMIN or greater than BINMAX have been rejected. Keyword SCALE can be used to multiply ordinates of histogram by SCALE (default SCALE=1); this is useful to compare histograms of the same data set with different BINSIZE. KEYWORDS: weight, binsize, binmin, binmax, interp, average, just, legend, hide, type, width, color, marks, marker, mspace, mphase, prenormalize, postnormalize, scale. | |
SEE ALSO: | histo2, plh |
histo_stat
|
hs= histo_stat(data, x); Compute statistics of response DATA with respect to explanatory variable X. DATA measurements are grouped in bins by rounding X to the nearest integer multiple of BINSIZE and the statistical moments are computed whithin each bin. If you need unevenly spaced bins, you may either operate a change of explicit variable or use Yorick's `digitize' and `histogram' routines. ARGUMENTS: HS <- Result: HS(,1)= value of explanatory variable X in each bin HS(,2)= sum of weights for each bin HS(,3)= average of DATA in each bin only if keyword STD/AVG_STD is non-nil and non-zero: HS(,4)= standard deviation of DATA in each bin only if keyword AVG_STD is non-nil and non-zero: HS(,5)= standard deviation of HS(,3) DATA -> Response data to average. X -> Value of explanatory variable for each data measurement (same geometry as DATA). KEYWORDS: STD= Compute standard deviation per data sample in HS(,4). AVG_STD= Compute standard deviation of average in HS(,5) (Note: this also implies STD=1). WEIGHT= Statistical weight (e.g., 0.0 where data is not significant). XMAX= Maximum X value to account for (default max(X)). XMIN= Minimum X value to account for (default min(X)). BINSIZE= Resolution for data bins, i.e. value of HS(,1)(dif) (default 1.0) INTERP= Use linear interpolation, instead of rounding to the nearest integer multiple of BINSIZE? | |
SEE ALSO: | digitize, histogram, _histo_sum |