comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to find the pixel position
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to find the pixel position [message #70689 is a reply to message #70640] Thu, 29 April 2010 02:49 Go to previous messageGo to previous message
Timm Weitkamp is currently offline  Timm Weitkamp
Messages: 66
Registered: August 2002
Member
On Apr 29, 10:50 am, sid <gunvicsi...@gmail.com> wrote:
> On Apr 29, 12:06 pm, Dave Poreh <d.po...@gmail.com> wrote:
>
>
>
>> On Apr 28, 11:40 pm, sid <gunvicsi...@gmail.com> wrote:
>
>>> On Apr 27, 11:24 am, Aram Panasenco <panasencoa...@gmail.com> wrote:
>
>>>> sid wrote:
>>>> > Hi,
>>>> >      My data is in fits format. The is of 1024 * 1024 array. The counts
>>>> > vary from 5000 to 6000 and I know that 5500 counts is there in my
>>>> > data, but I need to know at which pixel this 5500 counts occur
>>>> > exactly, without displaying the image, because I need to do this for
>>>> > several files. So each time I can't display and check for the pixel
>>>> > position. please helpout in this regard.
>>>> > regards
>>>> > sid
>
>>>> I think what you are saying (correct me if I am wrong) is that you have
>>>> a 1024x1024 array, and you want to find where the pixel values are equal
>>>> to 5500.
>
>>>> You can use the WHERE function:
>
>>>> fitsData = readfits('filename.fits')
>>>> countValue = 5500
>
>>>> findIndices = where(fitsData eq countValue)
>
>>>> Note that the WHERE function returns one-dimensional subscripts. You can
>>>> convert them back to two-dimensional subscripts (if you need to) using
>>>> the ARRAY_INDICES function:
>
>>>> rectIndices = array_indices([1024,1024],findIndices,/dimensions)
>
>>>> Cheers
>>>> ~Aram Panasenco
>
>>> Hi,
>>>   I did like this
>>> raw=readfits('filename.fits')
>>> b=where(raw eq 2832.90)
>>> I know that it occurs at raw(5,5)
>>> so now if I do
>>> print,b
>>> it should print 5, since where function returns one dimensional
>>> subscripts.(am I right, correct me if it is wrong)
>>> but instead it is printing -1. Please help me out.
>>> regards
>>> sid
>
>> Look at the data type:  float double integer?
>
> data type is float

Trying to find "equality" between two float expressions is like trying
to put a pencil upright on its tip and hoping that it will not fall
over. It will hardly ever work. One solution could be to replace the
line "b=where(...)" in your code by

myval = 2832.90
epsilon = .05
b = where(ABS(raw-myval) LE epsilon)

Timm
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SSW Coordinate Conversions
Next Topic: Plotting spherical slice surfaces

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 13:23:18 PDT 2025

Total time taken to generate the page: 0.48013 seconds