Blame view

src/idl/dustem_plugin_phangs_stellar_isrf.pro 4.1 KB
7f205766   Jean-Philippe Bernard   first commit
1
2
3
4
5
6
7
FUNCTION dustem_plugin_phangs_stellar_isrf,key=key $
                                			   ,val=val $
                                			   ,scope=scope $
                                			   ,paramtag=paramtag $
                                			   ,age_values=age_values $
                                			   ,metalicity_values=metalicity_values $
                                			   ,paramdefault=paramdefault $
c0b28cb2   Jean-Philippe Bernard   Changed G0 into F...
8
;                                			   ,object_distance=object_distance $
d3b1715c   Jean-Philippe Bernard   improved
9
;                                			   ,object_thickness=object_thickness $
7c0c94e9   Jean-Philippe Bernard   fixeds very nasty...
10
                                         ,Voronoi_Npix=Voronoi_Npix $
7f205766   Jean-Philippe Bernard   first commit
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
                                			   ,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:
bca3c9b1   Jean-Philippe Bernard   corrected issue w...
33
;    ISRF = stellar ISRF in omega*Inu [ergs/s/cm2/Hz] for omega = 1 sr
7f205766   Jean-Philippe Bernard   first commit
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
; 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 

7f205766   Jean-Philippe Bernard   first commit
71
72
;==== define parameter tags
IF keyword_set(paramtag) THEN BEGIN
7c0c94e9   Jean-Philippe Bernard   fixeds very nasty...
73
	ISRF=dustem_plugin_phangs_stellar_continuum(paramtag=paramtag,paramdefault=paramdefault,voronoi_Npix=voronoi_Npix)  ;This is Inu stars MJy/sr
7f205766   Jean-Philippe Bernard   first commit
74
75
76
77
  ISRF=0
	GOTO,the_end
ENDIF

bca3c9b1   Jean-Philippe Bernard   corrected issue w...
78
79
80
81
;use_object_distance=1. ;MPc
;use_object_thickness=1. ;Pc
;IF keyword_set(object_distance) THEN use_object_distance=object_distance
;IF keyword_set(object_thickness) THEN use_object_thickness=object_thickness
d339db1c   Jean-Philippe Bernard   improved
82

bca3c9b1   Jean-Philippe Bernard   corrected issue w...
83
;use_omega_ratio=((use_object_thickness/2.*1.e3)/(use_object_distance*1.e6))^2
7f205766   Jean-Philippe Bernard   first commit
84
;This factor is to go from Inu_stars in MJy/sr to 4*pi*Iisrf in ergs/s/cm2/Hz 
27497b31   Jean-Philippe Bernard   fixed calculation...
85
86
87
88
89
;==== JPB: I think it should say *1.e-4, not *1.e4 and /use_omega_ratio, not *use_omega_ratio
;use_factor=4.*!pi*1.e-20*1.e7*1.e4*use_omega_ratio
;so,
;use_factor=4.*!pi*1.e-20*1.e7*1.e-4/use_omega_ratio
;but in fact we go to a distance equal to the size of the Voronoi bin, ie (indep. of omega_ration ....)
bca3c9b1   Jean-Philippe Bernard   corrected issue w...
90
91
;use_factor=4.*!pi*1.e-20*1.e7*1.e-4
use_factor=1.e-20*1.e7*1.e-4    ;This is to go from MJy/sr to ergs/s/cm2/Hz/sr
7f205766   Jean-Philippe Bernard   first commit
92
93

;stop
7c0c94e9   Jean-Philippe Bernard   fixeds very nasty...
94
Inu_stars=dustem_plugin_phangs_stellar_continuum(key=key,val=val,voronoi_Npix=voronoi_Npix)   ;This is in MJy/sr
7f205766   Jean-Philippe Bernard   first commit
95
96
ISRF=Inu_stars[*,0]*use_factor

cc81fcdc   Jean-Philippe Bernard   improved
97
98
99
100
;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
101
102
103
104
the_end:
RETURN,ISRF
  
END