Blame view

src/idl/Other/read_draine_qabs.pro 1.11 KB
427f1205   Jean-Michel Glorian   version 4.2 merged
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FUNCTION read_draine_qabs,file

silent=1

;==== SiC

;Wed Jun  2 11:05:12 EDT 1993
;alpha-SiC                               
;Computed by B.T.Draine (cf Laor, A., & Draine, B.T. 1993, ApJ 402,441)
;  21 1.000E-03 1.000E+01 = NRAD, a_1 (micron), a_NRAD (micron)
; 241 1.000E+03 1.000E-03 = NWAV, w_1 (micron), w_NWAV (micron)

readcol,file,wav_mu,Qabs,Qsca,g,silent=silent
Nl=n_elements(wav_mu)

str=''
OPENR,unit,file,/get_lun
pos=-1
WHILE pos EQ -1 DO BEGIN
  readf,unit,str
  pos=strpos(str,'NRAD')
ENDWHILE
;FOR i=0,3 DO readf,unit,str
CLOSE,unit
free_lun,unit
sstr=strcompress(str)
sstr=strtrim(sstr,2)
try=str_sep(sstr,' ')
Nsize=long(try(0))
Size_min=float(try(1))
Size_max=float(try(2))

Nli=Nl/Nsize

one_st={size:0.,wav_mu:fltarr(Nli),qabs:fltarr(Nli),Qsca:fltarr(Nli),g:fltarr(Nli)}
st=replicate(one_st,Nsize)
lnsizes=findgen(Nsize)/(1.*Nsize-1)*(alog10(Size_max)-alog10(Size_min))+alog10(Size_min)
sizes=10^lnsizes

from=0L
FOR i=0,Nsize-1 DO BEGIN
  to=from+Nli-1
  st(i).size=sizes(i)
  st(i).wav_mu=wav_mu(from:to)
  st(i).qabs=Qabs(from:to)
  st(i).qsca=Qsca(from:to)
  st(i).g=g(from:to)
  from=to+1
ENDFOR

RETURN,st

END