View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

total counts in image section

smp wrote on Jun 09, 2010

hi,

I have an image section [x1:x2, y1:y2].
I want to calculate total counts in these (x2-x1) x (y2-y1) pixels.
Any help is appreciated.

Regards,
smp

Mike Fitzpatrick wrote on Jun 09, 2010

Try something like


cl> listpix dev$pix[1:10,1:10] verb- | fields STDIN 3 | average STDIN


The sum of the pixels in the section will be in the 'sum' parameter of the AVERAGE task or you can multiple the average times the number of samples that appear on the output.

smp wrote on Jun 09, 2010

Thanks.
'sum' parameter of 'average' task shows sum of pixel values.

cl> listpix dev$pix[1:10,1:10] verb- | fields STDIN 3 | average STDIN 


But I did not get following meanings:

what is 'dev$pix' ?
verb- says do not list the pixel values ?
what is ' | fields STDIN 3' ? especially number 3?

regards,
smp

Mike Fitzpatrick wrote on Jun 09, 2010

what is 'dev$pix' ?


The standard test image distributed with the system.

verb- says do not list the pixel values ?


See the help page, it just supresses the title line not the pixels.

what is ' | fields STDIN 3' ? especially number 3?


The example pipes the output of LISTPIX to the FIELDS task where column 3 is selected, that then gets piped to the AVERAGE task to do the sum.

jcadien1 wrote on Jun 09, 2010

SMP,
If you do an imstat file.fits[x1:x2,y1:y2]. it will print the number of pixels and the average. Multiply the two and you will have the sum of counts in all those pixels.
N.B. the number of pixels in x1:x2 is NOT x2-x1. Eg. 1:10 is 10 pixels,
10-1=9.

Jim

smp wrote on Jun 09, 2010

Thanks, fitz and jcadien1.

Regards,
smp

Last post on Jun 09, 2010