Blame view

src/idl/dustem_plugin_phangs_stellar_isrf.pro 3.74 KB
7f205766   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
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
FUNCTION dustem_plugin_phangs_stellar_isrf,key=key $
                                			   ,val=val $
                                			   ,scope=scope $
                                			   ,paramtag=paramtag $
                                			   ,age_values=age_values $
                                			   ,metalicity_values=metalicity_values $
                                			   ,paramdefault=paramdefault $
                                			   ,object_distance=object_distance $
                                			   ,object_thickness=object_thickness $
                                			   ,help=help

;+
; NAME:
;    dustem_plugin_phangs_stellar_isrf
; PURPOSE:
;    DustEMWrap plugin to compute ISRF from stellar template emission
; CATEGORY:
;    DustEM, Distributed, Mid-Level, Plugin
; CALLING SEQUENCE:
;    ISRF=dustem_plugin_phangs_stellar_isrf([,key=][,val=][,scope=][,paramtag=][paramdefault=][,/help])
; INPUTS:
;    None
; OPTIONAL INPUT PARAMETERS:
;    key  = input parameter number
;					  First parameter: Amplitude factor for the emission
;           Second parameter: E(B-V) for extinction to stars applied to the template, as used in Phangs
;           Following 13*6 parameters are weights by which to multiply the MILES templates [Msun/pc^2]
;    val  = corresponding input parameter value
;  object_distance  = distance to the object in MPc (default = 1 Mpc)
;  object_thickness = thickness of the object in kpc (default = 1 kpc)
; OUTPUTS:
;    ISRF = stellar ISRF in 4*pi*Inu [ergs/s/cm2/Hz]
; OPTIONAL OUTPUT PARAMETERS:
;    scope = if set, return the scope of the plugin
;    paramdefault = default values of parameters
;    paramtag = if set, return the return plugin parameter names as strings
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
;    method                = SSP used. can be EMILES or CB19. default='EMILES'
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    The DustEMWrap IDL code must be installed
; PROCEDURE:
;    This is a DustEMWrap plugin for phangs
;    It differs from dustem_plugin_emiles_stellar_continuum.pro only by the way the extinction is applied to the output spectrum
; EXAMPLES
;    dustem_init
;    vec=dustem_plugin_phangs_stellar_continuum(scope=scope)
; MODIFICATION HISTORY:
;    Written by JPB June 2023
;    Evolution details on the DustEMWrap gitlab.
;    See http://dustemwrap.irap.omp.eu/ for FAQ and help.  
;-

IF keyword_set(help) THEN BEGIN
  doc_library,'dustem_plugin_phangs_stellar_isrf'
  ISRF=0.
  goto,the_end
ENDIF

IF keyword_set(scope) THEN BEGIN
    scope='REPLACE_ISRF'   
    out=0
    goto,the_end
ENDIF 

;use_method='EMILES'
;use_method='CB19'

;age_values=[0.03, 0.05, 0.08, 0.15, 0.25, 0.40, 0.60, 1.0, 1.75, 3.0, 5.0, 8.5, 13.5]
;metalicity_values=[-1.48630, -0.961400, -0.351200, +0.0600000, +0.255900, +0.397100]
;Nage=n_elements(age_values)
;Nmetalicity=n_elements(metalicity_values)
;Nparam=Nage*Nmetalicity+2    ;+2 is for Amplitude and E(B-V)

;==== define parameter tags
IF keyword_set(paramtag) THEN BEGIN
	ISRF=dustem_plugin_phangs_stellar_continuum(paramtag=paramtag,paramdefault=paramdefault)
  ISRF=0
	GOTO,the_end
ENDIF

use_object_distance=1. ;MPc
use_object_thickness=1. ;kPc
use_omega_ratio=((use_object_thickness/2.)/(use_object_distance*1.e6))^2
;This factor is to go from Inu_stars in MJy/sr to 4*pi*Iisrf in ergs/s/cm2/Hz 
use_factor=4.*!pi*1.e-20*1.e7*1.e4*use_omega_ratio

;stop
Inu_stars=dustem_plugin_phangs_stellar_continuum(key=key,val=val)
7f205766   Jean-Philippe Bernard   first commit
94
95
ISRF=Inu_stars[*,0]*use_factor

cc81fcdc   Jean-Philippe Bernard   improved
96
97
98
99
;REM: Inu_stars is on lambir wavelength. For an ISRF plugins, needs to to be interpolated on isrf wavelengths
spec_wavelengths=dustem_get_wavelengths(isrf_wavelengths=isrf_wavelengths)
ISRF=interpol(ISRF,spec_wavelengths,isrf_wavelengths)

7f205766   Jean-Philippe Bernard   first commit
100
101
102
103
the_end:
RETURN,ISRF
  
END