Commit 7f205766ec810361c31ec380e0886d60a8bb81ec
1 parent
8b65a68c
Exists in
master
first commit
Showing
2 changed files
with
240 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,140 @@ |
1 | +FUNCTION dustem_plugin_phangs_class_isrf,key=key $ | |
2 | + ,val=val $ | |
3 | + ,scope=scope $ | |
4 | + ,paramtag=paramtag $ | |
5 | + ,paramdefault=paramdefault $ | |
6 | + ,help=help | |
7 | + | |
8 | +;+ | |
9 | +; NAME: | |
10 | +; dustem_plugin_phangs_class_isrf | |
11 | +; PURPOSE: | |
12 | +; DustEMWrap plugin to get ISRF from a given stellar ISRF phangs class | |
13 | +; CATEGORY: | |
14 | +; DustEM, Distributed, Mid-Level, Plugin | |
15 | +; CALLING SEQUENCE: | |
16 | +; ISRF=dustem_plugin_phangs_class_isrf([,key=][,val=][,scope=][,paramtag=][paramdefault=][,/help]) | |
17 | +; INPUTS: | |
18 | +; None | |
19 | +; OPTIONAL INPUT PARAMETERS: | |
20 | +; key = input parameter number | |
21 | +; 1: ISRF class to be used (default = 0 = Mathis ISRF) | |
22 | +; 2: Amplitude factor for the ISRF ("GO") | |
23 | +; 3: E(B-V) for extinction to stars applied to the template, as used in Phangs | |
24 | +; val = corresponding input parameter value | |
25 | +; OUTPUTS: | |
26 | +; ISRF = stellar ISRF in 4*pi*Inu [ergs/s/cm2/Hz] normalized to Mathis ISRF at 1 mic for the provided G0 | |
27 | +; OPTIONAL OUTPUT PARAMETERS: | |
28 | +; scope = if set, return the scope of the plugin | |
29 | +; paramdefault = default values of parameters | |
30 | +; paramtag = if set, return the return plugin parameter names as strings | |
31 | +; ACCEPTED KEY-WORDS: | |
32 | +; help = if set, print this help | |
33 | +; COMMON BLOCKS: | |
34 | +; None | |
35 | +; SIDE EFFECTS: | |
36 | +; None | |
37 | +; RESTRICTIONS: | |
38 | +; The DustEMWrap IDL code must be installed | |
39 | +; PROCEDURE: | |
40 | +; This is a DustEMWrap plugin for phangs | |
41 | +; EXAMPLES | |
42 | +; dustem_init | |
43 | +; vec=dustem_plugin_phangs_class_isrf(scope=scope) | |
44 | +; MODIFICATION HISTORY: | |
45 | +; Written by JPB June 2023 | |
46 | +; Evolution details on the DustEMWrap gitlab. | |
47 | +; See http://dustemwrap.irap.omp.eu/ for FAQ and help. | |
48 | +;- | |
49 | + | |
50 | +;stop | |
51 | + | |
52 | +IF keyword_set(help) THEN BEGIN | |
53 | + doc_library,'dustem_plugin_phangs_class_isrf' | |
54 | + ISRF=0. | |
55 | + goto,the_end | |
56 | +ENDIF | |
57 | + | |
58 | +IF keyword_set(scope) THEN BEGIN | |
59 | + scope='REPLACE_ISRF' | |
60 | + ;message,'Plugin dustem_plugin_phangs_class_isrf called with scope keyword',/informational | |
61 | + ;stop | |
62 | + ISRF=0 | |
63 | + goto, the_end | |
64 | +ENDIF | |
65 | + | |
66 | +;==== define parameter tags | |
67 | +IF keyword_set(paramtag) THEN BEGIN | |
68 | + paramtag=['class','G0','E(B-V)'] | |
69 | + ;message,'Plugin dustem_plugin_phangs_class_isrf called with paramtag keyword',/informational | |
70 | + ;stop | |
71 | + ISRF=0 | |
72 | + GOTO,the_end | |
73 | +ENDIF | |
74 | + | |
75 | +;message,'Plugin dustem_plugin_phangs_class_isrf will compute ISRF',/informational | |
76 | +;stop | |
77 | + | |
78 | +;default values: | |
79 | +use_class=0L | |
80 | +G0=1.0 | |
81 | +EBV=0. | |
82 | +IF keyword_set(key) THEN BEGIN | |
83 | + ind=where(key EQ 1,count) | |
84 | + IF count NE 0 THEN use_class=val[ind[0]] | |
85 | + ind=where(key EQ 2,count) | |
86 | + IF count NE 0 THEN G0=val[ind[0]] | |
87 | + ind=where(key EQ 3,count) | |
88 | + IF count NE 0 THEN EBV=val[ind[0]] | |
89 | +ENDIF | |
90 | + | |
91 | +;==== here we open the ISRF classes but should be done only once, and put into a system varaible | |
92 | +data_dir='/Volumes/PILOT_FLIGHT1/PHANGS-JWST/DR1/' | |
93 | +file_save=data_dir+'isrf_classes_one_ratio.sav' | |
94 | +restore,file_save,/verb | |
95 | +;% RESTORE: Restored variable: CLASSES. | |
96 | +;% RESTORE: Restored variable: CLASS0. | |
97 | + | |
98 | +;==== initialize templates if not already present | |
99 | +defsysv,'!dustem_plugin_phangs_class_isrf',exist=exist | |
100 | +IF exist EQ 0 THEN BEGIN | |
101 | + st={class0:ptr_new(),classes:ptr_new()} | |
102 | + defsysv,'!dustem_plugin_phangs_class_isrf',st | |
103 | +ENDIF | |
104 | +IF not ptr_valid(!dustem_plugin_phangs_class_isrf.class0) THEN BEGIN | |
105 | + message,'Initializing Phangs ISRF classes',/info | |
106 | + data_dir='/Volumes/PILOT_FLIGHT1/PHANGS-JWST/DR1/' | |
107 | + file_save=data_dir+'isrf_classes_one_ratio.sav' | |
108 | + restore,file_save,/verb | |
109 | + ;% RESTORE: Restored variable: CLASSES. | |
110 | + ;% RESTORE: Restored variable: CLASS0. | |
111 | + ;stop | |
112 | + !dustem_plugin_phangs_class_isrf.class0=ptr_new(class0) | |
113 | + !dustem_plugin_phangs_class_isrf.classes=ptr_new(classes) | |
114 | +ENDIF | |
115 | + | |
116 | +classes=*!dustem_plugin_phangs_class_isrf.classes | |
117 | +class0=*!dustem_plugin_phangs_class_isrf.class0 | |
118 | +;IF keyword_set(isrf_class) THEN use_class=isrf_class | |
119 | +IF use_class NE 0 THEN class=classes[use_class] ELSE class=class0 | |
120 | +fact=3.941e-17 ;ergs/s/cm2/Hz at 1 micron for Mathis field at G0=1 | |
121 | + | |
122 | +IF ptr_valid(class.isrf_template) THEN BEGIN | |
123 | + ISRF=(*class.isrf_template)*G0*fact | |
124 | +ENDIF ELSE BEGIN | |
125 | + message,'Class not found',/continue | |
126 | + stop | |
127 | +ENDELSE | |
128 | + | |
129 | +;stop | |
130 | +;un_red | |
131 | +;STILL HAVE TO REDDEN BEY E(B-V) | |
132 | + | |
133 | +the_scope: | |
134 | + | |
135 | +the_paramtag: | |
136 | + | |
137 | +the_end: | |
138 | +RETURN,ISRF | |
139 | + | |
140 | +END | ... | ... |
... | ... | @@ -0,0 +1,100 @@ |
1 | +FUNCTION dustem_plugin_phangs_stellar_isrf,key=key $ | |
2 | + ,val=val $ | |
3 | + ,scope=scope $ | |
4 | + ,paramtag=paramtag $ | |
5 | + ,age_values=age_values $ | |
6 | + ,metalicity_values=metalicity_values $ | |
7 | + ,paramdefault=paramdefault $ | |
8 | + ,object_distance=object_distance $ | |
9 | + ,object_thickness=object_thickness $ | |
10 | + ,help=help | |
11 | + | |
12 | +;+ | |
13 | +; NAME: | |
14 | +; dustem_plugin_phangs_stellar_isrf | |
15 | +; PURPOSE: | |
16 | +; DustEMWrap plugin to compute ISRF from stellar template emission | |
17 | +; CATEGORY: | |
18 | +; DustEM, Distributed, Mid-Level, Plugin | |
19 | +; CALLING SEQUENCE: | |
20 | +; ISRF=dustem_plugin_phangs_stellar_isrf([,key=][,val=][,scope=][,paramtag=][paramdefault=][,/help]) | |
21 | +; INPUTS: | |
22 | +; None | |
23 | +; OPTIONAL INPUT PARAMETERS: | |
24 | +; key = input parameter number | |
25 | +; First parameter: Amplitude factor for the emission | |
26 | +; Second parameter: E(B-V) for extinction to stars applied to the template, as used in Phangs | |
27 | +; Following 13*6 parameters are weights by which to multiply the MILES templates [Msun/pc^2] | |
28 | +; val = corresponding input parameter value | |
29 | +; object_distance = distance to the object in MPc (default = 1 Mpc) | |
30 | +; object_thickness = thickness of the object in kpc (default = 1 kpc) | |
31 | +; OUTPUTS: | |
32 | +; ISRF = stellar ISRF in 4*pi*Inu [ergs/s/cm2/Hz] | |
33 | +; OPTIONAL OUTPUT PARAMETERS: | |
34 | +; scope = if set, return the scope of the plugin | |
35 | +; paramdefault = default values of parameters | |
36 | +; paramtag = if set, return the return plugin parameter names as strings | |
37 | +; ACCEPTED KEY-WORDS: | |
38 | +; help = if set, print this help | |
39 | +; method = SSP used. can be EMILES or CB19. default='EMILES' | |
40 | +; COMMON BLOCKS: | |
41 | +; None | |
42 | +; SIDE EFFECTS: | |
43 | +; None | |
44 | +; RESTRICTIONS: | |
45 | +; The DustEMWrap IDL code must be installed | |
46 | +; PROCEDURE: | |
47 | +; This is a DustEMWrap plugin for phangs | |
48 | +; It differs from dustem_plugin_emiles_stellar_continuum.pro only by the way the extinction is applied to the output spectrum | |
49 | +; EXAMPLES | |
50 | +; dustem_init | |
51 | +; vec=dustem_plugin_phangs_stellar_continuum(scope=scope) | |
52 | +; MODIFICATION HISTORY: | |
53 | +; Written by JPB June 2023 | |
54 | +; Evolution details on the DustEMWrap gitlab. | |
55 | +; See http://dustemwrap.irap.omp.eu/ for FAQ and help. | |
56 | +;- | |
57 | + | |
58 | +IF keyword_set(help) THEN BEGIN | |
59 | + doc_library,'dustem_plugin_phangs_stellar_isrf' | |
60 | + ISRF=0. | |
61 | + goto,the_end | |
62 | +ENDIF | |
63 | + | |
64 | +IF keyword_set(scope) THEN BEGIN | |
65 | + scope='REPLACE_ISRF' | |
66 | + out=0 | |
67 | + goto,the_end | |
68 | +ENDIF | |
69 | + | |
70 | +;use_method='EMILES' | |
71 | +;use_method='CB19' | |
72 | + | |
73 | +;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] | |
74 | +;metalicity_values=[-1.48630, -0.961400, -0.351200, +0.0600000, +0.255900, +0.397100] | |
75 | +;Nage=n_elements(age_values) | |
76 | +;Nmetalicity=n_elements(metalicity_values) | |
77 | +;Nparam=Nage*Nmetalicity+2 ;+2 is for Amplitude and E(B-V) | |
78 | + | |
79 | +;==== define parameter tags | |
80 | +IF keyword_set(paramtag) THEN BEGIN | |
81 | + ISRF=dustem_plugin_phangs_stellar_continuum(paramtag=paramtag,paramdefault=paramdefault) | |
82 | + ISRF=0 | |
83 | + GOTO,the_end | |
84 | +ENDIF | |
85 | + | |
86 | +use_object_distance=1. ;MPc | |
87 | +use_object_thickness=1. ;kPc | |
88 | +use_omega_ratio=((use_object_thickness/2.)/(use_object_distance*1.e6))^2 | |
89 | +;This factor is to go from Inu_stars in MJy/sr to 4*pi*Iisrf in ergs/s/cm2/Hz | |
90 | +use_factor=4.*!pi*1.e-20*1.e7*1.e4*use_omega_ratio | |
91 | + | |
92 | +;stop | |
93 | +Inu_stars=dustem_plugin_phangs_stellar_continuum(key=key,val=val) | |
94 | + | |
95 | +ISRF=Inu_stars[*,0]*use_factor | |
96 | + | |
97 | +the_end: | |
98 | +RETURN,ISRF | |
99 | + | |
100 | +END | ... | ... |