Julien Fiore wrote:
Thank you Serge for this generous reply,
Vectorized code seems a great choice to compute the distance. If I
understand well, vectorized code can only work when you don't need to
access the values of the array, but only need to know the indices.
You can access array
Thank you Serge for this generous reply,
Vectorized code seems a great choice to compute the distance. If I
understand well, vectorized code can only work when you don't need to
access the values of the array, but only need to know the indices. This
works well for the distance, but I need to
Thanks for the psyco information, Serge.
2) Rewrite the code to be vectorized (don't use psyco) Right now your
code *doesn't* get any speed benefit from numpy
I do not understand this point. How to rewrite the code ? Do you mean
in C ?
Julien
--
Thanks Caleb for the advice,
I profiled my code with the following lines:
import profile, pstats
profile.runctx('openness(infile,outfile,R)',globals(),locals(),'profile.log')
p = pstats.Stats('profile.log')
p.sort_stats('time')
p.print_stats(10)
The outputs tells me that the
Julien Fiore wrote:
Thanks Caleb for the advice,
I profiled my code with the following lines:
import profile, pstats
profile.runctx('openness(infile,outfile,R)',globals(),locals(),'profile.log')
p = pstats.Stats('profile.log')
p.sort_stats('time')
p.print_stats(10)
Julien Fiore wrote:
Thanks for the psyco information, Serge.
2) Rewrite the code to be vectorized (don't use psyco) Right now your
code *doesn't* get any speed benefit from numpy
I do not understand this point. How to rewrite the code ?
vectorized code means one operation work on multiple
Hi,
I wrote a function to compute openness (a digital elevation model
attribute). The function opens the gdal-compatible input raster and
reads the values in a square window around each cell. The results are
stored in a 1 line buffer. At the end of the line, the buffer is
written to the output
Hi
The documentation for the python profiler in the python library
reference is extremely readable (well done James Roskin!?).
Profile your code, and when you find where the speed problem occurs,
try pitching just that section of code in comp.lang.python. You will
likely get much feedback.
Julien Fiore wrote:
Hi,
I wrote a function to compute openness (a digital elevation model
attribute). The function opens the gdal-compatible input raster and
reads the values in a square window around each cell. The results are
stored in a 1 line buffer. At the end of the line, the buffer is