Commit 39cfd6cf646df84e07225acb0f3a2c399a08dfda

Authored by Annie Hughes
2 parents 9c053027 933ab1ab
Exists in master

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

instrument_description.xcat
... ... @@ -174,11 +174,11 @@ SPASS SPASS1 130174.74 MJy/sr NULL 0.14833333 5.
174 174 \========= ZOA-FF (free free from Alves, M. I. R., et al, 2015, MNRAS, 450, 2025) ==========
175 175 \information taken from Alves, M. I. R., et al, 2015, MNRAS, 450, 2025
176 176 \flux convention does not really matter (narrow band of ? MHz for 1.4 GHz)
177   -CHIPASS ZOA_FF1 214286. MJy/sr NULL 0.24 5.0
  177 +\CHIPASS ZOA_FF1 214286. MJy/sr NULL 0.24 5.0
178 178 \========= CHI-PASS ==========
179 179 \information taken from Calabretta, M. et al. 2014, PASA, 31, 7
180 180 \flux convention does not really matter (narrow band of ? MHz for 1.4 GHz)
181   -CHIPASS CHIPASS1 214286. MJy/sr NULL 0.24 5.0
  181 +CHIPASS CHIPASS1 214286. MJy/sr NULL 0.24 5.0
182 182 \========= IRAC ====================================================================================================
183 183 \resolution taken to be 1.7, 1.7, 1.9, 2" (eg Meixner et al)
184 184 IRAC IRAC1 3.55000 MJy/sr IRAC 0.000472222
... ...
src/idl/Markwardt_for_Dustemwrap/dustem_mpfit.pro
... ... @@ -3571,7 +3571,19 @@ function dustem_mpfit, fcn, xall, FUNCTARGS=fcnargs, SCALE_FCN=scalfcn, $
3571 3571 ;#iterations
3572 3572 !dustem_iter.act=iter
3573 3573 ;#current parameter values
3574   - (*!dustem_fit).current_param_values=ptr_new(x*(*(*!dustem_fit).param_init_values));So that parameters aren't just passed directly from MPFIT. ALSO allows to test with !dustem_current
  3574 + ;JPB: Below is because whene there are fixed parameters, x and (*!dustem_fit) don't have same number of elements.
  3575 + ;JPB: in principle, we should not have modified the code of mpfit for dustem.
  3576 + ;JPB: The same should be achievable using keywords as iterproc
  3577 + IF keyword_set(parinfo) THEN BEGIN
  3578 + xx=dblarr(n_elements(parinfo))
  3579 + ind1=where(parinfo.fixed EQ 0,count1,complement=ind2,Ncomplement=count2)
  3580 + IF count1 NE 0 THEN xx[ind1]=x
  3581 + IF count2 NE 0 THEN xx[ind2]=parinfo[ind2].value
  3582 + ENDIF ELSE BEGIN
  3583 + xx=x
  3584 + ENDELSE
  3585 + ;stop
  3586 + (*!dustem_fit).current_param_values=ptr_new(xx*(*(*!dustem_fit).param_init_values));So that parameters aren't just passed directly from MPFIT. ALSO allows to test with !dustem_current
3575 3587 ; ;#Current parameter errors
3576 3588  
3577 3589 if n_elements(fnorm) GT 0 AND n_elements(fnorm1) GT 0 then begin
... ...
src/idl/dustem_init_parinfo.pro
... ... @@ -7,7 +7,7 @@ PRO dustem_init_parinfo,pd,iv, $
7 7  
8 8 (*!dustem_fit).param_init_values=ptr_new(iv)
9 9  
10   -(*!dustem_fit).current_param_values = ptr_new(iv/iv)
  10 +(*!dustem_fit).current_param_values = ptr_new(iv/iv) ;These are normalized to the initial values
11 11 ;stop
12 12 dustem_set_func_ind,pd,iv
13 13  
... ...
src/idl/dustem_mpfit_data.pro
... ... @@ -132,6 +132,8 @@ p_min = dustem_mpfitfun(func_name,wav,values,sigma, $
132 132 maxiter=use_Nitermax,gtol=gtol,errmsg=errmsg,functargs=_extra,nocatch=nocatch)
133 133  
134 134 ;stop
  135 +;!dustem_iter.act=niter_completed
  136 +
135 137 message,errmsg,/info
136 138 message,'mpfitfun Status='+strtrim(status,2),/info
137 139 p_dim=p_min*(*(*!dustem_fit).param_init_values)
... ... @@ -151,7 +153,7 @@ IF !dustem_noobj THEN BEGIN
151 153 dustemwrap_plot,p_dim,stp,_extra=_extra
152 154 ENDELSE
153 155  
154   - the_end:
  156 +the_end:
155 157 RETURN, p_dim
156 158  
157 159 END
... ...
src/idl/dustem_mpfit_run.pro
... ... @@ -111,8 +111,10 @@ FOR i_tag=0,count_data_tag-1 DO BEGIN
111 111  
112 112 'SED' : BEGIN
113 113 dustem_sed = dustem_compute_sed(p_dim,st=st,SED_spec=SED_spec)
  114 + ;help,*(*!dustem_fit).CURRENT_PARAM_VALUES
  115 + ;stop
114 116 chi2_sed = total(((*(*!dustem_data).sed).values-dustem_sed)^2/(*(*!dustem_data).sed).sigma^2)
115   - n_sed = n_elements((*(*!dustem_data).sed).values)
  117 + n_sed = n_elements((*(*!dustem_data).sed).values)
116 118 rchi2_sed = chi2_sed / n_sed
117 119 wrchi2_sed = rchi2_sed * (*!fit_rchi2_weight).sed
118 120 message,"chi2 SED = "+strtrim(chi2_sed,2)+" rchi2 SED = "+strtrim(rchi2_sed,2),/continue;," weighted rchi2 SED=",wrchi2_sed
... ...
src/idl/dustem_plugin_stellar_population.pro
... ... @@ -92,10 +92,14 @@ IF keyword_set(key) THEN BEGIN
92 92  
93 93 ;JPB: This is highly non standard and makes Fawlty go "Segmentation fault"
94 94 ;lumclass = (strmid(key,2)).remove(-1) ; extracting the luminosity class strings
  95 + ;IC: Yes but we need to take into account when luminosity class is two characters and not just one. ie: IV instead of V.
  96 + ;But since we only have MS (V) data, (lumclass[i]=strmid(key[i],2,1)) should be ok but I'm correcting it for future input.
95 97 lumclass=strarr(n_elements(key))
96 98 FOR i=0L,n_elements(key)-1 DO BEGIN
97   - lumclass[i]=strmid(key[i],2,1)
  99 + lumclass[i]=strmid(key[i],2,strlen(key[i])-3)
98 100 ENDFOR
  101 +
  102 +
99 103 params = strmid(key,0,/reverse_offset) ; extracting the indices (in the 'key' array) of the stellar parameters to fit
100 104  
101 105 ; Locating the O3 stellar population parameters - this new code structure accounts for the presence of different luminosity classes.
... ...
src/idl/dustem_read_filters.pro
... ... @@ -816,6 +816,30 @@ spass_struct={Name:'SPASS',Nbands:Nband,filter_names:filt_names,central_waveleng
816 816 use_frequencies:use_nu,use_transmissions:use_T,use_wavelengths:use_w,use_wmin:dblarr(Nband),use_wmax:dblarr(Nband),cc_method:'dustem_cc_spass'}
817 817  
818 818 ;======================================================
  819 +;==== CHIPASS
  820 +;======================================================
  821 +IF print_messages THEN message,'Reading CHIPASS filters',/continue
  822 +
  823 +Nband=1
  824 +filt_names=['CHIPASS1']
  825 +wfilt_chipass=dustem_filter2wav(filt_names)
  826 +wav_ptr=ptrarr(Nband)
  827 +nu_ptr=ptrarr(Nband) & T_ptr=ptrarr(Nband) & wav_ptr=ptrarr(Nband)
  828 +use_nu=ptrarr(Nband) & use_T=ptrarr(Nband) & use_w=ptrarr(Nband)
  829 +
  830 +;===== This is set on purpose to the SPASS directory.
  831 +st=read_xcat(dir_spass+'SPASS_transmission.xcat',/silent)
  832 +
  833 +freq=st.frequency*1.e9 ;Hz
  834 +Trans=st.transmission
  835 +
  836 +T_ptr(0)=ptr_new(Trans/max(Trans)) & nu_ptr(0)=ptr_new(freq) & wav_ptr(0)=ptr_new(cmic/freq)
  837 +
  838 +chipass_struct={Name:'CHIPASS',Nbands:Nband,filter_names:filt_names,central_wavelengths:wfilt_chipass,central_frequencies:cmic/wfilt_spass, $
  839 + filter_wavelengths:wav_ptr,filter_frequencies:nu_ptr,filter_transmissions:T_ptr, $
  840 + use_frequencies:use_nu,use_transmissions:use_T,use_wavelengths:use_w,use_wmin:dblarr(Nband),use_wmax:dblarr(Nband),cc_method:'dustem_cc_spass'}
  841 +
  842 +;======================================================
819 843 ;==== NIKA2
820 844 ;======================================================
821 845 IF print_messages THEN message,'Reading NIKA2 filters',/continue
... ... @@ -1045,6 +1069,7 @@ dm_filter_struct={ $
1045 1069 LABOCA:laboca_struct, $
1046 1070 GISMO:gismo_struct, $
1047 1071 SPASS:spass_struct, $
  1072 + CHIPASS:chipass_struct, $
1048 1073 NIKA2:nika2_struct, $
1049 1074 SCUBA2:scuba2_struct, $
1050 1075 IRS:irs_struct, $
... ...
src/idl/dustem_show_file_dependencies.pro
... ... @@ -72,7 +72,9 @@ dustem_fit_ext_pol_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile3.fi
72 72 dustem_fit_sed_ext_pol_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile4.fits'
73 73 dustem_fit_intensity_mbb_example,Nitermax=1,postscript='/tmp/dustemwrap_postcript_example.ps'
74 74 ;=== for some reason plot goes red here under fawlty
  75 +;=== and fails when run with only the minimal dustemwrap installed (stellar . txt file is missing)
75 76 dustem_myisrf_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile5.fits'
  77 +;=== fails when run with only the minimal dustemwrap installed (stellar . txt file is missing)
76 78 dustem_stellarpopisrf_example,Nitermax=1,fits_save_and_restore='/tmp/mysavefile6.fits'
77 79 dustem_fit_intensity_example,Nitermax=1,/noobj
78 80  
... ...