To find coordinates of the pixel having maximum counts
smp wrote on Mar 19, 2009
Hi,
I want to know whether there is any IRAF task which will tell (x,y) coordinates of that pixel which is having maximum counts , in a specified image section.
thanks
swapnil
I want to know whether there is any IRAF task which will tell (x,y) coordinates of that pixel which is having maximum counts , in a specified image section.
thanks
swapnil
Mike Fitzpatrick wrote on Mar 19, 2009
See MINMAX.
smp wrote on Mar 19, 2009
hi,
I tried MINMAX task. But it showed only minimum and maximum values for an image section.
It did not show (x,y) coordinates of those two pixels.
what I got is this:
So 21.58049011230469 is min. count and 33647.60546875 is max. count.
What are [46,3] and [20,9] before the counts? Definitely they are not x,y coordinates in my image section.
swapnil
I tried MINMAX task. But it showed only minimum and maximum values for an image section.
It did not show (x,y) coordinates of those two pixels.
what I got is this:
im> minmax
Images to be examined (myimage.fits[1525:1570,520:540]):
myimage.fits[1525:1570,520:540] [46,3] 21.58049011230469 [20,9] 33647.60546875
So 21.58049011230469 is min. count and 33647.60546875 is max. count.
What are [46,3] and [20,9] before the counts? Definitely they are not x,y coordinates in my image section.
swapnil
Mike Fitzpatrick wrote on Mar 19, 2009
They are the coords of the min/max pixel. However, suppose you have a 100x100 section of a 1024x1024 image, the coords will have a max value of 100 because the section size is only 100x100. Passing an image section into any task is very much like copying out that section to a new image first, in your case just add the task coords to the image section to get the coord in the parent image.
-Mike
-Mike
smp wrote on Mar 19, 2009
Thanks Mike.
I checked the co-ordiantes. They are right.
Now I am writing a small script , so that I can find x,y coordiantes of min. and max. counts for a specified image section in all my images:
If I run this script , I get the error:
I have declared the 'str' as string .
What is the reason for such error?
Swapnil
I checked the co-ordiantes. They are right.
Now I am writing a small script , so that I can find x,y coordiantes of min. and max. counts for a specified image section in all my images:
procedure find_xy(input)
string input {prompt = "Name of file containing reduced images"}
begin
string str
minmax(images = input, force = no,update = no, verbose = no) | scan(str)
print(str)
end
If I run this script , I get the error:
ERROR on line 13: Attempt to access undefined local variable `str'.
find_xy ()
find_xy ()
I have declared the 'str' as string .
What is the reason for such error?
Swapnil
James Turner wrote on Mar 19, 2009
The cause of the error is that no value was placed in "str" by scan() because you ran minmax with verbose-, which doesn't print anything... Thus in the final print statement you are trying to print the value of an uninitialized variable.
Before using scan() to parse output from a command, it is always a good idea to run exactly the same command without the pipe first, to make sure it is doing what you think it should be.
Cheers,
James.
Before using scan() to parse output from a command, it is always a good idea to run exactly the same command without the pipe first, to make sure it is doing what you think it should be.
Cheers,
James.
Last post on Mar 19, 2009