Commit ef1e3d9d3896ab14c6d56f32165db3c536d55931

Authored by Annie Hughes
1 parent 041ca6b6
Exists in master

corrections for TLS

src/idl/dustem_init.pro
@@ -20,7 +20,7 @@ PRO dustem_init,model=model $ @@ -20,7 +20,7 @@ PRO dustem_init,model=model $
20 ; DustEMWrap, Distributed, HighLevel, Initialization 20 ; DustEMWrap, Distributed, HighLevel, Initialization
21 ; 21 ;
22 ; CALLING SEQUENCE: 22 ; CALLING SEQUENCE:
23 -; dustem_init,model=model, 23 +; dustem_init,model=model
24 ; 24 ;
25 ; INPUTS: 25 ; INPUTS:
26 ; None 26 ; None
@@ -340,7 +340,9 @@ IF keyword_set(model) THEN BEGIN @@ -340,7 +340,9 @@ IF keyword_set(model) THEN BEGIN
340 message,'Unknown dust model '+use_model 340 message,'Unknown dust model '+use_model
341 if keyword_set(polarization) and polexists eq 0 then $ 341 if keyword_set(polarization) and polexists eq 0 then $
342 message,'You have requested polarization mode, but the '+use_model+' model does not predict polarization' 342 message,'You have requested polarization mode, but the '+use_model+' model does not predict polarization'
343 - CASE use_model OF 343 +END
  344 +
  345 +CASE use_model OF
344 'MC10':BEGIN 346 'MC10':BEGIN
345 (*!dustem_inputs).grain='GRAIN_MC10.DAT' 347 (*!dustem_inputs).grain='GRAIN_MC10.DAT'
346 END 348 END
@@ -415,14 +417,15 @@ IF keyword_set(model) THEN BEGIN @@ -415,14 +417,15 @@ IF keyword_set(model) THEN BEGIN
415 ; ALIGN.DAT files and providing ther content 417 ; ALIGN.DAT files and providing ther content
416 'USER_MODEL':BEGIN 418 'USER_MODEL':BEGIN
417 (*!dustem_inputs).grain='GRAIN.DAT' 419 (*!dustem_inputs).grain='GRAIN.DAT'
418 - (*!dustem_inputs).align='ALIGN.DAT' 420 + (*!dustem_inputs).align='ALIGN.DAT'
419 END 421 END
420 ELSE:BEGIN 422 ELSE:BEGIN
421 message,'Code should never reach here',/continue 423 message,'Code should never reach here',/continue
422 stop 424 stop
423 END 425 END
424 ENDCASE 426 ENDCASE
425 -ENDIF 427 +;ENDIF
  428 +
426 429
427 defsysv, '!dustem_model', use_model 430 defsysv, '!dustem_model', use_model
428 431
src/idl/dustem_init_parinfo.pro
@@ -58,7 +58,7 @@ END @@ -58,7 +58,7 @@ END
58 dustem_set_func_ind,pd,iv 58 dustem_set_func_ind,pd,iv
59 59
60 60
61 -one_parinfo={value:0.D0, fixed:0, limited:[0,0], limits:[0.D0,0], parname:'', relstep:0.5, step:0.0, mpside:0, tied:''} 61 +one_parinfo={value:0.D0, fixed:0, limited:[0,0], limits:[0.D0,0], parname:'', relstep:0., step:0.0, mpside:0, tied:''}
62 Npar=n_elements(pd) 62 Npar=n_elements(pd)
63 dustem_parinfo=replicate(one_parinfo,Npar) 63 dustem_parinfo=replicate(one_parinfo,Npar)
64 FOR i=0L,Npar-1 DO BEGIN 64 FOR i=0L,Npar-1 DO BEGIN
@@ -108,6 +108,7 @@ ENDIF @@ -108,6 +108,7 @@ ENDIF
108 suite2: 108 suite2:
109 109
110 defsysv,'!dustem_parinfo',ptr_new(dustem_parinfo) 110 defsysv,'!dustem_parinfo',ptr_new(dustem_parinfo)
  111 +
111 ;stop 112 ;stop
112 the_end: 113 the_end:
113 END 114 END
src/idl/dustem_read_all_release.pro
@@ -194,15 +194,26 @@ IF !run_pol THEN BEGIN @@ -194,15 +194,26 @@ IF !run_pol THEN BEGIN
194 ENDIF 194 ENDIF
195 195
196 ;DP :ADD DTLS 196 ;DP :ADD DTLS
197 -one_st={file:'',a_dtls:0.,lc:0.,c_delta:0.,vt:0.,Pmu:0.,gamma_e:0.,omega_m:0.,tau_0:0.,V0:0.,Vmin:0.,Vm:0.,ldtresh:0.} 197 +; WRONG
  198 +;one_st={file:'',a_dtls:0.,lc:0.,c_delta:0.,vt:0.,Pmu:0.,gamma_e:0.,omega_m:0.,tau_0:0.,V0:0.,Vmin:0.,Vm:0.,ldtresh:0.}
  199 +
  200 +; !!! %&%&%&%&
  201 +; structure must have same order of tags as in dustem_read_all_release.pro
  202 +; !!! %&%&%&%&
  203 +one_st={file:'',vt:0.,lc:0.,a_dtls:0. $
  204 + ,Pmu:0.,gamma_e:0., omega_m:0. $
  205 + ,c_delta:0.,tau_0:0. $
  206 + ,V0:0.,Vmin:0.,Vm:0.,ldtresh:0.}
  207 +
198 st_tls = replicate(one_st,Ngrains) 208 st_tls = replicate(one_st,Ngrains)
199 209
200 if !run_tls then begin 210 if !run_tls then begin
201 FOR i=0L,Ngrains-1 DO BEGIN 211 FOR i=0L,Ngrains-1 DO BEGIN
202 - IF stregex(st_grains(i).type_keywords, 'dtls', /bool) THEN BEGIN  
203 - TLS_file='DTLS_'+st_grains.grains(i).grain_type+'.DAT'  
204 - st=dustem_read_tls(dir_in,TLS_file,silent=silent)  
205 - st_tls(i)=st 212 + IF stregex(st_grains[i].type_keywords, 'dtls', /bool) THEN BEGIN
  213 +; TLS_file='DTLS_'+st_grains.grains(i).grain_type+'.DAT'
  214 + TLS_file='DTLS_'+st_grains[i].grain_type+'.DAT'
  215 +; st=dustem_read_tls(dir_in,TLS_file,silent=silent)
  216 + st_tls[i]=dustem_read_tls(dir_in,TLS_file,silent=silent)
206 ENDIF ELSE BEGIN 217 ENDIF ELSE BEGIN
207 st_tls(i)=one_st 218 st_tls(i)=one_st
208 ENDELSE 219 ENDELSE
@@ -220,8 +231,6 @@ endif else begin @@ -220,8 +231,6 @@ endif else begin
220 st={Ngrains:Ngrains,G0:G0,Keywords:key_str,grains:st_grains,isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix,chrg:st_chrg,gas:st_gas,spin:st_spin,tls:st_tls} 231 st={Ngrains:Ngrains,G0:G0,Keywords:key_str,grains:st_grains,isrf:st_isrf,qabs:st_qabs,calor:st_calor,lambda:st_lambda,size:st_size,mix:st_mix,chrg:st_chrg,gas:st_gas,spin:st_spin,tls:st_tls}
221 endelse 232 endelse
222 233
223 -;stop  
224 -  
225 the_end: 234 the_end:
226 235
227 RETURN,st 236 RETURN,st
src/idl/dustem_read_tls.pro
@@ -74,27 +74,38 @@ WHILE first_char EQ '#' DO BEGIN @@ -74,27 +74,38 @@ WHILE first_char EQ '#' DO BEGIN
74 first_char=strmid(str1,0,1) 74 first_char=strmid(str1,0,1)
75 ENDWHILE 75 ENDWHILE
76 76
  77 +; row 1 of DTLS_XX.DAT FILE
77 stv1=str_sep(strtrim(strcompress(str1),2),' ') 78 stv1=str_sep(strtrim(strcompress(str1),2),' ')
78 -a_dtls=float(stv1(0))  
79 -lc=float(stv1(1))  
80 -c_delta=float(stv1(2)) 79 +a_dtls=float(stv1[0])
  80 +lc=float(stv1[1])
  81 +c_delta=float(stv1[2])
  82 +
  83 +; row 2 of DTLS_XX.DAT FILE
81 stv2=str_sep(strtrim(strcompress(str2),2),' ') 84 stv2=str_sep(strtrim(strcompress(str2),2),' ')
82 -vt=float(stv2(0))  
83 -Pmu=float(stv2(1))  
84 -gamma_e=float(stv2(2)) 85 +vt=float(stv2[0])
  86 +Pmu=float(stv2[1])
  87 +gamma_e=float(stv2[2])
  88 +
  89 +; row 3 of DTLS_XX.DAT FILE
85 stv3=str_sep(strtrim(strcompress(str3),2),' ') 90 stv3=str_sep(strtrim(strcompress(str3),2),' ')
86 -omega_m=float(stv3(0))  
87 -tau_0=float(stv3(1))  
88 -V0=float(stv3(2))  
89 -Vmin=float(stv3(3))  
90 -Vm=float(stv3(4)) 91 +omega_m=float(stv3[0])
  92 +tau_0=float(stv3[1])
  93 +V0=float(stv3[2])
  94 +Vmin=float(stv3[3])
  95 +Vm=float(stv3[4])
  96 +
  97 +; row 4 of DTLS_XX.DAT FILE
91 readf,unit,ldtresh 98 readf,unit,ldtresh
92 99
93 -full_st={file:file,vt:vt,lc:lc,a_dtls:a_dtls,Pmu:Pmu,gamma_e:gamma_e, omega_m:omega_m,c_delta:c_delta,tau_0:tau_0,V0:V0,Vmin:Vmin,Vm:Vm,ldtresh:ldtresh} 100 +; structure must have same order of tags as in dustem_read_all_release.pro
  101 +full_st={file:file,vt:vt,lc:lc,a_dtls:a_dtls $
  102 + ,Pmu:Pmu,gamma_e:gamma_e, omega_m:omega_m $
  103 + ,c_delta:c_delta,tau_0:tau_0 $
  104 + ,V0:V0,Vmin:Vmin,Vm:Vm,ldtresh:ldtresh}
94 105
95 close,unit 106 close,unit
96 free_lun,unit 107 free_lun,unit
97 -;cd 108 +
98 the_end: 109 the_end:
99 return,full_st 110 return,full_st
100 111
src/idl/dustem_write_tls.pro
@@ -67,7 +67,7 @@ Nst=n_elements(st) @@ -67,7 +67,7 @@ Nst=n_elements(st)
67 67
68 FOR i=0L,Nst-1 DO BEGIN 68 FOR i=0L,Nst-1 DO BEGIN
69 69
70 - ffile=st(i).file 70 + ffile=st[i].file
71 71
72 if ffile ne '' then begin 72 if ffile ne '' then begin
73 73
@@ -75,14 +75,14 @@ FOR i=0L,Nst-1 DO BEGIN @@ -75,14 +75,14 @@ FOR i=0L,Nst-1 DO BEGIN
75 file=dir+fv(n_elements(fv)-1) 75 file=dir+fv(n_elements(fv)-1)
76 openw,unit,file,/get_lun 76 openw,unit,file,/get_lun
77 77
78 - FOR ii=0,Ncomments-1 DO printf,unit,c(ii) 78 + FOR ii=0,Ncomments-1 DO printf,unit,c[ii]
79 79
80 - printf,unit,st(i).a_dtls,st(i).lc,st(i).c_delta  
81 - printf,unit,st(i).vt,st(i).Pmu,st(i).gamma_e  
82 - printf,unit,st(i).omega_m,st(i).tau_0,st(i).V0,st(i).Vmin,st(i).Vm  
83 - printf,unit,st(i).ldtresh  
84 - ; printf,unit,st(i).cteta0,format='(1E8.2)'  
85 - ; printf,unit,st(i).npol,format='(I1)' 80 + printf,unit,st[i].a_dtls,st[i].lc,st[i].c_delta
  81 + printf,unit,st[i].vt,st[i].Pmu,st[i].gamma_e
  82 + printf,unit,st[i].omega_m,st[i].tau_0,st[i].V0,st[i].Vmin,st[i].Vm
  83 + printf,unit,st[i].ldtresh
  84 + ; printf,unit,st[i].cteta0,format='(1E8.2)'
  85 + ; printf,unit,st[i].npol,format='(I1)'
86 86
87 close,unit 87 close,unit
88 free_lun,unit 88 free_lun,unit
@@ -90,7 +90,6 @@ FOR i=0L,Nst-1 DO BEGIN @@ -90,7 +90,6 @@ FOR i=0L,Nst-1 DO BEGIN
90 endif 90 endif
91 91
92 ENDFOR 92 ENDFOR
93 -;stop  
94 the_end: 93 the_end:
95 END 94 END
96 95