Commit ab47fb7c47f968c449b8371580b5596b6b84511f

Authored by Annie Hughes
1 parent e431104b
Exists in master

added NIKA2

Showing 1 changed file with 39 additions and 31 deletions   Show diff stats
src/idl/dustem_cc.pro
... ... @@ -30,8 +30,8 @@ FUNCTION dustem_cc,wavein,spec,filter_names,cc=cc,fluxconv=fluxconv,help=help
30 30 ;
31 31 ; ACCEPTED KEY-WORDS:
32 32 ; fluxconv = if set, these are taken for flux conventions
33   -; possible values: 'nuInu=cste', 'IRAC', 'MIPS', 'CMB',
34   -; 'FLAMBDA=cste', 'HFI', 'LABOCA'
  33 +; possible values: 'nuInu=cste', 'FLAMBDA=cste', 'FLAMBDA=cste'
  34 +; , 'IRAC', 'MIPS', 'CMB', 'HFI', 'LABOCA', 'NIKA2'
35 35 ; help = If set, print this help
36 36 ;
37 37 ; COMMON BLOCKS:
... ... @@ -119,7 +119,7 @@ FOR i=0L,Nbands-1 DO BEGIN
119 119 ; print,'DOING color correction calculations'
120 120 CASE strupcase(fluxconvs[i]) OF
121 121 'HFI0': BEGIN ;This is purely for test (stupid since reads filters each time)
122   - filter_dir=!dustem_wrap_soft_dir+'/Data/FILTERS/'
  122 + filter_dir=!dustem_wrap_soft_dir+'/Data/FILTERS/'
123 123 dir_hfi=filter_dir+'HFI/OFFICIAL'+'/'
124 124 ; CAUTION: This below should be consistent with what is in dustem_read_filters.pro
125 125 ; hfi_filter_version='v101'
... ... @@ -137,40 +137,43 @@ FOR i=0L,Nbands-1 DO BEGIN
137 137 cc[i]=ccc.cc
138 138 END
139 139 'HFI': BEGIN
140   - spec_int=interpol(spec2,wavein2,*(st.use_wavelengths(ii)))
141   - nu=*(st.use_frequencies(ii))/1.d9
142   - trans=*(st.use_transmissions(ii))
143   - order=sort(nu)
144   - spec_int=spec_int(order)
145   - nu=nu(order)
146   - trans=trans(order)
147   - channel=strtrim(round(dustem_filter2freq(filter_names(i))),2)
148   - ccc=hfi_color_correction_dustem(channel,nu,trans,channel, bolo_cc,nu, spec_int)
149   - cc[i]=ccc.cc
  140 + spec_int=interpol(spec2,wavein2,*(st.use_wavelengths(ii)))
  141 + nu=*(st.use_frequencies(ii))/1.d9
  142 + trans=*(st.use_transmissions(ii))
  143 + order=sort(nu)
  144 + spec_int=spec_int(order)
  145 + nu=nu(order)
  146 + trans=trans(order)
  147 + channel=strtrim(round(dustem_filter2freq(filter_names(i))),2)
  148 + ccc=hfi_color_correction_dustem(channel,nu,trans,channel, bolo_cc,nu, spec_int)
  149 + cc[i]=ccc.cc
  150 + END
  151 + 'FNU=CSTE': BEGIN
  152 + beta=0.
  153 + spec_int=interpol(spec2,wavein2,*(st.use_wavelengths[ii]))
  154 + 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)
  155 + den=integral(*(st.use_wavelengths(ii)),((*(st.use_transmissions(ii)))/((*(st.use_wavelengths(ii)))^(2+beta))),st.use_wmin(ii),st.use_wmax(ii),/double)
  156 +; den=integral(*(st.use_wavelengths(ii)),((*(st.use_transmissions(ii)))/(*(st.use_wavelengths(ii)))^2.)),st.use_wmin(ii),st.use_wmax(ii),/double)
  157 +; cc[i]=(num*(st.central_wavelengths[ii])^2)/(spec0*den)
  158 + cc[i]=num/(spec0*den*(st.central_wavelengths[ii])^beta)
150 159 END
151 160 'NUINU=CSTE': BEGIN
  161 + beta=-1.
152 162 spec_int=interpol(spec2,wavein2,*(st.use_wavelengths(ii)))
153 163 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)
154   - den=integral(*(st.use_wavelengths(ii)),(*(st.use_transmissions(ii)))/(*(st.use_wavelengths(ii))),st.use_wmin(ii),st.use_wmax(ii),/double)
155   - cc[i]=num/den/spec0*(st.central_wavelengths(ii))
  164 + den=integral(*(st.use_wavelengths(ii)),((*(st.use_transmissions(ii)))/((*(st.use_wavelengths(ii)))^(2+beta))),st.use_wmin(ii),st.use_wmax(ii),/double)
  165 +; den=integral(*(st.use_wavelengths(ii)),((*(st.use_transmissions(ii)))/(*(st.use_wavelengths(ii)))^1.)),st.use_wmin(ii),st.use_wmax(ii),/double)
  166 +; cc[i]=num/den/spec0*(st.central_wavelengths(ii))
  167 + cc[i]=num/(spec0*den*(st.central_wavelengths[ii])^beta)
156 168 END
157 169 'FLAMBDA=CSTE': BEGIN
158   -; stop
  170 + beta=-2.
159 171 spec_int=interpol(spec2,wavein2,*(st.use_wavelengths[ii]))
160 172 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)
161   - den=integral(*(st.use_wavelengths[ii]),(*(st.use_transmissions[ii])),st.use_wmin[ii],st.use_wmax[ii],/double)
162   -; print,st.use_wmin[ii],st.use_wmax[ii]
163   -; print,st.central_wavelengths[ii]
164   -; t=*(st.use_transmissions[ii])
165   -; w=*(st.use_wavelengths[ii])
166   -; xx=where(t gt 0)
167   -; print,min(w[xx]),max(w[xx])
168   -; stop
169   -; print,spec0*den
170   -; stop
171   - cc[i]=(num*(st.central_wavelengths[ii])^2)/(spec0*den)
172   -; print,filter_names[i],st.central_wavelengths[ii],cc[i],st.use_wmin[ii],st.use_wmax[ii],minmax(*(st.use_wavelengths[ii]))
173   -; stop
  173 + den=integral(*(st.use_wavelengths(ii)),((*(st.use_transmissions(ii)))/((*(st.use_wavelengths(ii)))^(2+beta))),st.use_wmin(ii),st.use_wmax(ii),/double)
  174 +; den=integral(*(st.use_wavelengths[ii]),(*(st.use_transmissions[ii])),st.use_wmin[ii],st.use_wmax[ii],/double)
  175 +; cc[i]=(num*(st.central_wavelengths[ii])^2)/(spec0*den)
  176 + cc[i]=num/(spec0*den*(st.central_wavelengths[ii])^beta)
174 177 END
175 178 'MIPS': BEGIN
176 179 expon=exp(fact/(*(st.use_wavelengths(ii))*1e-6*fact3))-1.
... ... @@ -197,13 +200,18 @@ FOR i=0L,Nbands-1 DO BEGIN
197 200 ; num=integral(*(st.use_wavelengths(ii)),spec_int*(*(st.use_transmissions(ii))),st.use_wmin(ii),st.use_wmax(ii),/double)
198 201 ; den=integral(*(st.use_wavelengths(ii)),*(st.use_transmissions(ii))/(*(st.use_wavelengths(ii))^2.5),st.use_wmin(ii),st.use_wmax(ii),/double)
199 202 ; cc(i)=num/den/spec0/(st.central_wavelengths(ii))^2.5
200   -
201 203 alpha_new=0.
202 204 spec_int=interpol(spec2,wavein2,*(st.use_wavelengths(ii)))
203 205 num=integral(*(st.use_wavelengths(ii)),spec_int*(*(st.use_transmissions(ii)))/(*(st.use_wavelengths(ii))),st.use_wmin(ii),st.use_wmax(ii),/double)
204 206 den=integral(*(st.use_wavelengths(ii)),*(st.use_transmissions(ii))/(*(st.use_wavelengths(ii))^(alpha_new+2.)),st.use_wmin(ii),st.use_wmax(ii),/double)
205 207 cc[i]=num/den/spec0*(st.central_wavelengths(ii))^(-(alpha_new+1.))
206   -
  208 + END
  209 + 'NIKA2': BEGIN
  210 + beta=1.6
  211 + spec_int=interpol(spec2,wavein2,*(st.use_wavelengths(ii)))
  212 + 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)
  213 + den=integral(*(st.use_wavelengths(ii)),((*(st.use_transmissions(ii)))/((*(st.use_wavelengths(ii)))^(2+beta))),st.use_wmin(ii),st.use_wmax(ii),/double)
  214 + cc[i]=num/(spec0*den*(st.central_wavelengths[ii])^beta)
207 215 END
208 216 ELSE:BEGIN
209 217 message,strupcase(fluxconvs[i])+' not recognized',/info
... ...