Commit 52a3c8dc145b1ee9c4394f8ed280f75ec3035e61

Authored by Jean-Philippe Bernard
1 parent ba6d7415
Exists in master

mise a jour

src/idl/dustem_compute_stokext.pro
... ... @@ -81,6 +81,7 @@ degtorad = !pi/180
81 81  
82 82  
83 83 EXT_spec = st.ext.ext_tot * (*!dustem_HCD)/1.e21 ;This is Total extinction (for a default value of 10^20 NH/cm^2)
  84 +;stop
84 85 POLEXT_spec = st.polext.ext_tot * (*!dustem_HCD)/1.e21 ;This is Polarized extinction
85 86  
86 87 ;Hard-coded test to set to zero potential negative values in the polarized extinction arrays:
... ...
src/idl/dustem_fit_ext_pol_example.pro
... ... @@ -188,7 +188,7 @@ dustem_init_params,use_model,pd,iv,fpd=fpd,fiv=fiv,ulimed=ulimed,llimed=llimed,u
188 188 wait,wait
189 189 ENDIF
190 190  
191   - stop
  191 + ;stop
192 192  
193 193 if not keyword_set(ext_file) then begin
194 194 ;== GENERATE THE DATA USING THE MODEL AND TRUE VALUES
... ... @@ -197,7 +197,7 @@ if not keyword_set(ext_file) then begin
197 197 ext.EXT_Q = toto[0]
198 198 ext.EXT_U = toto[1]
199 199  
200   - stop
  200 + ;stop
201 201  
202 202 ;== RESET THE OBSERVATIONAL STRUCTURE
203 203 ;== note that m_fit and m_show do not exist -- this is deliberate
... ... @@ -211,7 +211,7 @@ if not keyword_set(ext_file) then begin
211 211  
212 212 end
213 213  
214   -stop
  214 +;stop
215 215  
216 216 ;== INFORMATION TO RUN THE FIT
217 217 tol=1.e-10
... ... @@ -225,7 +225,7 @@ yr_fpolext=[1.00E-10,50]
225 225 tit='Dust Optical Depth'
226 226  
227 227 ;=== RUN THE FIT
228   -stop
  228 +;stop
229 229 t1=systime(0,/sec)
230 230  
231 231 res=dustem_mpfit_data(tol=tol,Nitermax=use_Nitermax,gtol=gtol $
... ...
src/idl/dustem_mpfit_run.pro
... ... @@ -212,7 +212,7 @@ FOR i_tag=0,count_data_tag-1 DO BEGIN
212 212  
213 213  
214 214 'QEXT': BEGIN ;UPDATED
215   -
  215 + ;stop
216 216 Stokext = dustem_compute_stokext(p_dim,st=st,QEXT_spec=QEXT_spec,UEXT_spec=UEXT_spec,PSIEXT_spec=PSIEXT_spec,dustem_psi_ext=dustem_psi_ext)
217 217 dustem_qext = stokext[0]
218 218 chi2_qext =total(((*(*!dustem_data).qext).values-dustem_qext)^2/(*(*!dustem_data).qext).sigma^2)
... ...
src/idl/dustem_read_align.pro
1   -FUNCTION dustem_read_align,dir_in,st_grains,silent=silent
2   -
3   -;moved to dustem_init.pro
4   -;defsysv, '!run_circ', 0.
5   -;defsysv, '!run_anis', 0.
6   -;defsysv, '!run_rrf', 0.
7   -;defsysv, '!run_univ', 0.
8   -;defsysv, '!run_lin', 0.
  1 +FUNCTION dustem_read_align,dir_in,st_grains,help=help,silent=silent
  2 +
  3 +;+
  4 +; NAME:
  5 +; dustem_read_align
  6 +; PURPOSE:
  7 +; reads the ALIGN.DAT file
  8 +; CATEGORY:
  9 +; DustEMWrap, Distributed, HighLevel, Initialization
  10 +; CALLING SEQUENCE:
  11 +; dustem_read_align,dir_in,st_grains[,/help]
  12 +; INPUTS:
  13 +; dir_in : input directory where to read the file from
  14 +; st_grains : structure describing grain parameters for various grains (usually !dustem.grains)
  15 +; OPTIONAL INPUT PARAMETERS:
  16 +; None
  17 +; OUTPUTS:
  18 +; None
  19 +; OPTIONAL OUTPUT PARAMETERS:
  20 +; None
  21 +; ACCEPTED KEY-WORDS:
  22 +; silent : if set, run silent (not used, actually)
  23 +; help : writes this help
  24 +; COMMON BLOCKS:
  25 +; None
  26 +; SIDE EFFECTS:
  27 +; a File is written
  28 +; RESTRICTIONS:
  29 +; The DustEM fortran code must be installed
  30 +; The DustEMWrap idl code must be installed
  31 +; PROCEDURES AND SUBROUTINES USED
  32 +; EXAMPLES
  33 +; MODIFICATION HISTORY:
  34 +; Evolution details on the DustEMWrap gitlab.
  35 +; See http://dustemwrap.irap.omp.eu/ for FAQ and help.
  36 +;-
  37 +
  38 +IF keyword_set(help) THEN BEGIN
  39 + doc_library,'dustem_read_align'
  40 + full_st=-1
  41 + goto,the_end
  42 +ENDIF
9 43  
10 44 file=dir_in+(*!dustem_inputs).align
11 45 openr,unit,file,/get_lun
... ... @@ -29,11 +63,7 @@ ENDREP UNTIL first_char NE '#'
29 63 key_str=str
30 64  
31 65 IF stregex(key_str, 'lin', /bool) THEN !run_lin = 1
32   -IF stregex(key_str, 'univ', /bool) THEN BEGIN
33   - !run_univ = 1
34   - ;stop
35   -ENDIF
36   -
  66 +IF stregex(key_str, 'univ', /bool) THEN !run_univ = 1
37 67 IF stregex(key_str, 'circ', /bool) THEN !run_circ = 1
38 68 IF stregex(key_str, 'anis', /bool) THEN !run_anis = 1
39 69 IF stregex(key_str, 'rrf', /bool) THEN !run_rrf = 1
... ... @@ -46,25 +76,19 @@ nalig=nlines-ncurrent
46 76 ;stop
47 77  
48 78 one_st={aligned:0.,law:'',athresh:0.,plev:0.,pstiff:0.,TdsTg:0.,a0:0.,rvcut:0.}
49   -;Ngrains=st_grains.Ngrains
50 79 Ngrains=n_elements(st_grains)
51 80 st=replicate(one_st,Ngrains)
52   -;st.aligned = stregex(st_grains.grains.type_keywords, 'pol', /bool)
53   -;count=0
54 81  
55 82 is_aligned=stregex(st_grains.type_keywords, 'pol', /bool)
  83 +
56 84 FOR i=0L,Ngrains-1 DO BEGIN
57   - ;stop
58   - ;stop
59   - ;IF st(i).aligned then begin
60 85 IF is_aligned[i] THEN BEGIN
61   - ;stop
62 86 readf,unit,str,format='(A100)'
63 87 strv=str_sep(strcompress(strtrim(str,2)),' ')
64 88 Nstrv=n_elements(strv)
65 89  
66 90 ii=0L
67   - st(i).law=strv(ii) & ii=ii+1
  91 + st(i).law=strv[ii] & ii=ii+1
68 92  
69 93 ; IDG
70 94 IF stregex(st(i).law, 'idg', /bool) THEN BEGIN
... ... @@ -74,83 +98,37 @@ FOR i=0L,Ngrains-1 DO BEGIN
74 98 ENDIF
75 99  
76 100 ; RAT
77   - IF stregex(st(i).law, 'rat', /bool) THEN BEGIN
  101 + IF stregex(st[i].law, 'rat', /bool) THEN BEGIN
78 102 ENDIF
79 103  
80 104 ; PARAMETRIC
81   - IF stregex(st(i).law, 'par', /bool) THEN BEGIN
  105 + IF stregex(st[i].law, 'par', /bool) THEN BEGIN
82 106 ; Grain radius Threshold for alignment, given in microns and converted in cm
83   - st[i].athresh = strv(ii) & ii=ii+1
84   - st[i].pstiff = strv(ii) & ii=ii+1
85   - st[i].plev = strv(ii) & ii=ii+1
  107 + st[i].athresh = strv[ii] & ii=ii+1
  108 + st[i].pstiff = strv[ii] & ii=ii+1
  109 + st[i].plev = strv[ii] & ii=ii+1
86 110 ENDIF
87 111  
88   - st[i].aligned = stregex(st_grains(i).type_keywords, 'pol', /bool)
  112 + st[i].aligned = stregex(st_grains[i].type_keywords, 'pol', /bool)
89 113 IF !run_univ eq 1 THEN BEGIN
90 114 st = replicate(st(i),Ngrains)
91   - ;st.aligned = stregex(st_grains.grains.type_keywords, 'pol', /bool)
92   - st(i).aligned = stregex(st_grains(i).type_keywords, 'pol', /bool)
  115 + st[i].aligned = stregex(st_grains[i].type_keywords, 'pol', /bool)
93 116 ind=where(is_aligned eq 0)
94 117 st(ind)=one_st
95   - ;stop
96 118 break
97 119 ENDIF
98 120  
99 121 ENDIF
100 122 ENDFOR
101 123  
102   -; FOR i=0L,st_grains.Ngrains-1 DO BEGIN
103   -; IF st(i).aligned then begin
104   -; ; if count EQ 0. then begin
105   -; readf,unit,str,format='(A100)'
106   -; ;endif
107   -
108   -; strv=str_sep(strcompress(strtrim(str,2)),' ')
109   -; Nstrv=n_elements(strv)
110   -
111   -; ii=0L
112   -; st(i).law=strv(ii) & ii=ii+1
113   -
114   -; ; IDG
115   -; IF stregex(st(i).law, 'idg', /bool) THEN begin
116   -; ii=ii+1
117   -; st(i).TdsTg = strv(ii) & ii=ii+1
118   -; st(i).a0 = strv(ii) & ii=ii+1
119   -; st(i).rvcut = strv(ii) & ii=ii+1
120   -; endif
121   -
122   -; ; RAT
123   -; IF stregex(st(i).law, 'rat', /bool) THEN begin
124   -; endif
125   -
126   -; ; PARAMETRIC
127   -; IF stregex(st(i).law, 'par', /bool) THEN begin
128   -; ; Grain radius Threshold for
129   -; ; alignment, given in microns and
130   -; ; converted in cm
131   -; st(i).athresh = strv(ii) & ii=ii+1
132   -; st(i).pstiff = strv(ii) & ii=ii+1
133   -; st(i).plev = strv(ii) & ii=ii+1
134   -; ; count=1
135   -; endif
136   -
137   -; IF !run_univ eq 1 then begin
138   -; st = replicate(st(i),st_grains.Ngrains)
139   -; st.aligned = stregex(st_grains.grains.type_keywords, 'pol', /bool)
140   -; ;stop
141   -; break
142   -; endif
143   -
144   -
145   -
146   -; ENDIF
147   -
148   -; ENDFOR
149   -
150 124 close,unit
151 125 free_lun,unit
152 126  
153 127 full_st={keywords:key_str,anisG0:anisG0,gamma:0,grains:st}
  128 +
  129 +
  130 +the_end:
  131 +
154 132 RETURN,full_st
155 133  
156 134  
... ...
src/idl/dustem_read_fits_table.pro
1   -PRO dustem_read_fits_table,filename=filename,dustem_st=dustem_st,help=help
  1 +PRO dustem_read_fits_table,filename=filename,dustem_st=dustem_st,help=help,Q_spec=Q_spec,U_spec=U_spec
2 2  
3 3 ;+
4 4 ; NAME:
... ... @@ -354,9 +354,18 @@ ENDIF
354 354 ;Note: If the same model is used, the outputs should be the same as what is in the fits file ....
355 355 IF unit_input_emission_sed NE -1 THEN BEGIN
356 356 recomputed_dustem_predicted_emission_sed=dustem_compute_sed(*(*!dustem_fit).current_param_values,st=dustem_st)
  357 + ;This is to compute the spectrum of Q,U which is not stored in dustem_st (only polsed is)
  358 +;stop
  359 + toto = dustem_compute_stokes(*(*!dustem_fit).current_param_values,st=dustem_st,Q_spec=Q_spec,U_spec=U_spec,PSI_spec=PSI_spec,dustem_psi_em=dustem_psi_em)
357 360 ENDIF ELSE BEGIN
358 361 recomputed_dustem_predicted_ext_sed=dustem_compute_ext(*(*!dustem_fit).current_param_values,st=dustem_st)
359 362 ENDELSE
  363 +;IF !run_pol AND !run_lin AND tag_exist(*!dustem_show,'qsed') THEN BEGIN
  364 +; dustem_polsed = dustem_compute_polsed(p_dim,st=st,P_spec=P_spec,SP_spec=SP_spec,dustem_polfrac=dustem_polfrac)
  365 +; toto = dustem_compute_stokes(p_dim,st=st,Q_spec=Q_spec,U_spec=U_spec,PSI_spec=PSI_spec,dustem_psi_em=dustem_psi_em)
  366 +; dustem_qsed = toto[0]
  367 +; dustem_used = toto[1]
  368 +;ENDIF
360 369  
361 370 dustem_predicted_em=mrdfits(file,unit_dustem_predicted_emission_spectra,header_predicted_emission)
362 371 dustem_predicted_ext= mrdfits(file,unit_dustem_predicted_extinction_spectra,header_predicted_extinction)
... ...
src/idl/dustem_set_plot_range.pro
1   -PRO dustem_set_plot_range ,test_m,test_x, _extra=_extra ,help=help
  1 +PRO dustem_set_plot_range,test_m,test_x,_extra=_extra,help=help
2 2  
3 3 ;+
4 4 ; NAME:
... ...
src/idl/dustem_show_file_dependencies.pro
... ... @@ -67,10 +67,11 @@ dustem_fit_intensity_example,Nitermax=5,fits_save_and_restore='/tmp/mysavefile1.
67 67 dustem_fit_spectro_example,Nitermax=1
68 68 dustem_fit_intensity_example,Nitermax=1,/noobj
69 69 dustem_fit_intensity_mbb_example,Nitermax=1,postscript='/tmp/dustemwrap_postcript_example.ps'
  70 +dustem_fit_intensity_mbb_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile5.fits'
70 71 dustem_fit_polarization_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile2.fits'
71 72 dustem_make_polarization_ext_example,model='G17_MODELD',outfile='./pol_ext_G17D.xcat'
72 73 dustem_make_polarization_ext_example,model='G17_MODELA',outfile='./pol_ext_G17A.xcat'
73   -dustem_fit_ext_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile3.fits'
  74 +dustem_fit_ext_example,Nitermax=1,fits_save_and_restore='./mysavefile3.fits'
74 75 dustem_fit_ext_pol_example,Nitermax=3,fits_save_and_restore='/tmp/mysavefile4.fits'
75 76 ;following fails in the write_fits_table
76 77 dustem_fit_ext_pol_example,Nitermax=3,ext_file='./pol_ext_G17D.xcat';,fits_save_and_restore='/tmp/mysavefile5.fits'
... ...
src/idl/dustem_write_align.pro
1   -PRO dustem_write_align,file,st_align
  1 +PRO dustem_write_align,file,st_align,help=help
2 2  
3   -Ncomments=12
  3 +;+
  4 +; NAME:
  5 +; dustem_write_align
  6 +; PURPOSE:
  7 +; writes the ALIGN.DAT file
  8 +; CATEGORY:
  9 +; DustEMWrap, Distributed, HighLevel, Initialization
  10 +; CALLING SEQUENCE:
  11 +; dustem_write_align,file,st_align
  12 +; INPUTS:
  13 +; file : name of the file to be written
  14 +; st_align : structure describing alignment parameters for various grains (usually !dustem.grains.align)
  15 +; OPTIONAL INPUT PARAMETERS:
  16 +; None
  17 +; OUTPUTS:
  18 +; None
  19 +; OPTIONAL OUTPUT PARAMETERS:
  20 +; None
  21 +; ACCEPTED KEY-WORDS:
  22 +; help : whrites this help
  23 +; COMMON BLOCKS:
  24 +; None
  25 +; SIDE EFFECTS:
  26 +; a File is written
  27 +; RESTRICTIONS:
  28 +; The DustEM fortran code must be installed
  29 +; The DustEMWrap idl code must be installed
  30 +; PROCEDURES AND SUBROUTINES USED
  31 +; EXAMPLES
  32 +; MODIFICATION HISTORY:
  33 +; Evolution details on the DustEMWrap gitlab.
  34 +; See http://dustemwrap.irap.omp.eu/ for FAQ and help.
  35 +;-
  36 +
  37 +IF keyword_set(help) THEN BEGIN
  38 + doc_library,'dustem_write_align'
  39 + goto,the_end
  40 +ENDIF
  41 +
  42 +Ncomments=13
4 43 c=strarr(Ncomments)
5 44  
6   -c(0)='# DUSTEM: definition of grain alignment'
7   -c(1)='# for each grain TYPE make sure you have the following files'
8   -c(2)='# Q1_TYPE.DAT and Q2_TYPE in /oprop'
9   -c(3)='# Qc_TYPE.DAT for circular polarization'
10   -c(4)='# QH1_TYPE.DAT QH2_TYPE.DAT for an anistropic radiation field'
11   -c(5)='# Q1_TYPE_RRFxxx.DAT and Q2_TYPE_RRFxxx.DAT when running with RRF option'
12   -c(6)='#'
13   -c(7)='# run keywords'
14   -c(8)='# lin for linear, circ for circular, anis for anistropic extinction and emission, univ for universal alignment law, RRF'
15   -c(9)='# degree of anisotropy of the radiation : if > 0, read QH1 and QH2 files'
16   -c(10)='# alignmentlaw (idg, rat, par), parameters (par1 par2 par3)'
17   -c(11)='#'
  45 +;NOTE: In vincent Guillet's model, the alignment parameters of all grains have to be the same.
  46 +;As a consquence, there is only one ligne in the ALIGN.DAT file.
  47 +;Here we use the first polarized grain value
  48 +
  49 +;stop
  50 +
  51 +ii=0
  52 +c[ii]='# DUSTEM: definition of grain alignment' & ii=ii+1
  53 +c[ii]='# for each grain TYPE make sure you have the following files' & ii=ii+1
  54 +c[ii]='# Q1_TYPE.DAT and Q2_TYPE in /oprop' & ii=ii+1
  55 +c[ii]='# Qc_TYPE.DAT for circular polarization' & ii=ii+1
  56 +c[ii]='# QH1_TYPE.DAT QH2_TYPE.DAT for an anistropic radiation field' & ii=ii+1
  57 +c[ii]='# Q1_TYPE_RRFxxx.DAT and Q2_TYPE_RRFxxx.DAT when running with RRF option' & ii=ii+1
  58 +c[ii]='#' & ii=ii+1
  59 +c[ii]='# run keywords' & ii=ii+1
  60 +c[ii]='# lin for linear, circ for circular, anis for anistropic extinction and emission, univ for universal alignment law, RRF' & ii=ii+1
  61 +c[ii]='# degree of anisotropy of the radiation : if > 0, read QH1 and QH2 files' & ii=ii+1
  62 +c[ii]='# alignmentlaw (idg, rat, par), parameters (par1 par2 par3)' & ii=ii+1
  63 +c[ii]='# for alignmentlaw = par: parameters are aalign, pstiff, fmax (see Equ. 1 In Guillet et al. 2017' & ii=ii+1
  64 +c[ii]='#'
  65 +
  66 +;WHAY IS FMAX in Guillet2017 here called plev ??
18 67  
19 68 openw,unit,file,/get_lun
20   -FOR ii=0,Ncomments-1 DO printf,unit,c(ii)
  69 +FOR ii=0,Ncomments-1 DO printf,unit,c[ii]
21 70 printf,unit,st_align.keywords,format='(A-40)'
22 71 printf,unit,st_align.anisG0,format='(E10.2)'
23 72  
24   -if !run_univ eq 1 then begin
25   - iii=where(st_align.grains.aligned eq 1)
26   - iii=iii(0)
27   - printf,unit,st_align.grains(iii).law,st_align.grains(iii).athresh,st_align.grains(iii).pstiff,st_align.grains(iii).plev,format='(A-10,2X,10(E18.10,2X))'
  73 +format='(A-10,2X,10(E18.10,2X))'
  74 +IF !run_univ EQ 1 THEN BEGIN
  75 + ind=where(st_align.grains.aligned eq 1,count)
  76 + ii=ind[0] ;here we use alignment parameters of the first polarized grains and for them to be the same
  77 + printf,unit,st_align.grains[ii].law,st_align.grains[ii].athresh,st_align.grains[ii].pstiff,st_align.grains[ii].plev,format=format
28 78 ;stop
29   -endif else begin
30   - for i=0,n_elements(st_align.grains)-1 do begin
31   - if st_align.grains(i).aligned then if st_align.grains(i).law ne '' then printf,unit,st_align.grains(i).law,st_align.grains(i).athresh,st_align.grains(i).pstiff,st_align.grains(i).plev,format='(A-10,2X,10(E18.10,2X))'
32   - endfor
33   -endelse
  79 +ENDIF ELSE BEGIN
  80 + FOR i=0,n_elements(st_align.grains)-1 DO BEGIN
  81 + IF st_align.grains[i].aligned THEN BEGIN
  82 + IF st_align.grains[i].law NE '' THEN BEGIN
  83 + printf,unit,st_align.grains[i].law,st_align.grains[i].athresh,st_align.grains[i].pstiff,st_align.grains[i].plev,format=format
  84 + ENDIF
  85 + ENDIF
  86 + ENDFOR
  87 +ENDELSE
34 88  
35 89 close,unit
36 90 free_lun,unit
37 91  
  92 +the_end:
  93 +
38 94 END
39 95  
... ...
src/idl/dustem_write_all_release.pro
1   -PRO dustem_write_all_release,st,dir_out
  1 +PRO dustem_write_all_release,st,dir_out,help=help
  2 +
  3 +;+
  4 +; NAME:
  5 +; dustem_write_all_release
  6 +; PURPOSE:
  7 +; writes .DAT fiules necessary to run dustem within dustemwrap
  8 +; CATEGORY:
  9 +; DustEMWrap, Distributed, HighLevel, Initialization
  10 +; CALLING SEQUENCE:
  11 +; dustem_write_all_release,st,dir_out
  12 +; INPUTS:
  13 +; st : dustem structure
  14 +; dir_out : output directory where files will be written
  15 +; OPTIONAL INPUT PARAMETERS:
  16 +; None
  17 +; OUTPUTS:
  18 +; None
  19 +; OPTIONAL OUTPUT PARAMETERS:
  20 +; None
  21 +; ACCEPTED KEY-WORDS:
  22 +; help : whrites this help
  23 +; COMMON BLOCKS:
  24 +; None
  25 +; SIDE EFFECTS:
  26 +; Files are written
  27 +; RESTRICTIONS:
  28 +; The DustEM fortran code must be installed
  29 +; The DustEMWrap idl code must be installed
  30 +; PROCEDURES AND SUBROUTINES USED
  31 +; EXAMPLES
  32 +; MODIFICATION HISTORY:
  33 +; Evolution details on the DustEMWrap gitlab.
  34 +; See http://dustemwrap.irap.omp.eu/ for FAQ and help.
  35 +;-
  36 +
  37 +IF keyword_set(help) THEN BEGIN
  38 + doc_library,'dustem_write_all_release'
  39 + goto,the_end
  40 +ENDIF
2 41  
3 42 if strmid(!dustem_dat,0,/reverse) ne '/' then !dustem_dat=!dustem_dat+'/'
4 43  
... ... @@ -52,11 +91,11 @@ dustem_write_calor_lv,dir_out_capa,st.calor
52 91 ;FOR i_axis = 1, 3 DO dustem_write_qabspol,dir_out_qabs,st,i_axis
53 92  
54 93 ;== POL
55   -if !run_pol then begin
  94 +IF !run_pol THEN BEGIN
56 95 ;stop
57 96 file_out=dir_out_dat+'ALIGN.DAT'
58 97 ;stop
59   - ; Pol file
  98 + ;Write the grain alignment file
60 99 dustem_write_align,file_out,st.align
61 100  
62 101 ; Linear polarization
... ... @@ -72,12 +111,12 @@ if !run_pol then begin
72 111 ; RRF Files
73 112 IF stregex(st.align.keywords, 'rrf', /bool) THEN for i_axis = 1, 2 do dustem_write_qpol_rrf,file_out,st,i_axis
74 113  
75   -endif
  114 +ENDIF
76 115  
77 116 ;== TLS
78 117 file_out=dir_out_dat
79 118 dustem_write_tls,dir_out_dat,st.tls
80 119  
81   -sortie:
  120 +the_end:
82 121  
83 122 END
... ...
src/idl/dustem_write_grain_lv.pro
1 1 PRO dustem_write_grain_lv,file,st
2 2  
  3 +message,'This is not used by dustemwrap'
  4 +
3 5 Ncomments=13
4 6 c=strarr(Ncomments)
5 7  
... ... @@ -20,9 +22,11 @@ c(12)='#'
20 22 OPENW,unit,file,/get_lun
21 23  
22 24 FOR i=0,Ncomments-1 DO BEGIN
23   - printf,unit,c(i)
  25 + printf,unit,c[i]
24 26 ENDFOR
25 27  
  28 +stop
  29 +
26 30 printf,unit,st.keywords
27 31 printf,unit,st.G0
28 32 printf,unit,st.ngrains
... ...
src/idl/dustemwrap_plot.pro
... ... @@ -261,11 +261,12 @@ endelse
261 261  
262 262 ;changing tag_exist() by isa() because the user can mistakenly activate the !run_pol keyword
263 263  
264   -If !run_pol THEN BEGIN
265   - If tag_exist(*!dustem_show,'QSED') THEN BEGIN
266   - IF ~isa((*!dustem_data).qsed) THEN !run_pol=0
267   - ENDIF ELSE !run_pol = 0
268   -ENDIF
  264 +;===== commented out by Annie and JP on 17 march 2023
  265 +;If !run_pol THEN BEGIN
  266 +; If tag_exist(*!dustem_show,'QSED') THEN BEGIN
  267 +; IF ~isa((*!dustem_data).qsed) THEN !run_pol=0
  268 +; ENDIF ELSE !run_pol = 0
  269 +;ENDIF
269 270  
270 271 ;===========Window positionning parameters
271 272 if !run_pol and tag_exist(*!dustem_show,'qsed') then BEGIN ;qsed tag is sufficient for the test
... ... @@ -541,7 +542,7 @@ if test_x then begin
541 542  
542 543 ;===========If window not set, create it and plot data anew
543 544 if iswinext then begin
544   -
  545 + ;stop
545 546 cgwindow,wxsize=main_wxsize,wysize=main_wysize,wtitle='DUSTEMWRAP '+!dustem_version.version+' (EXTINCTION)';, wback='grey';,wobject=winobj_m
546 547 winid_x = cgquery(dimensions=dim_x,/current) ;dimension is not used...
547 548 !dustemcgwin_id.ext = winid_x
... ... @@ -828,5 +829,6 @@ if !dustem_end then !dustem_end = -1 ;so that the last iteration is only plotted
828 829  
829 830  
830 831 the_end:
  832 +;stop
831 833  
832 834 END
... ...
src/idl/dustemwrap_plot_noobj.pro
... ... @@ -37,9 +37,9 @@ PRO dustemwrap_plot_noobj, p_dim, $
37 37 ; CALLING SEQUENCE:
38 38 ; dustemwrap_plot_noobj,p_dim,st,dustem_sed,SED_spec,dustem_qsed,Q_spec,dustem_used,U_spec,dustem_polsed,P_spec,dustem_polfrac,SP_spec,dustem_psi_em,PSI_spec,dustem_ext,EXT_spec,dustem_qext,QEXT_spec,dustem_uext,UEXT_spec,dustem_polext,POLEXT_spec,dustem_fpolext,SPEXT_spec,dustem_psi_ext,PSIEXT_spec,_extra=_extra
39 39 ; INPUTS:
40   -; p_dim
  40 +; p_dim = dustemwrap free parameter values
41 41 ; OPTIONAL INPUT PARAMETERS:
42   -; st
  42 +; st = dustemwrap structure.
43 43 ; dustem_sed
44 44 ; dustem_qsed
45 45 ; dustem_used
... ... @@ -53,7 +53,9 @@ PRO dustemwrap_plot_noobj, p_dim, $
53 53 ; dustem_fpolext
54 54 ; dustem_psi_ext
55 55 ; OUTPUTS:
56   -; dustem_sed
  56 +; OPTIONAL OUTPUT PARAMETERS:
  57 +; st = currently returns dustemwrap structure if not provided as an entry.
  58 +; dustem_sed =
57 59 ; dustem_qsed
58 60 ; dustem_used
59 61 ; dustem_polsed
... ... @@ -77,9 +79,6 @@ PRO dustemwrap_plot_noobj, p_dim, $
77 79 ; POLEXT_spec
78 80 ; SPEXT_spec
79 81 ; PSIEXT_spec
80   -; OPTIONAL OUTPUT PARAMETERS:
81   -;
82   -
83 82 ; ACCEPTED KEY-WORDS:
84 83 ; help
85 84 ; COMMON BLOCKS:
... ... @@ -106,65 +105,37 @@ END
106 105 ;This is also necessary for the plotting of the results of the fit (Last iteration)
107 106 IF not keyword_set(st) THEN BEGIN
108 107 ;Activation of the plugins is needed because of the plotting of the total emission model that includes them.
109   - dustem_activate_plugins,p_dim/(*(*!dustem_fit).param_init_values),st=st ; 0/0 division case?
110   -
  108 + dustem_activate_plugins,p_dim/(*(*!dustem_fit).param_init_values),st=st
111 109 ENDIF
112 110  
113   -;# Emission
114   -
115   -if not keyword_set(dustem_sed) and isa((*!dustem_data).sed) then begin ;better test?
116   -
  111 +;==== compute emission and emission polarization SED if not provided
  112 +IF NOT keyword_set(dustem_sed) AND isa((*!dustem_data).sed) THEN BEGIN
117 113 dustem_sed = dustem_compute_sed(p_dim,st=st,SED_spec=SED_spec)
118   -
119   - if !run_pol && !run_lin and tag_exist(*!dustem_show,'qsed') then begin
  114 + IF !run_pol AND !run_lin AND tag_exist(*!dustem_show,'qsed') THEN BEGIN
120 115 dustem_polsed = dustem_compute_polsed(p_dim,st=st,P_spec=P_spec,SP_spec=SP_spec,dustem_polfrac=dustem_polfrac)
121 116 toto = dustem_compute_stokes(p_dim,st=st,Q_spec=Q_spec,U_spec=U_spec,PSI_spec=PSI_spec,dustem_psi_em=dustem_psi_em)
122 117 dustem_qsed = toto[0]
123 118 dustem_used = toto[1]
124   - endif
125   -endif
126   -
127   -;# Extinction
  119 + ENDIF
  120 +ENDIF
128 121  
129   -if not keyword_set(dustem_ext) and isa((*!dustem_data).ext) then begin
  122 +;==== compute extinction and extinction polarization SED if not provided
  123 +IF NOT keyword_set(dustem_ext) AND isa((*!dustem_data).ext) THEN BEGIN
130 124 dustem_ext = dustem_compute_ext(p_dim,st=st,EXT_spec=EXT_spec)
131   -
132   - if !run_pol && !run_lin and tag_exist(*!dustem_show,'qext') then begin
133   -
  125 + IF !run_pol AND !run_lin AND tag_exist(*!dustem_show,'qext') THEN BEGIN
134 126 dustem_polext = dustem_compute_polext(p_dim,st=st,polext_spec=POLEXT_spec,spext_spec=SPEXT_spec,dustem_fpolext=dustem_fpolext)
135   -
136 127 toto = dustem_compute_stokext(p_dim,st=st,QEXT_spec=QEXT_spec,UEXT_spec=UEXT_spec,PSIEXT_spe=PSIEXT_spec,dustem_psi_ext=dustem_psi_ext)
137 128 dustem_qext = toto[0]
138 129 dustem_uext = toto[1]
139   - endif
140   -endif
  130 + ENDIF
  131 +ENDIF
141 132  
142   -
  133 +;==== This section is to keep track of chi2 evolution during fit iterations.
143 134 mouchard=*!iteration_mouchard
144 135 new_mouchard=mouchard[0]
145 136 new_mouchard.iteration=!dustem_iter.act
146 137 new_mouchard.chi2=(*!dustem_fit).chi2
147 138 new_mouchard.rchi2=(*!dustem_fit).rchi2
148   -
149   -
150   -;JPB: need here to store values of current parameter values (including plugins) into !iteration_mouchard
151   -;help,(*!dustem_fit).CURRENT_PARAM_VALUES ;This is not currently filled up ...
152   -
153   -;Below will work only for non plugin parameters
154   -;goto,skip1
155   -;param_descs=*(*!dustem_fit).param_descs
156   -;params_current=[0.D0]
157   -;FOR i=0L,n_elements(param_descs)-1 DO BEGIN
158   -; str='params_current=[params_current,'+param_descs[i]+']'
159   -; print,str
160   -; toto=execute(str)
161   -;ENDFOR
162   -;params_current=params_current[1:*]
163   -;print,params_current
164   -;
165   -;stop
166   -;skip1:
167   -
168 139 mouchard=[mouchard,new_mouchard]
169 140 !iteration_mouchard=ptr_new(mouchard)
170 141  
... ... @@ -282,11 +253,9 @@ TVLCT, 255, 255, 255, 254 ; White color
282 253  
283 254 if test_m then begin
284 255 ;Generating emission window and saving window ID
285   -
286 256 IF !d.name NE 'PS' THEN BEGIN ;What if we're trying to create a ps file with the exact display of the dashboard?
287 257 window,0, xsize=main_wxsize,ysize=main_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (EMISSION)',xpos=0,ypos=0
288 258 ENDIF
289   -
290 259 ;Plotting model string (legend)
291 260 xxpos = 0.015
292 261 yypos = 0.97
... ... @@ -459,15 +428,14 @@ if test_m then begin
459 428 positiveonly=[0] ;kept it for completeness. Also this loop reminds me that JP also wants the user to be able to display one dataset.
460 429 negativeonly=[0]
461 430 ENDELSE
462   -
463 431 ; PLOTTING OF DATA THAT IS UNCHAED
464   - dustem_plot_dataset, st, dataset=datasets, position=position,positive_only=positiveonly,negative_only=negativeonly, _extra=_extra
  432 + dustem_plot_dataset,st,dataset=datasets,position=position $
  433 + ,positive_only=positiveonly,negative_only=negativeonly, _extra=_extra
465 434 ; REFRESHING DATA - to plot the refreshed data for the first time.
466   - dustem_plot_dataset, st, dustem_interp,dustem_spec,extra_spec=extra_spec,dataset=datasets,positive_only=positiveonly,negative_only=negativeonly, /refresh ,position=position, _extra=_extra
467   -
468   -ENDIF
469   -
470   -
  435 + dustem_plot_dataset,st,dustem_interp,dustem_spec,extra_spec=extra_spec $
  436 + ,dataset=datasets,positive_only=positiveonly,negative_only=negativeonly $
  437 + ,/refresh,position=position,_extra=_extra
  438 +ENDIF
471 439  
472 440 ;stop
473 441 if test_x then begin
... ...