Advertisement
supermario

Untitled

Oct 1st, 2012
1,046
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FUNCTION maketrace_defringe, prm, lm, idx, period, fitname, noval
  2. COMPILE_OPT idl2, hidden
  3. ;Rebuild trace
  4.  
  5. nwa = DBLARR(N_ELEMENTS(idx), N_ELEMENTS(period))
  6. cnt = prm[*,1]
  7. nx   = (SIZE(prm, /DIM))[0]
  8. nprm = (SIZE(prm, /DIM))[1]
  9.  
  10. FOR xi = 0, nx-1 DO IF (cnt[xi] NE noval) THEN BREAK
  11.  
  12. SWITCH fitname OF
  13.     'GFCnb':
  14.     'GVCnb': BEGIN
  15.         FOR i = xi, nx-1 DO BEGIN
  16.             IF (cnt[i] EQ noval) THEN CONTINUE
  17.             l1 = lm[0,i]
  18.             l2 = lm[1,i]
  19.             gauss = prm[i,0] * EXP(-0.5*((period-prm[i,1])/prm[i,2])^2)
  20.             nwa[i,l1:l2] = gauss[l1:l2]
  21.         ENDFOR
  22.         BREAK
  23.     END
  24.  
  25.     'GFC':
  26.     'GVC':
  27.     'GFCest': BEGIN
  28.         FOR i = xi, nx-1 DO BEGIN
  29.             IF (cnt[i] EQ noval) THEN CONTINUE
  30.             l1 = lm[0,i]
  31.             l2 = lm[1,i]
  32.             gauss = prm[i,0] * EXP(-0.5*((period-prm[i,1])/prm[i,2])^2) + $
  33.               prm[i,3]
  34.             nwa[i,l1:l2] = gauss[l1:l2]
  35.         ENDFOR
  36.         BREAK
  37.     END
  38.     ELSE: message, "Method '" + fitname + $
  39.       "' not enabled in maketrace_defringe"
  40. ENDSWITCH
  41.  
  42. RETURN, nwa
  43.  
  44. END
Advertisement
RAW Paste Data Copied
Advertisement