Viewing contents of file '../idllib/uit/pro/bruzual.pro'
pro bruzual, wave, time, model, flux
;+
; NAME:
; BRUZUAL
; PURPOSE:
; Extract a spectrum from the BRUZUAL database (Bruzual & Chalrot, 1993,
; ApJ, 405, 538) for a specified model at specified ages. Meant to
; be analogous to the procedure CLUST_FLUX
;
; CALLING SEQUENCE:
; BRUZUAL, wave, time, model, flux
;
; INPUT-OUTPUT PARAMETERS
; WAVE - Wavelength(s) (A) at which to determine flux, scalar or vector
; If this parameter is undefined on input, then on output it
; will contain the Bruzual wavelengths actually tabulated.
; Otherwise the Bruzual spectra are quadratically interpolated
; onto the input wavelength grid.
; TIME - Time(s) (in Myr) following beginning of star formation at
; which to evaluate flux, scalar or vector. Spectra are not
; interpolated over time, rather the closest point in the
; Bruzual time grid is used. Upon output, TIME will contain
; the time values actually used. If TIME is undefined on
; input the Bruzual time grid is used.
;
; OUTPUT:
; FLUX - Flux vector dimensioned NWAVE by NTIME where NWAVE is the number
; of elements in WAVE and NTIME is then number of elements in
; TIME. Units are ergs s(-1) A(-1) per solar mass formed.
;
; INPUT PARAMETER
; MODEL - An integer scalar (1-19) specifying the Bruzual model to use
; (1) Salpeter IMF, Inst. Burst, 0.1 - 125 Msun
; (2) Salpeter IMF, Inst. Burst, 0.1 - 65 Msun
; (3) Salpeter IMF, Inst. Burst, 0.1 - 30 Msun
; (4) Salpeter IMF, Inst. Burst, 0.1 - 2.5 Msun
; (5) Salpeter IMF, Inst. Burst, 2.5 - 125 Msun
; (6) Scalo (1986) IMF, Inst. Burst, 0.1 - 125 Msun
; (7) Scalo (1986) IMF, Inst. Burst, 0.1 - 65 Msun
; (8) Scalo (1986) IMF, Inst. Burst, 0.1 - 30 Msun
; (9) Scalo (1986) IMF, Inst. Burst, 0.1 - 2.5 Msun
; (10) Scalo (1986) IMF, Inst. Burst, 2.5 - 125 Msun
; (11) Miller-Scalo IMF, Inst. Burst, 0.1 - 125 Msun
; (12) Miller-Scalo IMF, Inst. Burst, 0.1 - 65 Msun
; (13) Miller-Scalo IMF, Inst. Burst, 0.1 - 40 Msun
; (14) Miller-Scalo IMF, Inst. Burst, 0.1 - 2.5 Msun
; (15) Miller-Scalo IMF, Inst. Burst, 2.5 - 125 Msun
; (16) Salpeter IMF, 1 Gyr Burst, 0.1 - 125 Msun
; (17) Salpeter IMF, Exponential Decayng SFR with tau = 1 Gyr,
; 0.1 - 125 Msun
; (18) Salpeter IMF, Exponential Decaying SFR with Mu = 0.50,
; 0.1 - 125 Msun
; (19) Salpeter IMF, Constant SFR 1e-10 Msun/yr. 0.1 - 125 Msun
;
; EXAMPLE:
; Return the Bruzual flux at 1600 A every million years for the first
; 10 million years. Assume a Salpeter IMF with mass range 0.1-65 Msun
; (model 2)
;
; IDL> age = indgen(11)
; IDL> bruzual, 1600, age, 2, flux
;
; Upon output the AGE vector is modified to contain the ages actually
; used
; REVISION HISTORY
; Written, W.Landsman HSTX April, 1993
;-
On_error,2
if N_params() LT 4 then begin
print, 'Syntax - BRUZUAL, wave, time, model, flux
print,' wave - Input wavelength to evaluate cluster flux, scalar or vector
print,' time - Times at which to evaluate cluster flux, scalar or vector
print,' model - Bruzual model number (1-19)
print,' flux - Output flux vector, dimensioned (N_wave by N_time)
return
endif
zparcheck, 'BRUZUAL', model, 3, [1,2,3],0,'Bruzual model number'
modelname = [' ', $
'Salpeter IMF, Inst. Burst, 0.1 - 125 Msun', $
'Salpeter IMF, Inst. Burst, 0.1 - 65 Msun', $
'Salpeter IMF, Inst. Burst, 0.1 - 30 Msun', $
'Salpeter IMF, Inst. Burst, 0.1 - 2.5 Msun', $
'Salpeter IMF, Inst. Burst, 2.5 - 125 Msun', $
'Scalo (1986) IMF, Inst. Burst, 0.1 - 125 Msun', $
'Scalo (1986) IMF, Inst. Burst, 0.1 - 65 Msun', $
'Scalo (1986) IMF, Inst. Burst, 0.1 - 30 Msun', $
'Scalo (1986) IMF, Inst. Burst, 0.1 - 2.5 Msun', $
'Scalo (1986) IMF, Inst. Burst, 2.5 - 125 Msun', $
'Miller-Scalo IMF, Inst. Burst, 0.1 - 125 Msun', $
'Miller-Scalo IMF, Inst. Burst, 0.1 - 65 Msun', $
'Miller-Scalo IMF, Inst. Burst, 0.1 - 40 Msun', $
'Miller-Scalo IMF, Inst. Burst, 0.1 - 2.5 Msun', $
'Miller-Scalo IMF, Inst. Burst, 2.5 - 125 Msun', $
'Salpeter IMF, 1 Gyr Burst, 0.1 - 125 Msun', $
'Salpeter IMF, Exponential Decayng SFR with tau = 1 Gyr, 0.1 - 125 Msun', $
'Salpeter IMF, Exponential Decaying SFR with Mu = 0.50, 0.1 - 125 Msun', $
'Salpeter IMF, Constant SFR 1e-10 Msun/yr. 0.1 - 125 Msun']
if (model LT 1) or (model GT 19) then message, $
'ERROR - Model number must be between 1 and 19'
dbopen,'bruzual'
dbext, 0, 'f', w
message, modelname(model), /INF
list = dbfind('model='+strtrim(model,2) ,/SILENT )
dbext, list, 'age', age_model
age_model = age_model/1e6
if N_elements(time) EQ 0 then begin
time = age_model
index = indgen(N_elements(list))
endif else begin
bad = where( (time LT min(age_model) ) or (time GT max(age_model)), Nbad)
if Nbad GT 0 then message, $
'Unable to find Bruzual models for ages '+strcompress(time(bad)) + 'Myr'
tabinv, age_model, time, index
index = nint(index)
time = age_model(index)
endelse
if N_elements(wave) EQ 0 then begin
wave = w
dbext,list(index),'f',flux
endif else begin
dbext,list(index),'f',f
Ntime = N_elements( time)
tabinv, w, wave, w_index
flux = fltarr(N_elements(wave), Ntime )
for i=0,Ntime-1 do flux(0,i) = interpolate( f(*,i), w_index)
endelse
flux = flux*3.826E33
return
end