cgHistoplot -- input histogram results? [message #86326] |
Sun, 27 October 2013 10:15  |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
I have data from a few hundred files histogrammed and saved. I would like to use cgHistoplot to display it. Is it possible to take the results of Histogram (or cgHistogram) and use them as inputs to cgHistogram? I see the keyword HISTDATA, but it is an output.
Thanks
|
|
|
|
Re: cgHistoplot -- input histogram results? [message #86328 is a reply to message #86327] |
Sun, 27 October 2013 11:10   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> It is not really possible to do this because so much of what is required
> to draw the plot (data ranges, binsize, etc.) comes from the data itself
> and not from the actual histogram.
Maybe "not possible" is the wrong way to say it. It would be possible if
the information required to draw the plot were provided, but this will
make some keywords required parameters, rather than the normal optional
parameters, etc. It will get VERY ugly and not at all the Coyote style.
:-)
Of course, if YOU wanted to do it, I couldn't stop you. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: cgHistoplot -- input histogram results? [message #86336 is a reply to message #86326] |
Mon, 28 October 2013 09:17  |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
I have to do this before - basically, I fake the original data set, based on inputs from the original histogram. Basically, I replicate the middle of each bin to match the histogram value (to stay away from the razor's edge):
binSize = 5.0
minVal = 0.0
h=HISTOGRAM(data, BIN=binSize, MIN=minVal) ;original histogram
nData = TOTAL(h)
nHisto = N_ELEMENTS(h)
middleBins = FINDGEN(nHisto)*binSize/2+minVal
fakeData = FLTARR(nData)
FOR i=0, nHisto-1 DO BEGIN
IF h[i] EQ 0 THEN CONTINUE
IF i EQ 0 THEN startInd = 0 ELSE startInd = TOTAL(h[0:i-1])
stopInd = TOTAL(h[0:i])-1
fakeData[ startInd : stopInd ] = REPLICATE(middleBins[i], h[i])
ENDFOR
(There's plenty room for improvement in this code....not enough coffee yet :-) )
You could then throw fakeData at cgHistoplot. I've only had to do this a couple of times - so, the time penalty for duplicating the histogram calculation wasn't important (enough). I suppose as long as the data isn't too finely binned, it would work fine....
|
|
|