Commit 0979f90a5532c129eda68a3185ccb7cee7591df0

Authored by Jean-Philippe Bernard
2 parents 66d0acb9 a2335cf9
Exists in master

Merge branch 'master' of https://gitlab.irap.omp.eu/OV-GSO-DC/dustem-wrapper_idl

src/idl/dustem_cc.pro
... ... @@ -132,7 +132,7 @@ FOR i=0L,Nbands-1 DO BEGIN
132 132 'NUINU=CSTE': BEGIN
133 133 spec_int=interpol(spec2,wavein2,*(st.use_wavelengths(ii)))
134 134 num=integral(*(st.use_wavelengths(ii)),spec_int*(*(st.use_transmissions(ii)))/(*(st.use_wavelengths(ii)))^2.,st.use_wmin(ii),st.use_wmax(ii),/double)
135   - den=integral(*(st.use_wavelengths(ii)),(*(st.use_transmissions(ii)))/(*(st.use_wavelengths(ii))),st.use_wmin(ii),st.use_wmax(ii),/double)
  135 + den=integral(*(st.use_wavelengths(ii)),(*(st.use_transmissions(ii)))/(*(st.use_wavelengths(ii))),st.use_wmin(ii),st.use_wmax(ii),/double)
136 136 cc(i)=num/den/spec0*(st.central_wavelengths(ii))
137 137 END
138 138 'MIPS': BEGIN
... ...
src/idl/dustem_compute_stokes.pro
... ... @@ -94,10 +94,10 @@ FOR i=0L,n_tags(*!dustem_scope)-1 DO BEGIN
94 94  
95 95 ENDFOR
96 96  
  97 +;stop
97 98  
98 99 ;-----------------------------------------
99 100  
100   -
101 101 ;INITIALIZING THE STOKES SEDS
102 102 dustem_qsed = (*!dustem_data.sed).values * 0.
103 103 dustem_used = dustem_qsed
... ... @@ -105,7 +105,6 @@ dustem_used = dustem_qsed
105 105  
106 106 if not isarray(stI) THEN stop
107 107  
108   -
109 108 ;Performing color corrections on the dustem spectra and generating the SEDs at the given filters
110 109  
111 110 IF !dustem_do_cc NE 0 AND !dustem_never_do_cc EQ 0 THEN BEGIN
... ... @@ -128,14 +127,14 @@ IF count_polsed NE 0 THEN BEGIN ; INCLUDE COLOR CORRECTIONS OF (Q,U) for dust &
128 127 dustem_used(ind_polsed)=sused
129 128 endif
130 129 ;--------------------------------------------------------------------------
131   -
132 130 ENDIF
133 131  
  132 +
  133 +
134 134 ;For spectrum data points, interpolate in log-log
135 135 ;Linear interpolation leads to wrong values, in particular where few
136 136 ;wavelengths points exist in the model (long wavelengths).
137 137  
138   -
139 138 ind_spec=where((*!dustem_data.sed).filt_names EQ 'SPECTRUM',count_spec)
140 139 IF count_spec NE 0 THEN BEGIN
141 140 if isa(dustem_qsed) then dustem_qsed(ind_spec)=interpol(Q_spec,st.polsed.wav,(((*!dustem_data.sed).wav)(ind_spec)))
... ... @@ -143,7 +142,6 @@ IF count_spec NE 0 THEN BEGIN
143 142 ENDIF
144 143 out_st=st
145 144  
146   -
147 145 ;clean pointers
148 146 heap_gc
149 147  
... ...
src/idl/dustem_filter2instru.pro
... ... @@ -52,7 +52,6 @@ ENDFOR
52 52  
53 53 instru=!dustem_instrument_description(ind1).instru
54 54 the_end:
55   -
56 55 RETURN,instru
57 56  
58 57 END
... ...
src/idl/dustem_fit_sed_qsed_used_readme.pro
... ... @@ -52,7 +52,7 @@ dustem_define_la_common
52 52  
53 53 ;=== initialise dustem
54 54 ;dustem_init,mode='COMPIEGNE_ETAL2010',/pol
55   -use_mode='G17_MODELA' ; try with model D
  55 +use_mode='THEMIS';'G17_MODELA' ; try with model D
56 56  
57 57 dustem_init,mode=use_mode,/pol
58 58  
... ... @@ -67,7 +67,7 @@ help,!run_pol
67 67  
68 68  
69 69 ;filters=['DIRBE1','DIRBE2','DIRBE3','DIRBE4','IRAS1','IRAS2','IRAS3','IRAS4','PACS3','SPIRE1','SPIRE2','SPIRE3','HFI2','HFI3','HFI4','HFI5','HFI6','LFI1','LFI2','LFI3']
70   -filters=['IRAS1','IRAS2','IRAS3','IRAS4','PACS3','SPIRE1','SPIRE2','SPIRE3','HFI2','HFI3','HFI4','HFI5','HFI6','LFI1','LFI2','LFI3']
  70 +filters=['IRAS1','IRAS2','IRAS3','IRAS4','PACS3','PILOT1','SPIRE1','SPIRE2','SPIRE3','HFI2','HFI3','HFI4','HFI5','HFI6','LFI1','LFI2','LFI3']
71 71 Nfilt=n_elements(filters)
72 72 sed=dustem_initialize_sed(Nfilt)
73 73 sed.filter=filters
... ... @@ -78,11 +78,11 @@ sed.instru=dustem_filter2instru(filters)
78 78  
79 79 ;INITIALIZING IQU SEDS and associated errors
80 80 sed.StokesI=sed.wave*0
81   -;sed.StokesQ=sed.wave*0
82   -;sed.StokesU=sed.wave*0
  81 +sed.StokesQ=sed.wave*0
  82 +sed.StokesU=sed.wave*0
83 83 sed.sigmaII=sed.wave*0
84   -;sed.sigmaQQ=sed.wave*0
85   -;sed.sigmaUU=sed.wave*0
  84 +sed.sigmaQQ=sed.wave*0
  85 +sed.sigmaUU=sed.wave*0
86 86  
87 87  
88 88  
... ... @@ -97,17 +97,23 @@ pd = [ $
97 97 '(*!dustem_params).grains(0).mdust_o_mh',$
98 98 '(*!dustem_params).grains(1).mdust_o_mh',$
99 99 ;'(*!dustem_params).grains(1).mdust_o_mh',$
100   - '(*!dustem_params).grains(2).mdust_o_mh'$
  100 + '(*!dustem_params).grains(2).mdust_o_mh',$
101 101 ;'dustem_plugin_synchrotron_2', $ ;Synchrotron amplitude
102 102 ;'dustem_plugin_synchrotron_4', $ ;Synchrotron polarization angle
103   - ;'dustem_plugin_modify_dust_polarization_2', $ ;Polarization angle applied to the Fortran dust model via a core plugin
104   - ;'dustem_plugin_modify_spinning_polarization_1', $
105   - ;'dustem_plugin_modify_spinning_polarization_2' $
  103 + 'dustem_plugin_modify_dust_polarization_2',$ ;Polarization angle applied to the Fortran dust model via a core plugin
  104 + 'dustem_plugin_modify_spinning_polarization_1', $
  105 + 'dustem_plugin_modify_spinning_polarization_2' $
106 106 ]
107 107  
108   -;p_truth=[1.,7.8000E-04,7.8000E-04,1.6500E-04,5e-3,20.,68.,0.01,30]
  108 +;p_truth=[1.,7.8000E-04,7.8000E-04,1.6500E-04,5e-3,20.,68.,0.03,30.]
  109 +;p_truth=[1.,7.8000E-04,7.8000E-04,1.6500E-04,68.,0.03,30.]
  110 +;p_truth=[1.,7.8000E-04,7.8000E-04,1.6500E-04];,0.01,30.]
  111 +
  112 +
  113 +
  114 +p_truth=[1.,0.17E-03,0.63E-03,0.51E-03,68.,0.03,30.]
  115 +
109 116  
110   -p_truth=[1.,7.8000E-04,7.8000E-04,1.6500E-04];,0.01,30.]
111 117  
112 118 ;p_truth=[68.]
113 119  
... ... @@ -131,8 +137,10 @@ fixed=[1,1,1,1,0];0,1,1]
131 137  
132 138 ;dustem_init_fixed_params,fpd,fiv
133 139  
  140 +iv=p_truth+[0.,5.000E-04,5.000E-04,5.000E-03,-10.,1.00e-2,10.] ;shifted from solution ,10.
134 141  
135   -iv=p_truth+[0.,5.000E-04,5.000E-04,5.000E-04];,5.e-4,1.] ;shifted from solution ,10.
  142 +
  143 +;iv=p_truth+[0.,5.000E-04,5.000E-04,5.000E-04];,5.e-4,1.] ;shifted from solution ,10.
136 144  
137 145  
138 146 Npar=n_elements(pd)
... ... @@ -154,19 +162,19 @@ dustem_init_plugins,pd;, fpd=fpd
154 162  
155 163  
156 164 sed.StokesI=dustem_compute_sed(p_truth,ste) ;sst is not set on purpose, for dustem_compute_sed to compute the sed using fortran code
157   -sed.sigmaII=(sed.StokesI*0.3)^2
  165 +sed.sigmaII=double((sed.StokesI*0.3)^2)
158 166  
159   -; toto=dustem_compute_stokes(p_truth,ste,dustem_qsed,dustem_used) ;this procedure also allows for the extraction of the spectra
  167 +toto=dustem_compute_stokes(p_truth,stee,dustem_qsed,dustem_used) ;this procedure also allows for the extraction of the spectra
160 168  
161   -; sed.StokesQ=dustem_qsed
162   -; sed.sigmaQQ=(double((sed.StokesQ*0.03)^2)) > 1d-50
163   -; ;tes=where(finite(sed.sigmaQQ) eq 0,coun)
164   -; ;if coun ne 0 then sed.sigmaQQ(tes)=0.
  169 +sed.StokesQ=dustem_qsed
  170 +sed.sigmaQQ=(double((sed.StokesQ*0.03)^2)) > 1d-40
  171 +;tes=where(finite(sed.sigmaQQ) eq 0,coun)
  172 +;if coun ne 0 then sed.sigmaQQ(tes)=0.
165 173  
166   -; sed.StokesU=dustem_used
167   -; sed.sigmaUU=(double((sed.StokesU*0.03)^2)) > 1d-50
168   -; ;tes=where(finite(sed.sigmaUU) eq 0,coun)
169   -; ;if coun ne 0 then sed.sigmaUU(tes)=0.
  174 +sed.StokesU=dustem_used
  175 +sed.sigmaUU=(double((sed.StokesU*0.03)^2)) > 1d-40
  176 +;tes=where(finite(sed.sigmaUU) eq 0,coun)
  177 +;if coun ne 0 then sed.sigmaUU(tes)=0.
170 178  
171 179  
172 180 ;======================================================================================================================
... ...
src/idl/dustem_fit_sed_readme.pro
... ... @@ -71,7 +71,7 @@ ENDIF
71 71 IF keyword_set(model) THEN BEGIN
72 72 use_model=strupcase(model)
73 73 ENDIF ELSE BEGIN
74   - use_model='G17_MODELA';'COMPIEGNE_ETAL2010' ;Default is last dustem model
  74 + use_model='THEMIS';G17_MODELA';'COMPIEGNE_ETAL2010' ;Default is last dustem model
75 75 ENDELSE
76 76  
77 77 IF keyword_set(png) THEN BEGIN
... ... @@ -347,13 +347,11 @@ CASE use_model OF
347 347 'THEMIS':BEGIN
348 348 pd = [ $
349 349 '(*!dustem_params).G0', $ ;G0
350   - '(*!dustem_params).grains(0).mdust_o_mh',$ ;PAH0 mass fraction
351   - '(*!dustem_params).grains(1).mdust_o_mh',$ ;PAH1 mass fraction
352   - '(*!dustem_params).grains(2).mdust_o_mh', $ ;Gra
353   - '(*!dustem_params).grains(3).mdust_o_mh', $ ;Gra
354   - '(*!dustem_params).grains(4).mdust_o_mh', $ ;aSil
  350 + '(*!dustem_params).grains(0).mdust_o_mh',$
  351 + '(*!dustem_params).grains(1).mdust_o_mh',$
  352 + '(*!dustem_params).grains(2).mdust_o_mh', $
355 353 'dustem_plugin_continuum_2'] ;Intensity of NIR continuum
356   - iv = [1.0,5.4e-4, 5.4e-4,1.8e-4,2.33e-3,8.27e-3,0.001]
  354 + iv = [1.0,5.4e-4,2.33e-3,8.27e-3,0.001]
357 355 Npar=n_elements(pd)
358 356 ulimed=replicate(0,Npar)
359 357 llimed=replicate(1,Npar)
... ...
src/idl/dustem_init.pro
... ... @@ -169,8 +169,6 @@ defsysv, '!dustem_params', ptr_new() ;Contains the values of all Desert Model pa
169 169 ;ENDIF
170 170  
171 171  
172   -
173   -
174 172 defsysv,'!dustem_filters',ptr_new() ;filter information (filled by dustem_filter_init.pro)
175 173 ;; IDL> help,*!dustem_filters,/str
176 174 ;; ** Structure <1b95608>, 17 tags, length=8232, data length=8118, refs=1:
... ... @@ -241,7 +239,7 @@ defsysv, &#39;!dustem_model&#39;, model
241 239 END
242 240 'THEMIS':BEGIN
243 241 (*!dustem_inputs).grain='GRAIN_THEMIS.DAT'
244   - (*!dustem_inputs).align='ALIGN_G17_MODELD.DAT'
  242 + (*!dustem_inputs).align='ALIGN_G17_MODELA.DAT'
245 243 END
246 244 ELSE:BEGIN
247 245 message,'model '+model+' unknown',/continue
... ...
src/idl/dustem_instru2filters.pro
... ... @@ -19,5 +19,6 @@ ENDIF ELSE BEGIN
19 19 ENDELSE
20 20  
21 21 RETURN,filters
  22 +stop
22 23  
23 24 END
... ...
src/idl/dustem_read_align.pro
... ... @@ -41,16 +41,13 @@ readf,unit,str,format=&#39;(A100)&#39;
41 41 xx=strsplit(str,' ',/regex,/extr)
42 42 anisG0 = float(xx(0))
43 43 ncurrent+=+1
44   -nalig=nlines-ncurrent
45   -
  44 +nalig=nlines-ncurrent ; why do we need this?
46 45 ;stop
47 46  
48 47 one_st={aligned:0.,law:'',athresh:0.,plev:0.,pstiff:0.,TdsTg:0.,a0:0.,rvcut:0.}
49 48 ;Ngrains=st_grains.Ngrains
50 49 Ngrains=n_elements(st_grains)
51   -
52 50 st=replicate(one_st,Ngrains)
53   -
54 51 ;st.aligned = stregex(st_grains.grains.type_keywords, 'pol', /bool)
55 52 ;count=0
56 53  
... ... @@ -92,8 +89,9 @@ FOR i=0L,Ngrains-1 DO BEGIN
92 89 IF !run_univ eq 1 THEN BEGIN
93 90 st = replicate(st(i),Ngrains)
94 91 ;st.aligned = stregex(st_grains.grains.type_keywords, 'pol', /bool)
95   - st.aligned = stregex(st_grains(i).type_keywords, 'pol', /bool)
  92 + st(i).aligned = stregex(st_grains(i).type_keywords, 'pol', /bool)
96 93 break
  94 + ;stop
97 95 ENDIF
98 96 ENDIF
99 97 ENDFOR
... ... @@ -150,7 +148,6 @@ close,unit
150 148 free_lun,unit
151 149  
152 150 full_st={keywords:key_str,anisG0:anisG0,gamma:0,grains:st}
153   -
154 151 RETURN,full_st
155 152  
156 153 END
... ...
src/idl/dustem_read_all_web3p8.pro
... ... @@ -42,9 +42,9 @@ IF keyword_set(help) THEN BEGIN
42 42 goto,the_end
43 43 ENDIF
44 44  
45   -dir_in_dat=dir_in+'/data/'
46   -dir_in_qabs=dir_in+'/oprop/'
47   -dir_in_capa=dir_in+'/hcap/'
  45 +dir_in_dat=dir_in+'data/'
  46 +dir_in_qabs=dir_in+'oprop/'
  47 +dir_in_capa=dir_in+'hcap/'
48 48  
49 49 file=dir_in_dat+(*!dustem_inputs).grain
50 50 ;st_grains=dustem_read_grain(file,silent=silent)
... ... @@ -64,7 +64,6 @@ st_gas=dustem_read_gas(file,silent=silent)
64 64  
65 65 st_qabs=ptrarr(Ngrains)
66 66 FOR i=0L,Ngrains-1 DO BEGIN
67   - ;stop
68 67 read_densities=0
69 68 IF st_grains[i].rho LE 0 THEN read_densities=1
70 69 Qabs_file=dir_in_qabs+'Q_'+st_grains(i).grain_type+'.DAT'
... ...
src/idl/dustem_read_filters.pro
... ... @@ -78,6 +78,7 @@ dir_lfi=filter_dir+&#39;LFI&#39;+&#39;/&#39;
78 78 dir_wmap=filter_dir+'WMAP'+'/'
79 79 dir_spire=filter_dir+'SPIRE'+'/'
80 80 dir_pacs=filter_dir+'PACS'+'/'
  81 +dir_pilot=filter_dir+'PILOT'+'/'
81 82 dir_akari=filter_dir+'AKARI'+'/'
82 83 dir_spass=filter_dir+'SPASS'+'/'
83 84 dir_nika2=filter_dir+'NIKA2'+'/'
... ... @@ -125,6 +126,29 @@ pacs_struct={Name:&#39;PACS&#39;,Nbands:Nband,filter_names:filt_names,central_wavelength
125 126 use_frequencies:use_nu,use_transmissions:use_T,use_wavelengths:use_w,use_wmin:dblarr(Nband),use_wmax:dblarr(Nband), $
126 127 cc_method:'dustem_cc_pacs'}
127 128  
  129 +
  130 +
  131 +
  132 +;======================================================
  133 +;==== PILOT
  134 +;======================================================
  135 +IF print_messages THEN message,'Reading PILOT filter',/continue
  136 +
  137 +;Read WMAP filter Transmission
  138 +filt_names=['PILOT1']
  139 +wfilt_pilot=dustem_filter2wav(filt_names)
  140 +Nband=n_elements(filt_names)
  141 +nu_ptr=ptrarr(Nband) & T_ptr=ptrarr(Nband) & wav_ptr=ptrarr(Nband)
  142 +use_nu=ptrarr(Nband) & use_T=ptrarr(Nband) & use_w=ptrarr(Nband)
  143 +stP=read_xcat(dir_pilot+'pilot_transmission.xcat',/silent)
  144 +Trans=stP.transmission & lamb=stP.wavelength;cmic/(stP.frequency*1e9) ;microns
  145 +T_ptr(0)=ptr_new(Trans/max(Trans)) & nu_ptr(0)=ptr_new(cmic/lamb) & wav_ptr(0)=ptr_new(lamb)
  146 +
  147 +pilot_struct={Name:'PILOT',Nbands:Nband,filter_names:filt_names,central_wavelengths:wfilt_pilot,central_frequencies:cmic/wfilt_pilot, $
  148 + filter_wavelengths:wav_ptr,filter_frequencies:nu_ptr,filter_transmissions:T_ptr, $
  149 + use_frequencies:use_nu,use_transmissions:use_T,use_wavelengths:use_w,use_wmin:dblarr(Nband),use_wmax:dblarr(Nband), $
  150 + cc_method:'dustem_cc_pilot'}
  151 +
128 152 ;======================================================
129 153 ;==== Herschel SPIRE
130 154 ;======================================================
... ... @@ -937,6 +961,7 @@ dm_filter_struct={IRAC:irac_struct,MIPS:mips_struct,MSX:msx_struct,IRAS:iras_str
937 961 HFI:hfi_struct,LFI:lfi_struct, $
938 962 WMAP:wmap_struct, $
939 963 SPIRE:spire_struct,PACS:pacs_struct, $
  964 + PILOT:pilot_struct, $
940 965 AKARI:akari_struct, $
941 966 BOLOCAM:bolocam_struct, $
942 967 WISE:wise_struct, $
... ...
src/idl/dustem_read_qabs_lv.pro
... ... @@ -24,7 +24,7 @@ Ncol=Nsizes
24 24  
25 25 IF keyword_set(read_densities) THEN BEGIN
26 26 readf,unit,st
27   - stop
  27 + ;stop
28 28 IF st EQ '#### Qabs ####' THEN BEGIN
29 29 message,'Problem with size dependent densities in Qabs.DAT',/continue
30 30 ;stop
... ... @@ -77,6 +77,7 @@ close,unit
77 77 free_lun,unit
78 78  
79 79 qsca_str=sts(0:nlines-1)
  80 +;stop
80 81  
81 82 Nlines=n_elements(qsca_str)
82 83  
... ...
src/idl/dustem_read_spin.pro
... ... @@ -30,11 +30,11 @@ WHILE NOT EOF(unit) DO BEGIN
30 30 tmp = [tmp, str]
31 31 ENDWHILE
32 32 ;==save and return structure
33   -full_st={file:file,fspin:tmp,comments:comments}
34   -
  33 +full_st={file:file,fspin:tmp,comments:comments}
  34 +
35 35 close,unit
36 36 free_lun,unit
37   -
  37 +;stop
38 38 RETURN,full_st
39 39  
40 40 END
... ...
src/idl/dustem_write_align.pro
... ... @@ -17,9 +17,7 @@ c(10)=&#39;# alignmentlaw (idg, rat, par), parameters (par1 par2 par3)&#39;
17 17 c(11)='#'
18 18  
19 19 openw,unit,file,/get_lun
20   -
21 20 FOR ii=0,Ncomments-1 DO printf,unit,c(ii)
22   -
23 21 printf,unit,st_align.keywords,format='(A-40)'
24 22 printf,unit,st_align.anisG0,format='(E10.2)'
25 23  
... ... @@ -34,6 +32,5 @@ endelse
34 32 close,unit
35 33 free_lun,unit
36 34  
37   -
38 35 END
39 36  
... ...
src/idl/dustem_write_all_web3p8.pro
1 1 PRO dustem_write_all_web3p8,st,dir_out
2 2  
3   -dir_out_dat=dir_out+'data/'
4   -dir_out_qabs=dir_out+'oprop/'
5   -dir_out_capa=dir_out+'hcap/'
  3 +dir_out_dat=dir_out+'/data/'
  4 +dir_out_qabs=dir_out+'/oprop/'
  5 +dir_out_capa=dir_out+'/hcap/'
6 6  
7 7 ;== ISRF
8 8 file_out=dir_out_dat+'ISRF.DAT'
... ...
src/idl/dustem_write_grain_web3p8.pro
... ... @@ -70,7 +70,6 @@ ENDFOR
70 70 close,unit
71 71 free_lun,unit
72 72  
73   -;stop
74 73  
75 74 END
76 75  
... ...
src/idl/dustem_write_qabs.pro
... ... @@ -8,7 +8,7 @@ Qstring=&#39;QABS_&#39;
8 8 Estring='.DAT'
9 9 Nfiles=n_elements(st)
10 10 frmt="(50E15.5)"
11   -
  11 +stop
12 12 FOR i=0L,Nfiles-1 DO BEGIN
13 13 filename=dir+Qstring+(*st(i)).material+Estring
14 14 Nsizes=n_elements((*st(i)).sizes)
... ...