Back Home Up Next

Subchapters:

Working with arrays

There is a lot of operations on arrays, have a look to the manual. The last one presented here will be total.:

        IDL> proj1 = total(image1,1)
        IDL> proj2 = total(image1,2)
        IDL> grand_total = total(image1)

Here the proj1 and proj2 are vector resulting of the sum of the image1 on the x and y axis respectively.  It can be seen as a projection along a direction. You can normalize it by:

        IDL> proj1 = total(image1,1) / (size(image1))[1]
        IDL> proj2 = total(image1,2) / (size(image1))[2]

The grand_total is the sum of all the elements of image1. The mean of the array is:

        IDL>  mean = total(image1) / n_elements(image1)

But can also be obtained by:

        IDL> print,moment(image1)
                 0.500508    0.0832250  -0.00195926     -1.19825

The first element is the mean:

        IDL> print,(moment(image1))[0]
                 0.500508

 

IDL courses C. Morisset © 2004 IA/UNAM V 2.2

Back Home Up Next