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

Home » Public Forums » archive » Re: Reading an arbitrary profile from 2D FITS data
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: Reading an arbitrary profile from 2D FITS data [message #76716] Wed, 29 June 2011 04:07 Go to previous message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
Balt wrote:
> Hi all,
>
> A seemingly very simple problem has me stumped: How do I extract into
> a vector a profile line from a 2D FITS data set? The IDL astro lib
> doesn't seem to contain such a function for 2D, only for 3D, and then
> only along a cardinal axis. That in turn is easy to do also but I need
> it to go from for example (x,y) 100,100 to 320,240.
>
> Any ideas?
>
> Cheers
>
> - Balt
Perhaps these few lines of code may help. Regards, Bringfried

; extract profile from 2D image
; input - image
; - profile x and y start/end coords [x0,x1,y0,y1]
; output - 1D profile

function profile,image,xy
; check index bounds here...
if (xy[0] eq xy[1]) then return,image[xy[0],xy[2]:xy[3]]
if (xy[2] eq xy[3]) then return,image[xy[0]:xy[1],xy[2]]
; non-trivial case
a=(xy[2]-xy[3])/(xy[0]-xy[1])
b=xy[2]-a*xy[0]
x=xy[0]+indgen(xy[1]-xy[0]+1)
y=round(a*x+b)
return,reform(image[[x],[y]])
end
[Message index]
 
Read Message
Read Message
Previous Topic: 2D TO 3D ARRAY with different number of elements
Next Topic: step function

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

Current Time: Wed Oct 08 17:34:57 PDT 2025

Total time taken to generate the page: 0.00475 seconds