a44421a79fb36cc2036fe116b97ea3bc9590cd0c braney Fri Dec 2 09:34:39 2011 -0800 removed rcsid (#295) diff --git src/utils/textHist2/textHist2.c src/utils/textHist2/textHist2.c index 5842ac7..987f819 100644 --- src/utils/textHist2/textHist2.c +++ src/utils/textHist2/textHist2.c @@ -1,220 +1,219 @@ /* textHist2 - Make two dimensional histogram. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "psGfx.h" -static char const rcsid[] = "$Id: textHist2.c,v 1.10 2006/03/18 02:26:22 angie Exp $"; int xBins = 12, yBins = 12; int xBinSize = 1, yBinSize = 1; int xMin = 0, yMin = 0; char *psFile = NULL; boolean doLog = FALSE; int margin = 0; int psSize = 5*72; int labelStep = 1; double postScale = 1.0; void usage() /* Explain usage and exit. */ { errAbort( "textHist2 - Make two dimensional histogram table out\n" "of a list of 2-D points, one per line.\n" "usage:\n" " textHist2 input\n" "options:\n" " -xBins=N - number of bins in x dimension\n" " -yBins=N - number of bins in y dimension\n" " -xBinSize=N - size of bins in x dimension\n" " -yBinSize=N - size of bins in x dimension\n" " -xMin=N - minimum x number to record\n" " -yMin=N - minimum y number to record\n" " -ps=output.ps - make PostScript output\n" " -psSize=N - Size in points (1/72th of inch)\n" " -labelStep=N - How many bins to skip between labels\n" " -margin=N - Margin in points for PostScript output\n" " -log - Logarithmic output (only works with ps now)\n" " -postScale=N (default %f) - What to scale by after normalization\n" , postScale ); } double mightLog(double val) /* Put val through a log transform if doLog is set. */ { if (doLog) val = log(1+val); return val; } double findMaxVal(int *hist) /* Find maximum val in histogram. */ { int bothBins = xBins * yBins; int i; double val, maxVal = 0; for (i=0; i 1.0) val = 1.0; if (val < 0.0) val = 0.0; psSetGray(ps, 1.0 - val); boxOut(ps, xPos, yPos, xBinPts, yBinPts); } } /* Draw ticks and labels. */ psSetGray(ps, 0); yPos = psInnerSize; for (x=labelStep; x= xMin && y >= yMin) { x = (x - xMin)/xBinSize; y = (y - yMin)/yBinSize; if (x >= 0 && x < xBins && y >= 0 && y < yBins) { both = y*xBins + x; ++hist[both]; } } } /* Output it. */ if (psFile != NULL) psOutput(hist, psFile); else textOutput(hist); } int main(int argc, char *argv[]) /* Process command line. */ { optionHash(&argc, argv); if (argc != 2) usage(); xBins = optionInt("xBins", xBins); yBins = optionInt("yBins", yBins); xBinSize = optionInt("xBinSize", xBinSize); yBinSize = optionInt("yBinSize", yBinSize); xMin = optionInt("xMin", xMin); yMin = optionInt("yMin", yMin); psFile = optionVal("ps", NULL); psSize = optionInt("psSize", psSize); margin = optionInt("margin", margin); doLog = optionExists("log"); labelStep = optionInt("labelStep", labelStep); postScale = optionFloat("postScale", postScale); textHist2(argv[1]); return 0; }