Blame view

LabTools/IRAP/JPB/calz_guess_ebv.pro 1.79 KB
2d9acde0   Jean-Philippe Bernard   First commit
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
FUNCTION calz_guess_ebv,wave,flux_ratio,R_v=R_v

;+
; NAME:
;     calz_guess_ebv,
; PURPOSE:
;     Guess the value of E(B-V) to get a given stellar flux ratio
; EXPLANATION:
;     based on calz_unred.pro by W. Landsman
; CALLING SEQUENCE:
;     ebv=calz_guess_ebv(wave,flux_ratio,R_v=R_v)
; INPUT:
;      WAVE - wavelength at which the flux ratio is given (Angstroms)
;      FLUX_RATIO - flux ratio between unredened and redenned (observed) flux.
; OUTPUT:
;      EBV  - color excess E(B-V), scalar.  positive if flux_ratio is >1 ,
;               Note that the E(B-V) computed is for 
;               the stellar  continuum, EBV(stars), which is related to the 
;               reddening derived from the gas, EBV(gas), via the Balmer 
;               decrement by EBV(stars) = 0.44*EBV(gas) according to Calzetti 2000.          
; OPTIONAL INPUT KEYWORD:
;       R_V - Ratio of total to selective extinction, default = 4.05.  
;             Calzetti et al. (2000) estimate R_V = 4.05 +/- 0.80 from optical
;             -IR observations of 4 starbursts.
; EXAMPLE:
;
;		print,calz_guess_ebv(10000.,1./0.98,R_v=R_v)
;          0.0116824
; NOTES:
;       
; PROCEDURE CALLS:
;      POLY()
; REVISION HISTORY:
;       JPB 30 Jan 2024
;-

;flux_ratio=funred/flux must be >1 for positive E(B-V)
;print,calz_guess_ebv(10000.,1./0.98,R_v=R_v)

;wave_flux in AA

x  = 10000.0/wave                      ;Wavelength in inverse microns

if N_elements(R_V) EQ 0 then R_V = 4.05
 
IF (wave GE 6300) AND (wave LE 22000) THEN $
    klam = 2.659*(-1.857 + 1.040*x) + R_V
   
IF (wave GE  912) AND (wave LT  6300) THEN $
    klam = 2.659*(poly(x, [-2.156, 1.509d0, -0.198d0, 0.011d0])) + R_V

;Calzetti 2000 equation is
;funred = flux*10.0^(0.4*klam*ebv)
;stop

;ebv=alog10(funred/flux)/0.4/klam
ebv=alog10(flux_ratio)/0.4/klam

RETURN,ebv

END