-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqlookup.pro
More file actions
185 lines (149 loc) · 6.6 KB
/
Copy pathqlookup.pro
File metadata and controls
185 lines (149 loc) · 6.6 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
; +
; NAME
; qlookup
;
; PURPOSE
; Recover/calculate silicate features given basic grain properties
;
; INPUTS
; GRAINRAD: Radius of grains
; WAVELENGTH: Array of wavelengths to be modeled
; OLIVRATIO: Ratio of olivine, w.r.t. number density.
; Assume the rest is pyroxene.
; CRYSFRAC:
; FORSTFRAC:
;
; KEYWORDS
; SEPARATE: Keeps graintypes separate instead of mixing
;
; OUTPUTS
; QABS: Value returned for actual spectrum modeling
; Q*** = tables of Q values
; QEXT:
; QSCAT:
;
; AUTHORS
; Tushar Mittal - mittal.tushar22@gmail.com
; Christine Chen - cchen@stsci.edu
; Emil Christensen - chris2er@dukes.jmu.edu
;
; DISCLAIMER
; This software is provided as is without any warranty whatsoever.
; Permission to use, copy, modify, and distribute modified or
; unmodified copies is granted, provided this disclaimer
; is included unchanged.
;
; MODIFICATION HISTORY
; Written by TM (June 2013) as qlookup.pro
; Organized and commented by EC (6/27/2014)
; -
; *************************************************** ;
pro qlookup, grainrad, wavelength, olivratio, crysfrac, forstfrac, icefrac, $
qabs, qext=qext, qscat=qscat, separate=separate
; Carry global variables relating to silicate features
COMMON grainprops, qastrosil, qolivine, qpyroxene, qenstatite, qforsterite, qwaterice, crystallineabs
qextall = dblarr(n_elements(grainrad), n_elements(wavelength),5)
qscatall = dblarr(n_elements(grainrad), n_elements(wavelength),5)
; agrain indices
ii = interpol(dindgen(n_elements(qastrosil.agrain)), $
alog(qastrosil.agrain), alog(grainrad) ) $
< n_elements(qastrosil.agrain)-1.0
shortl = where(wavelength lt 0.2, nshort)
if nshort gt 0 then begin
; short wavelengths: use astronomical silcates
jj = interpol(dindgen(n_elements(qastrosil.lambda)), $
alog(qastrosil.lambda), alog(wavelength[shortl]) )
qextall[*, shortl,*] = $
rebin(exp(interpolate(alog(Qastrosil.Qext), ii, jj, /grid)), $
n_elements(grainrad), nshort, 5)
qscatall[*, shortl,*] = $
rebin(exp(interpolate(alog(Qastrosil.Qscat), ii, jj, /grid)), $
n_elements(grainrad), nshort, 5)
endif
; *************************************************** ;
; Compute for each graintype [olivine,pyroxene,forsterite,enstatite,waterice]
; *************************************************** ;
; *************************************************** ;
graintype =0
qstruct = qolivine
;longl = where(wavelength ge min(qstruct.agrain), nlong)
;if nlong gt 0 then begin
jj = interpol(dindgen(n_elements(qstruct.lambda)), alog(qstruct.lambda), alog(wavelength) )
qextall[*,*,graintype] = exp(interpolate((Qstruct.logQext), ii, jj, /grid))
qscatall[*,*,graintype] = exp(interpolate((Qstruct.logQscat), ii, jj, /grid))
;endif
; *************************************************** ;
graintype =1
qstruct = qpyroxene
;longl = where(wavelength ge min(qstruct.agrain), nlong)
;if nlong gt 0 then begin
jj = interpol(dindgen(n_elements(qstruct.lambda)), alog(qstruct.lambda), alog(wavelength) )
qextall[*,*,graintype] = exp(interpolate((Qstruct.logQext), ii, jj, /grid))
qscatall[*,*,graintype] = exp(interpolate((Qstruct.logQscat), ii, jj, /grid))
;endif
; *************************************************** ;
graintype =2
qstruct = qforsterite
;longl = where(wavelength ge min(qstruct.agrain), nlong)
;if nlong gt 0 then begin
jj = interpol(dindgen(n_elements(qstruct.lambda2)), alog(qstruct.lambda2), alog(wavelength) )
qextall[*,*,graintype] = exp(interpolate((Qstruct.logQext2), ii, jj, /grid))
qscatall[*,*,graintype] = exp(interpolate((Qstruct.logQscat2), ii, jj, /grid))
;endif
; *************************************************** ;
graintype =3
qstruct = qenstatite
;longl = where(wavelength ge min(qstruct.agrain), nlong)
;if nlong gt 0 then begin
jj = interpol(dindgen(n_elements(qstruct.lambda)), alog(qstruct.lambda), alog(wavelength) )
qextall[*,*,graintype] = exp(interpolate((Qstruct.logQext), ii, jj, /grid))
qscatall[*,*,graintype] = exp(interpolate((Qstruct.logQscat), ii, jj, /grid))
;endif
; *************************************************** ;
graintype =4
qstruct = qwaterice
;longl = where(wavelength ge min(qstruct.agrain), nlong)
;if nlong gt 0 then begin
jj = interpol(dindgen(n_elements(qstruct.lambda)), alog(qstruct.lambda), alog(wavelength) )
qextall[*,*,graintype] = exp(interpolate((Qstruct.logQext), ii, jj, /grid))
qscatall[*,*,graintype] = exp(interpolate((Qstruct.logQscat), ii, jj, /grid))
;endif
; *************************************************** ;
; MIX
; olivratio = olivine/(pyroxene+olivine)
; crysfrac = crystalline/(crystalline+amorphous)
; forstfrac = forsterite/(enstatite+forsterite)
; Compresses the 5 *grain* layers into one 2D sheet
; Can probably work around with a keyword at top: /separate or something
IF NOT KEYWORD_SET(separate) THEN BEGIN
qext = reform( qextall[*,*,0]*olivratio*(1.0-crysfrac)*(1.0-icefrac) + $
qextall[*,*,1]*(1.0-olivratio)*(1.0-crysfrac)*(1.0-icefrac) + $
qextall[*,*,2]*forstfrac*crysfrac*(1.0-icefrac) + $
qextall[*,*,3]*(1.0-forstfrac)*crysfrac*(1.0-icefrac) + $
qextall[*,*,4]*icefrac, $
n_elements(grainrad), n_elements(wavelength) )
qscat = reform( qscatall[*,*,0]*olivratio*(1.0-crysfrac)*(1.0-icefrac) + $
qscatall[*,*,1]*(1.0-olivratio)*(1.0-crysfrac)*(1.0-icefrac) + $
qscatall[*,*,2]*forstfrac*crysfrac*(1.0-icefrac) + $
qscatall[*,*,3]*(1.0-forstfrac)*crysfrac*(1.0-icefrac) + $
qscatall[*,*,4]*icefrac, $
n_elements(grainrad), n_elements(wavelength) )
qabs = qext-qscat
ENDIF ELSE BEGIN
qabs = dblarr(n_elements(grainrad),n_elements(wavelength),5)
qext = dblarr(n_elements(grainrad),n_elements(wavelength),5)
qscat = dblarr(n_elements(grainrad),n_elements(wavelength),5)
qext[*,*,0] = qextall[*,*,0]*olivratio*(1.0-crysfrac)*(1.0-icefrac)
qext[*,*,1] = qextall[*,*,1]*(1.0-olivratio)*(1.0-crysfrac)*(1.0-icefrac)
qext[*,*,2] = qextall[*,*,2]*forstfrac*crysfrac*(1.0-icefrac)
qext[*,*,3] = qextall[*,*,3]*(1.0-forstfrac)*crysfrac*(1.0-icefrac)
qext[*,*,4] = qextall[*,*,4]*icefrac
qscat[*,*,0] = qscatall[*,*,0]*olivratio*(1.0-crysfrac)*(1.0-icefrac)
qscat[*,*,1] = qscatall[*,*,1]*(1.0-olivratio)*(1.0-crysfrac)*(1.0-icefrac)
qscat[*,*,2] = qscatall[*,*,2]*forstfrac*crysfrac*(1.0-icefrac)
qscat[*,*,3] = qscatall[*,*,3]*(1.0-forstfrac)*crysfrac*(1.0-icefrac)
qscat[*,*,4] = qscatall[*,*,4]*icefrac
FOR i=0,4 DO qabs[*,*,i] = qext[*,*,i] - qscat[*,*,i]
ENDELSE
return
end