Commit f0ac8429e6c266779ab6e754fcf9ed03d33b0a04

Authored by Jean-Philippe Bernard
1 parent 3dd007df
Exists in master

forced ordering of filter wavelengths, to avoid gdl message when interpolating

src/idl/dustem_filter_init.pro
... ... @@ -46,35 +46,52 @@ IF keyword_set(help) THEN BEGIN
46 46 goto,the_end
47 47 ENDIF
48 48  
  49 +order_by_wavelength=1 ;to order all transmissions by increasing wavelength
  50 +
49 51 ;=== Read all filters
50 52 st=dustem_read_filters()
51 53 !dustem_filters=ptr_new(st)
52 54  
  55 +;======================================================
  56 +;==== order by increasing wavelength if needed
  57 +;======================================================
  58 +IF order_by_wavelength EQ 1 THEN BEGIN
  59 + filter_names=tag_names((*!dustem_filters))
  60 + FOR i=0L,n_tags(*!dustem_filters)-1 DO BEGIN
  61 + FOR j=0L,(*!dustem_filters).(i).Nbands-1 DO BEGIN
  62 + ;message,'Ordering '+filter_names[i]+strtrim(j+1,2),/continue
  63 + transmissions=*((*!dustem_filters).(i).filter_transmissions(j))
  64 + wavelengths=*((*!dustem_filters).(i).filter_wavelengths(j))
  65 + frequencies=*((*!dustem_filters).(i).filter_frequencies(j))
  66 + order=sort(wavelengths)
  67 + wavelengths=wavelengths[order]
  68 + transmissions=transmissions[order]
  69 + frequencies=frequencies[order]
  70 + un=uniq(wavelengths)
  71 + wavelengths=wavelengths[un]
  72 + transmissions=transmissions[un]
  73 + frequencies=frequencies[un]
  74 + ((*!dustem_filters).(i).filter_transmissions(j))=ptr_new(transmissions)
  75 + ((*!dustem_filters).(i).filter_wavelengths(j))=ptr_new(wavelengths)
  76 + ((*!dustem_filters).(i).filter_frequencies(j))=ptr_new(frequencies)
  77 + ENDFOR
  78 + ENDFOR
  79 +ENDIF
  80 +
53 81 ;== run standard model to set the wavelengths used by Dustem
54 82 ;== This is needed to integrate the spectrum accurately in the filters
55 83 IF not keyword_set(dir) THEN BEGIN
56 84 CASE !dustem_which OF
57   -; CASE getenv('DUSTEM_WHICH') OF
58 85 'DESERT':dir_in=!dustem_soft_dir+'DESERT_POST_ISO_MORE/'
59 86 'COMPIEGNE': dir_in=!dustem_soft_dir+'MC_DAT/'
60 87 'VERSTRAETE': dir_in=!dustem_soft_dir+'d_3.5/'
61 88 'WEB3p8': dir_in=!dustem_soft_dir
62   -; 'WEB3p8': dir_in=!dustem_soft_dir+'/src/dustem3.8_web/'
63   -; 'DESERT':dir_in=getenv('DUSTEM_SOFT_DIR')+'DESERT_POST_ISO_MORE/'
64   -; 'COMPIEGNE': dir_in=getenv('DUSTEM_SOFT_DIR')+'MC_DAT/'
65   -; 'VERSTRAETE': dir_in=getenv('DUSTEM_SOFT_DIR')+'d_3.5/'
66   -; 'WEB3p8': dir_in=getenv('DUSTEM_SOFT_DIR')+'/src/dustem3.8_web/'
67 89 ELSE: dir_in=!dustem_soft_dir+'/Data/les_DAT/'
68   -; ELSE: dir_in=getenv('DUSTEM_SOFT_DIR')+'/Data/les_DAT/'
69 90 ENDCASE
70 91 ENDIF ELSE BEGIN
71 92 dir_in=!dustem_soft_dir
72   -; dir_in=!dustem_soft_dir+'/src/dustem3.8_web/'
73   -; dir_in=getenv('DUSTEM_SOFT_DIR')+'/src/dustem3.8_web/'
74   -; dir_in=getenv('DUSTEM_SOFT_DIR')+'/Data/'+dir
75 93 ENDELSE
76 94  
77   -;CASE getenv('DUSTEM_WHICH') OF
78 95 CASE !dustem_which OF
79 96 'WEB3p8':BEGIN
80 97 dir_in_qabs=dir_in+'/oprop/'
... ... @@ -84,7 +101,6 @@ CASE !dustem_which OF
84 101 dustem_waves=st_lambda.lambda
85 102 END
86 103 ELSE: BEGIN
87   -; dir_out=getenv('DUSTEM_DAT')
88 104 dir_out=!dustem_dat
89 105 st_model=dustem_read_all(dir_in,/silent)
90 106 dustem_write_all,st_model,dir_out
... ... @@ -95,10 +111,11 @@ ENDCASE
95 111  
96 112 cmic=2.9979246D14
97 113  
98   -;== Fill in the !dustem_filters structure
  114 +;== interpolating transmission on use_waavelengths
  115 +filter_names=tag_names((*!dustem_filters))
99 116 FOR i=0L,n_tags(*!dustem_filters)-1 DO BEGIN
100 117 FOR j=0L,(*!dustem_filters).(i).Nbands-1 DO BEGIN
101   -; all_waves=[*((*!dustem_filters).(i).filter_wavelengths(j)),st.sed.wav]
  118 + ;message,'Doing '+filter_names[i]+strtrim(j+1,2),/continue
102 119 all_waves=[*((*!dustem_filters).(i).filter_wavelengths(j)),dustem_waves]
103 120 order=sort(all_waves)
104 121 all_waves=all_waves(order)
... ... @@ -109,9 +126,11 @@ FOR i=0L,n_tags(*!dustem_filters)-1 DO BEGIN
109 126 all_waves=all_waves(ind)
110 127 ind=where(all_waves GE min(*((*!dustem_filters).(i).filter_wavelengths(j))) AND $
111 128 all_waves LE max(*((*!dustem_filters).(i).filter_wavelengths(j))),count)
112   - all_waves=all_waves(ind)
  129 + all_waves=all_waves[ind]
  130 + all_frequencies=cmic/all_waves
  131 + ;==== fill up structure and interpol in wavelengths
113 132 (*!dustem_filters).(i).use_wavelengths(j)=ptr_new(all_waves)
114   - (*!dustem_filters).(i).use_frequencies(j)=ptr_new(cmic/all_waves)
  133 + (*!dustem_filters).(i).use_frequencies(j)=ptr_new(all_frequencies)
115 134 (*!dustem_filters).(i).use_transmissions(j)=ptr_new(interpol(*((*!dustem_filters).(i).filter_transmissions(j)), $
116 135 *((*!dustem_filters).(i).filter_wavelengths(j)), $
117 136 *((*!dustem_filters).(i).use_wavelengths(j))))
... ...
src/idl/dustem_read_filters.pro
... ... @@ -50,6 +50,7 @@ ccm=2.9979246D10
50 50  
51 51 ;which_hfi_filters='GL'
52 52 which_hfi_filters='OFFICIAL'
  53 +print_messages=0 ;to print filter names when reading filters
53 54  
54 55 ;======================================================
55 56 ;==== directories containing filter information
... ... @@ -85,7 +86,7 @@ dir_irs=filter_dir+'IRS'+'/'
85 86 ;======================================================
86 87 ;==== Herschel PACS
87 88 ;======================================================
88   -
  89 +IF print_messages THEN message,'Reading PACS filters',/continue
89 90 ;Read Herschel PACS filter Transmission
90 91 ;wfilt_pacs=[75,110,170.] ;microns
91 92 filt_names=['PACS1','PACS2','PACS3']
... ... @@ -124,6 +125,7 @@ pacs_struct={Name:'PACS',Nbands:Nband,filter_names:filt_names,central_wavelength
124 125 ;==== Herschel SPIRE
125 126 ;======================================================
126 127 ;stop
  128 +IF print_messages THEN message,'Reading SPIRE filters',/continue
127 129 filt_names=['SPIRE1','SPIRE2','SPIRE3']
128 130 wfilt_spire=dustem_filter2wav(filt_names)
129 131 Nband=n_elements(filt_names)
... ... @@ -162,6 +164,7 @@ spire_struct={Name:'SPIRE',Nbands:Nband,filter_names:filt_names,central_waveleng
162 164 ;======================================================
163 165 ;==== WMAP
164 166 ;======================================================
  167 +IF print_messages THEN message,'Reading WMAP filters',/continue
165 168  
166 169 ;Read WMAP filter Transmission
167 170 filt_names=['WMAP1','WMAP2','WMAP3','WMAP4','WMAP5']
... ... @@ -194,6 +197,7 @@ wmap_struct={Name:'WMAP',Nbands:Nband,filter_names:filt_names,central_wavelength
194 197 ;======================================================
195 198 ;==== Spitzer IRAC
196 199 ;======================================================
  200 +IF print_messages THEN message,'Reading IRAC filters',/continue
197 201  
198 202 ;Read Spitzer IRAC filter Transmission
199 203 ;Strongly inspired from N. Flagey's routine get_irac_flux.pro
... ... @@ -217,6 +221,7 @@ irac_struct={Name:'Spitzer-IRAC',Nbands:Nband,filter_names:filt_names,central_wa
217 221 ;======================================================
218 222 ;==== Spitzer MIPS
219 223 ;======================================================
  224 +IF print_messages THEN message,'Reading MIPS filters',/continue
220 225  
221 226 ;Read Spitzer MIPS filter Transmission
222 227 ;Strongly inspired from N. Flagey's routine get_mips_flux.pro
... ... @@ -239,6 +244,7 @@ mips_struct={Name:'Spitzer-MIPS',Nbands:Nband,filter_names:filt_names,central_wa
239 244 ;======================================================
240 245 ;==== MSX
241 246 ;======================================================
  247 +IF print_messages THEN message,'Reading MSX filters',/continue
242 248  
243 249 ;Read MSX filter Transmission
244 250 ;Strongly inspired from N. Flagey's routine get_msx_flux.pro
... ... @@ -262,6 +268,8 @@ msx_struct={Name:'MSX',Nbands:Nband,filter_names:filt_names,central_wavelengths:
262 268 ;======================================================
263 269 ;==== BOLOCAM
264 270 ;======================================================
  271 +IF print_messages THEN message,'Reading BOLOCAM filters',/continue
  272 +
265 273 filt_names=['BOLOCAM1']
266 274 wfilt=dustem_filter2wav(filt_names)
267 275 Nband=n_elements(filt_names)
... ... @@ -277,6 +285,7 @@ bolocam_struct={Name:'BOLOCAM',Nbands:Nband,filter_names:filt_names,central_wave
277 285 ;======================================================
278 286 ;==== Pronaos-SPM
279 287 ;======================================================
  288 +IF print_messages THEN message,'Reading SPM filters',/continue
280 289  
281 290 ;Read SPM filter Transmission
282 291 filt_names=['SPM1','SPM2','SPM3','SPM4']
... ... @@ -307,6 +316,7 @@ spm_struct={Name:'PRONAOS-SPM',Nbands:Nband,filter_names:filt_names,central_wave
307 316 ;======================================================
308 317 ;==== Akari
309 318 ;======================================================
  319 +IF print_messages THEN message,'Reading Akari filters',/continue
310 320  
311 321 ;written by Ryou Ohsawa
312 322 ;Bugs corrected by Deborah Paradis
... ... @@ -338,6 +348,8 @@ akari_struct={Name:'AKARI',Nbands:Nband,filter_names:filt_names,central_waveleng
338 348 ;======================================================
339 349 ;==== IRAS
340 350 ;======================================================
  351 +IF print_messages THEN message,'Reading IRAS filters',/continue
  352 +
341 353 Nband=4
342 354 filt_names=['IRAS1','IRAS2','IRAS3','IRAS4']
343 355 wfilt_iras=dustem_filter2wav(filt_names)
... ... @@ -361,6 +373,8 @@ iras_struct={Name:'IRAS',Nbands:Nband,filter_names:filt_names,central_wavelength
361 373 ;======================================================
362 374 ;==== DIRBE
363 375 ;======================================================
  376 +IF print_messages THEN message,'Reading DIRBE filters',/continue
  377 +
364 378 file=dir_dirbe+'dirbe_response.asc'
365 379 readcol,file,wavemic,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,/silent
366 380 ind=where(wavemic GT 1 AND wavemic LT 500,count)
... ... @@ -391,6 +405,8 @@ dirbe_struct={Name:'DIRBE',Nbands:Nband,filter_names:filt_names,central_waveleng
391 405 ;======================================================
392 406 ;==== ARCHEOPS
393 407 ;======================================================
  408 +IF print_messages THEN message,'Reading ARCHEOPS filters',/continue
  409 +
394 410 Nband=4
395 411 filt_names=['ARCHEOPS4','ARCHEOPS3','ARCHEOPS2','ARCHEOPS1']
396 412 wfilt_archeops=dustem_filter2wav(filt_names)
... ... @@ -421,6 +437,7 @@ archeops_struct={Name:'ARCHEOPS',Nbands:Nband,filter_names:filt_names,central_wa
421 437 ;Filters for each detectors are just averaged simply
422 438 ;PSBs are taken the same way as other bolometers, which
423 439 ;is probably wrong for Intensity (should devide them by 2) ...
  440 +IF print_messages THEN message,'Reading HFI filters',/continue
424 441  
425 442 Nband=6
426 443 filt_names=['HFI6','HFI5','HFI4','HFI3','HFI2','HFI1']
... ... @@ -504,6 +521,7 @@ hfi_struct={Name:'HFI',Nbands:Nband,filter_names:filt_names,central_wavelengths:
504 521 ;======================================================
505 522 ;Obtained from Marco Bersaneli, via Cyril Roset
506 523 ;Filters for each detectors are just averaged simply
  524 +IF print_messages THEN message,'Reading LFI filters',/continue
507 525  
508 526 Nband=3
509 527 filt_names=['LFI3','LFI2','LFI1']
... ... @@ -540,6 +558,8 @@ lfi_struct={Name:'LFI',Nbands:Nband,filter_names:filt_names,central_wavelengths:
540 558 ;======================================================
541 559 ;==== ISOCAM
542 560 ;======================================================
  561 +IF print_messages THEN message,'Reading ISOCAM filters',/continue
  562 +
543 563 file=dir_iso+'cam_filter_transmission.save'
544 564 restore,file
545 565 Nband_sw=11
... ... @@ -582,6 +602,8 @@ isocam_struct={Name:'ISOCAM',Nbands:Nband,filter_names:filt_names, $
582 602 ;======================================================
583 603 ;==== ISOphotP
584 604 ;======================================================
  605 +IF print_messages THEN message,'Reading ISOPHOTP filters',/continue
  606 +
585 607 ;Obtained from R. Laureijs email to JPB on March 10 2011
586 608 filt_names='ISOPHOTP'+['1', '2', '3', '4', '5', '6', '7', '8', '9', '10','11','12','13','14']
587 609 band_names='P*'+ ['3_29','3_6','4_85','7_3','7_7','10','11_3','11_5','12_8','16','20','25','60','100']+'FM_R.DAT'
... ... @@ -606,6 +628,8 @@ isophotP_struct={Name:'ISOPHOTP',Nbands:Nband,filter_names:filt_names,central_wa
606 628 ;======================================================
607 629 ;==== ISOphotC
608 630 ;======================================================
  631 +IF print_messages THEN message,'Reading ISOPHOTC filters',/continue
  632 +
609 633 ;Obtained from R. Laureijs email to JPB on March 10 2011
610 634 filt_names='ISOPHOTC'+['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11']
611 635 band_names='C_*'+ ['50','60','70','90','100','105','120','135','160','180','200']+'FM_R.DAT'
... ... @@ -630,6 +654,8 @@ isophotC_struct={Name:'ISOPHOTC',Nbands:Nband,filter_names:filt_names,central_wa
630 654 ;======================================================
631 655 ;==== FIRAS
632 656 ;======================================================
  657 +IF print_messages THEN message,'Reading equivalent FIRAS filters',/continue
  658 +
633 659 ;Equivalent FIRAS filters (used in Boulanger et al 90)
634 660 ;Defined as top-hat filters with 30% bandwidth (although not given in
635 661 ;Boulanger et al).
... ... @@ -661,6 +687,8 @@ efiras_struct={Name:'EFIRAS',Nbands:Nband,filter_names:filt_names,central_wavele
661 687 ;======================================================
662 688 ;==== WISE
663 689 ;======================================================
  690 +IF print_messages THEN message,'Reading WISE filters',/continue
  691 +
664 692 Nband=4
665 693 filt_names=['WISE1','WISE2','WISE3','WISE4']
666 694 wfilt_wise=dustem_filter2wav(filt_names)
... ... @@ -684,6 +712,8 @@ wise_struct={Name:'WISE',Nbands:Nband,filter_names:filt_names,central_wavelength
684 712 ;======================================================
685 713 ;==== LABOCA
686 714 ;======================================================
  715 +IF print_messages THEN message,'Reading LABOCA filters',/continue
  716 +
687 717 Nband=1
688 718 filt_names=['LABOCA1']
689 719 wfilt_laboca=dustem_filter2wav(filt_names)
... ... @@ -702,6 +732,8 @@ laboca_struct={Name:'LABOCA',Nbands:Nband,filter_names:filt_names,central_wavele
702 732 ;======================================================
703 733 ;==== GISMO
704 734 ;======================================================
  735 +IF print_messages THEN message,'Reading GISMO filters',/continue
  736 +
705 737 Nband=1
706 738 filt_names=['GISMO1']
707 739 wfilt_gismo=dustem_filter2wav(filt_names)
... ... @@ -720,6 +752,8 @@ gismo_struct={Name:'GISMO',Nbands:Nband,filter_names:filt_names,central_waveleng
720 752 ;======================================================
721 753 ;==== SPASS
722 754 ;======================================================
  755 +IF print_messages THEN message,'Reading SPASS filters',/continue
  756 +
723 757 Nband=1
724 758 filt_names=['SPASS1']
725 759 wfilt_spass=dustem_filter2wav(filt_names)
... ... @@ -741,6 +775,8 @@ spass_struct={Name:'SPASS',Nbands:Nband,filter_names:filt_names,central_waveleng
741 775 ;======================================================
742 776 ;==== NIKA2
743 777 ;======================================================
  778 +IF print_messages THEN message,'Reading NIKA2 filters',/continue
  779 +
744 780 ;# NIKA1200
745 781 ;# photon
746 782 ;# Average of array 1 and array3 of NIKA2, 1.2mm arrays
... ... @@ -772,6 +808,8 @@ nika2_struct={Name:'NIKA2',Nbands:Nband,filter_names:filt_names,central_waveleng
772 808 ;======================================================
773 809 ;==== SCUBA2
774 810 ;======================================================
  811 +IF print_messages THEN message,'Reading SCUBA2 filters',/continue
  812 +
775 813 Nband=1
776 814 filt_names=['SCUBA21']
777 815 wfilt_spass=dustem_filter2wav(filt_names)
... ... @@ -792,6 +830,8 @@ scuba2_struct={Name:'SCUBA2',Nbands:Nband,filter_names:filt_names,central_wavele
792 830 ;======================================================
793 831 ;==== IRS
794 832 ;======================================================
  833 +IF print_messages THEN message,'Reading IRS filters',/continue
  834 +
795 835 ;# IRS16
796 836 ;# energy
797 837 ;# Spitzer IRS 16 micron
... ... @@ -837,7 +877,6 @@ dm_filter_struct={IRAC:irac_struct,MIPS:mips_struct,MSX:msx_struct,IRAS:iras_str
837 877 ;======================================================
838 878 ;==== plot transmissions
839 879 ;======================================================
840   -
841 880 IF keyword_set(plot_it) THEN BEGIN
842 881 xtit=textoidl('\lambda (\mum)')
843 882 ytit='Filter transmission'
... ...