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

Home » Public Forums » archive » Re: IDL out of range error
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: IDL out of range error [message #70154 is a reply to message #70153] Tue, 16 March 2010 05:31 Go to previous messageGo to previous message
Suguru Amakubo is currently offline  Suguru Amakubo
Messages: 24
Registered: March 2010
Junior Member
Thank you for the quick response :)

dear pp the error is at the line which has sub.

The dimension of sub and test when using 'help,' command are both
(L,L) with index on the corner. As for the index I am using x0 and y0
as the bottom left corner.

sub and test are both portions of the new_image2 from different
indexes with fixed dimension (L,L)

dear David Fanning yes I sincerely agree and I have broken down the
code in multiple places and the error seems to be present in the line
with sub definition. I have checked the values but it seems fine I
cannot comprehend why it is stopping me.

Thank you in advance for the kind help. Below is the code that I am
stuck on (I have capitalised the line that is causing me the problem),
hopefully this will explain what I am trying to do clearly:

pro chi_detection,sub

common block_chi, delta, L ,tr_point
common block_monte, size_of_image, new_image, new_image2, mc_point

deltamin = 1e8

nn=n_elements(mc_point(0,*))

tr_point = fltarr(2,nn)


for kk=0L,nn-1 do begin

x0 = mc_point(0,kk)
y0 = mc_point(1,kk)

L = 30
xr=L/2
yr=L/2

SUB = NEW_IMAGE2(X0:X0+L-1, Y0:Y0+L-1)

for i1 = x0-xr+1, x0+xr-1 do begin

for i2 = y0-yr+1, y0+yr-1 do begin

if(i1 le xr) or (i2 le yr) or (i1 ge size_of_image - L - xr) or (i2
ge size_of_image - L -yr) then begin



if i1 lt xr && i2 lt yr then begin

test = new_image2(xr:xr+L-1,yr:yr+L-1)

endif else if i1 lt xr && i2 gt yr && i2 lt (size_of_image - L -yr)
then begin

test = new_image2(xr:L+xr-1, i2:i2+L-1)

endif else if i1 gt xr && i1 le (size_of_image - L -xr) && i2 lt yr
then begin

test = new_image2(i1:i1+L-1, yr:yr+L-1)

endif else if i1 lt xr && i2 ge (size_of_image - L - yr) then begin

test = new_image2(xr:xr+L-1, (size_of_image -L-yr):(size_of_image-
yr-1))

endif else if i1 ge size_of_image -L -xr && i2 ge size_of_image -L -
yr then begin

test = new_image2(size_of_image -L -xr: size_of_image-xr-1,
size_of_image -L -yr:size_of_image-yr-1)

endif else if i1 ge size_of_image -L -xr && i2 le size_of_image - L -
yr && i2 gt yr then begin

test = new_image2(size_of_image -L -xr:size_of_image -xr-1,
i2:i2+L-1)

endif else if i1 le size_of_image -L -xr and i2 le size_of_image -L -
yr and i2 gt yr then begin

test = new_image2(i1:i1+L-1 , size_of_image - L -yr:size_of_image -
yr-1)

endif else if i1 ge (size_of_image - L - xr) && i2 lt yr then begin

test = new_image2((size_of_image -L-xr):(size_of_image-xr-1), yr:yr
+L-1)

endif

endif else begin

test = new_image2(i1:i1+L-1, i2:i2+L-1)


endelse

delta = (total(sub-test))^2


if delta LT deltamin then begin

deltamin = delta
fx0=i1 & fy0=i2

endif

endfor

endfor

tr_point(*,kk) = [fx0,fy0]

deltamin = 1e8

endfor

stop
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SIGN function: signof(num or array of num)
Next Topic: Re: SIGN function: signof(num or array of num)

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

Current Time: Wed Oct 08 19:58:05 PDT 2025

Total time taken to generate the page: 0.00265 seconds