Numeric help!

Sheldon shejo284 at gmail.com
Wed Jun 28 18:03:35 CEST 2006


Hi,

I have the following loop that I think can be written to run faster in
Numeric. I am currently using Numeric.
range_va = [60,61,62,63,64,65,66,67,68,69,70,71,72]
main.xsize= 600
main.ysize= 600
#msgva is an (600x600) Numeric array with mutiple occurrences of the
values in range_va
#sat_id is an (600x600) Numeric array with values ranging from -2 to 2
for z in range_va:
            count = 0
            mbias = 0
            for i in range(main.xsize):
                for j in range(main.ysize):
                    if msgva[i,j] == z:
                        mbias += sat_id[i,j] # take the sum of the
values
                        count += 1 # count the occurrences
            tmp_array[0,index] = round(mbias/count,1) # store the mean
            tmp_array[1,index] = z
            index += 1

Any help would be greatly appreciated!

Sincerely,
Sheldon




More information about the Python-list mailing list