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

Home » Public Forums » archive » "infinite" nested for
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: "infinite" nested for [message #86633 is a reply to message #86632] Mon, 25 November 2013 03:22 Go to previous messageGo to previous message
Kai Muehlbauer is currently offline  Kai Muehlbauer
Messages: 13
Registered: February 2011
Junior Member
Am 25.11.2013 11:24, schrieb Chrisss:
> evil? oh no!!! :-(
> this is for-loop:
>
> for i=0, dx-1 do begin
> for j=0,dy-1 do begin
> y=reform (Im[i,j,*],N_ELEMENTS(x)))
> fitErrors=FLTARR(N_ELEMENTS(x))
> T1values=FLTARR(N_ELEMENTS(x))
> S0values=FLTARR(N_ELEMENTS(x))
> fvalues=FLTARR(N_ELEMENTS(x))
> for t=0,N_ELEMENTS(x)-1 do begin
> T0=t
> yCurr=y
> if (t ne 0) then yCurr[0:T0]=-y[0:To]
> A=mpfitfun('myfunct', x,yCurr, ERR, PARINFO=parinfo, WEIGHTS=w, YFIT=yfit, $ BESTNORM=error, /QUIET )
> fitErrors[t]=error
> T1values[t]=A[0]
> S0values[t]=A[1]
> fvalues[t]=A[2]
> endfor
> min=MIN(fitErrors,idmin)
> T1=T1values[idmin]
> f=fvalues[idmin]
> S0=S0values[idmin]
> yfit=myfunct(x,[S0,f,T1])
> plot,x,y
> oplot,x,yfit
> oplot,x,abs(yfit)
> wait,1
> T1map[i,j]=T1
> endfor
> endfor
>
> where x=t;t=t*(findgen(60)+1) dx=dy=256, Im is a 256x256x60 matrix
> cheers,
> MC

First thing would be to remove the "wait,1". This will cancel out 256 *
256 (65536) seconds (which is around 18 hours). Also plotting is time
consuming.

But there may be additional improvements possible by reorganising the
for loops and doing some vectorisation. But this is for the experts here.

Cheers,
Kai
[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
Read Message
Read Message
Read Message
Previous Topic: lamda default value in CURVEFIT function
Next Topic: Secret of Failed IDL Business Plan

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

Current Time: Wed Oct 08 15:07:02 PDT 2025

Total time taken to generate the page: 0.00401 seconds