From ef1e3d9d3896ab14c6d56f32165db3c536d55931 Mon Sep 17 00:00:00 2001 From: Annie Hughes Date: Wed, 17 May 2023 08:51:05 +0200 Subject: [PATCH] corrections for TLS --- src/idl/dustem_init.pro | 11 +++++++---- src/idl/dustem_init_parinfo.pro | 3 ++- src/idl/dustem_read_all_release.pro | 23 ++++++++++++++++------- src/idl/dustem_read_tls.pro | 37 ++++++++++++++++++++++++------------- src/idl/dustem_write_tls.pro | 17 ++++++++--------- 5 files changed, 57 insertions(+), 34 deletions(-) diff --git a/src/idl/dustem_init.pro b/src/idl/dustem_init.pro index 6ebf3cd..919d8eb 100644 --- a/src/idl/dustem_init.pro +++ b/src/idl/dustem_init.pro @@ -20,7 +20,7 @@ PRO dustem_init,model=model $ ; DustEMWrap, Distributed, HighLevel, Initialization ; ; CALLING SEQUENCE: -; dustem_init,model=model, +; dustem_init,model=model ; ; INPUTS: ; None @@ -340,7 +340,9 @@ IF keyword_set(model) THEN BEGIN message,'Unknown dust model '+use_model if keyword_set(polarization) and polexists eq 0 then $ message,'You have requested polarization mode, but the '+use_model+' model does not predict polarization' - CASE use_model OF +END + +CASE use_model OF 'MC10':BEGIN (*!dustem_inputs).grain='GRAIN_MC10.DAT' END @@ -415,14 +417,15 @@ IF keyword_set(model) THEN BEGIN ; ALIGN.DAT files and providing ther content 'USER_MODEL':BEGIN (*!dustem_inputs).grain='GRAIN.DAT' - (*!dustem_inputs).align='ALIGN.DAT' + (*!dustem_inputs).align='ALIGN.DAT' END ELSE:BEGIN message,'Code should never reach here',/continue stop END ENDCASE -ENDIF +;ENDIF + defsysv, '!dustem_model', use_model diff --git a/src/idl/dustem_init_parinfo.pro b/src/idl/dustem_init_parinfo.pro index 8cc398b..6df089e 100755 --- a/src/idl/dustem_init_parinfo.pro +++ b/src/idl/dustem_init_parinfo.pro @@ -58,7 +58,7 @@ END dustem_set_func_ind,pd,iv -one_parinfo={value:0.D0, fixed:0, limited:[0,0], limits:[0.D0,0], parname:'', relstep:0.5, step:0.0, mpside:0, tied:''} +one_parinfo={value:0.D0, fixed:0, limited:[0,0], limits:[0.D0,0], parname:'', relstep:0., step:0.0, mpside:0, tied:''} Npar=n_elements(pd) dustem_parinfo=replicate(one_parinfo,Npar) FOR i=0L,Npar-1 DO BEGIN @@ -108,6 +108,7 @@ ENDIF suite2: defsysv,'!dustem_parinfo',ptr_new(dustem_parinfo) + ;stop the_end: END diff --git a/src/idl/dustem_read_all_release.pro b/src/idl/dustem_read_all_release.pro index 78a5c7c..adff920 100755 --- a/src/idl/dustem_read_all_release.pro +++ b/src/idl/dustem_read_all_release.pro @@ -194,15 +194,26 @@ IF !run_pol THEN BEGIN ENDIF ;DP :ADD DTLS -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.} +; WRONG +;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.} + +; !!! %&%&%&%& +; structure must have same order of tags as in dustem_read_all_release.pro +; !!! %&%&%&%& +one_st={file:'',vt:0.,lc:0.,a_dtls:0. $ + ,Pmu:0.,gamma_e:0., omega_m:0. $ + ,c_delta:0.,tau_0:0. $ + ,V0:0.,Vmin:0.,Vm:0.,ldtresh:0.} + st_tls = replicate(one_st,Ngrains) if !run_tls then begin FOR i=0L,Ngrains-1 DO BEGIN - IF stregex(st_grains(i).type_keywords, 'dtls', /bool) THEN BEGIN - TLS_file='DTLS_'+st_grains.grains(i).grain_type+'.DAT' - st=dustem_read_tls(dir_in,TLS_file,silent=silent) - st_tls(i)=st + IF stregex(st_grains[i].type_keywords, 'dtls', /bool) THEN BEGIN +; TLS_file='DTLS_'+st_grains.grains(i).grain_type+'.DAT' + TLS_file='DTLS_'+st_grains[i].grain_type+'.DAT' +; st=dustem_read_tls(dir_in,TLS_file,silent=silent) + st_tls[i]=dustem_read_tls(dir_in,TLS_file,silent=silent) ENDIF ELSE BEGIN st_tls(i)=one_st ENDELSE @@ -220,8 +231,6 @@ endif else begin 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} endelse -;stop - the_end: RETURN,st diff --git a/src/idl/dustem_read_tls.pro b/src/idl/dustem_read_tls.pro index 809a27a..5ce938c 100755 --- a/src/idl/dustem_read_tls.pro +++ b/src/idl/dustem_read_tls.pro @@ -74,27 +74,38 @@ WHILE first_char EQ '#' DO BEGIN first_char=strmid(str1,0,1) ENDWHILE +; row 1 of DTLS_XX.DAT FILE stv1=str_sep(strtrim(strcompress(str1),2),' ') -a_dtls=float(stv1(0)) -lc=float(stv1(1)) -c_delta=float(stv1(2)) +a_dtls=float(stv1[0]) +lc=float(stv1[1]) +c_delta=float(stv1[2]) + +; row 2 of DTLS_XX.DAT FILE stv2=str_sep(strtrim(strcompress(str2),2),' ') -vt=float(stv2(0)) -Pmu=float(stv2(1)) -gamma_e=float(stv2(2)) +vt=float(stv2[0]) +Pmu=float(stv2[1]) +gamma_e=float(stv2[2]) + +; row 3 of DTLS_XX.DAT FILE stv3=str_sep(strtrim(strcompress(str3),2),' ') -omega_m=float(stv3(0)) -tau_0=float(stv3(1)) -V0=float(stv3(2)) -Vmin=float(stv3(3)) -Vm=float(stv3(4)) +omega_m=float(stv3[0]) +tau_0=float(stv3[1]) +V0=float(stv3[2]) +Vmin=float(stv3[3]) +Vm=float(stv3[4]) + +; row 4 of DTLS_XX.DAT FILE readf,unit,ldtresh -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} +; structure must have same order of tags as in dustem_read_all_release.pro +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} close,unit free_lun,unit -;cd + the_end: return,full_st diff --git a/src/idl/dustem_write_tls.pro b/src/idl/dustem_write_tls.pro index f20a77f..0829d2f 100755 --- a/src/idl/dustem_write_tls.pro +++ b/src/idl/dustem_write_tls.pro @@ -67,7 +67,7 @@ Nst=n_elements(st) FOR i=0L,Nst-1 DO BEGIN - ffile=st(i).file + ffile=st[i].file if ffile ne '' then begin @@ -75,14 +75,14 @@ FOR i=0L,Nst-1 DO BEGIN file=dir+fv(n_elements(fv)-1) openw,unit,file,/get_lun - FOR ii=0,Ncomments-1 DO printf,unit,c(ii) + FOR ii=0,Ncomments-1 DO printf,unit,c[ii] - printf,unit,st(i).a_dtls,st(i).lc,st(i).c_delta - printf,unit,st(i).vt,st(i).Pmu,st(i).gamma_e - printf,unit,st(i).omega_m,st(i).tau_0,st(i).V0,st(i).Vmin,st(i).Vm - printf,unit,st(i).ldtresh - ; printf,unit,st(i).cteta0,format='(1E8.2)' - ; printf,unit,st(i).npol,format='(I1)' + printf,unit,st[i].a_dtls,st[i].lc,st[i].c_delta + printf,unit,st[i].vt,st[i].Pmu,st[i].gamma_e + printf,unit,st[i].omega_m,st[i].tau_0,st[i].V0,st[i].Vmin,st[i].Vm + printf,unit,st[i].ldtresh + ; printf,unit,st[i].cteta0,format='(1E8.2)' + ; printf,unit,st[i].npol,format='(I1)' close,unit free_lun,unit @@ -90,7 +90,6 @@ FOR i=0L,Nst-1 DO BEGIN endif ENDFOR -;stop the_end: END -- libgit2 0.21.2