Re: dimensional headache [message #43300 is a reply to message #43299] |
Wed, 06 April 2005 00:01   |
Andrew[2]
Messages: 7 Registered: February 2005
|
Junior Member |
|
|
Hi Margrethe,
I am not sure what some of the things you have in your code do (aka
calls to ther functions), nor do I know how easily you might be able to
modify them, but I had a crack at the code and made some reasonably
hefty assumptions. Some of this may be completly useless to you. The
distance array d works a treat though and lets you get away from the
whole sqrt, squared buisness. As for the rest of it, I am not sure
since I dont know if you are heavily restricted in your array sizes (I
also am not sure what are scalars and arrays in a couple of cases). I
also noticed in you second attempt at the code that their are still
what appear to be loop markers k and l. So i am not entirely sure what
will be applicable here. I would imagine that the [indx] markers can be
removed if I have stuck them in the wrong places for the things that
are scalars rather than arrays. I hope this helps in some small way.
;get the distance array first
d=SHIFT(DIST(160),xmod,ymod)
;don't take the wings of the psf into account
indx = where (d lt (3. * (fwhm/2.35) ) ,ct)
;only do the calculations where the above criteria has been met
IF (ct NE 0) THEN BEGIN
;assumes here that vel_p,vel_sys, and v_rad are all 160x160 arrays
;if vel_sys isnt then just remove the [indx] part
vel_p[indx] = ( vel_sys[indx] + v_rad[indx] )
;I assume the original psf returned a scalar value at the location i,j
;psf = gaussfunc(st_dev,xgrid(i),ygrid(j),xmod,ymod )
;not sure what do do here as I dont really know what psf returns
;can you return it as a 160x160 array if needed. yes?
;i assumed here that the xgrid and ygrid parameters can
;be merged and passed as the complete array size (im guessing)
psf[indx] = gaussfunc(st_dev,FINDGEN(160,160),xmod,ymod )
lineprof[indx] = lineprof[indx] + total ( psf[indx] * image[indx]
* $
exp( (vel - vel_p[indx])^2./(-2.*v2)) )
ENDIF
Cheers
Andrew
|
|
|