Re: Frustrated by 2 Data Plotting problems [message #76268 is a reply to message #76267] |
Sat, 28 May 2011 08:21   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Kenneth P. Bowman writes:
> I couldn't drink a beer that fast even in my college days.
>
> PRO TEST_SCATTER
> ; Plot a scatterplot with a lot of points
> t0 = SYSTIME(/SECONDS)
> n = 4000000
> x = RANDOMU(seed, n)
> y = SIN(2.0*!PI*x) + 0.3*RANDOMN(seed, n)
> WINDOW, XSIZE = 1000, YSIZE = 1000
> PLOT, x, y, PSYM = 3
> PRINT, 'Elapsed time : ', SYSTIME(/SECONDS) - t0
> END
>
>
> IDL> .r test_scatter
> % Compiled module: TEST_SCATTER.
> IDL> test_scatter
> Elapsed time : 5.5195148
I guess my machine is a LOT slower. Which confuses me,
because I spent good money on this darn machine! :-(
Anyway, when I run your program, it takes about 42
seconds. After three sets of tennis, I have been
known to drink a beer in about that amount of time!
IDL> test_scatter
% Compiled module: TEST_SCATTER.
Elapsed time : 42.018000
But this sort of proves my point. If I run your program
with 1 percent of the points, the "visualization" doesn't
change in any material way, but the time is reduced by
a factor of 1000.
PRO TEST_SCATTER
; Plot a scatterplot with a lot of points
n = 4000000L
x = RANDOMU(seed, n)
y = SIN(2.0*!PI*x) + 0.3*RANDOMN(seed, n)
indices = Round(randomu(seed,40000L)*4000000L)
WINDOW, XSIZE = 1000, YSIZE = 1000, 1
t0 = SYSTIME(/SECONDS)
PLOT, x[indices], y[indices], PSYM = 3
PRINT, 'Elapsed time : ', SYSTIME(/SECONDS) - t0
END
IDL> test_scatter
% Compiled module: TEST_SCATTER.
Elapsed time : 0.43099999
> I think that this is a quick and easy way to get
> an idea of what your data looks like, but I should know
> better than to expect to get the last word.
Gianguido was pointing out to me yesterday that the top three
contributors to the IDL newsgroup for all time are:
davidf@dfanning.com
david@dfanning.com
news@dfanning.com
You don't get these kinds of records by letting someone else
have the last word! ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|