Commit 90bee736499c2fea058d85e0d12c277699ea9405
1 parent
09e61d64
Exists in
master
replicated ext format procedures
Showing
2 changed files
with
119 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,90 @@ |
1 | +FUNCTION dustem_initialize_ext,Next,comments=comments,help=help | |
2 | + | |
3 | +;+ | |
4 | +; NAME: | |
5 | +; dustem_initialize_ext | |
6 | +; PURPOSE: | |
7 | +; Initializes an empty Dustem EXT structure | |
8 | +; CATEGORY: | |
9 | +; DUSTEM Wrapper | |
10 | +; CALLING SEQUENCE: | |
11 | +; st=dustem_initialize_ext(Next[,/help]) | |
12 | +; INPUTS: | |
13 | +; Next: Number of elements/filters in the EXT structure | |
14 | +; OPTIONAL INPUT PARAMETERS: | |
15 | +; None | |
16 | +; OUTPUTS: | |
17 | +; st = EXT structure | |
18 | +; The structure contains the following tags | |
19 | +; instru : name of the instrument. Actually not used by DustemWrap. | |
20 | +; filter : name of the filter. Actually defines the wavelength, the flux convention, etc ... | |
21 | +; wave : wavelength in microns. Actually not used by DustemWrap. [microns] | |
22 | +; EXT_I : Total Extinction Cross-section (a.k.a. Ext_I) [cm^2/H] | |
23 | +; EXT_Q : Q Extinction Cross-section [cm^2/H] | |
24 | +; EXT_U : U Extintion Cross-section [cm^2/H] | |
25 | +; EXT_P : P Extinction Cross-section [cm^2/H] (computed from EXT_Q,EXT_U or directly from VG's models) | |
26 | +; EXT_smallp : Smallp Extinction Cross-section (Extinction polarization fraction) [] | |
27 | +; psi : polarization angle [deg] (computed from EXT_Q,EXT_U) | |
28 | +; sigextII : = error^2 (for completness on sigmas) [cm^2/H^2] | |
29 | +; sigextQQ : variance on Q [cm^2/H^2] | |
30 | +; sigextUU : variance on U [cm^2/H^2] | |
31 | +; sigextIQ : IQ covariance [cm^2/H^2] | |
32 | +; sigextIU : IU covariance [cm^2/H^2] | |
33 | +; sigextQU : QU covariance [cm^2/H^2] | |
34 | +; sigextP : uncertainty on largep [cm^2/H] | |
35 | +; sigextsmallp = uncertainty on smallp [] | |
36 | +; sigextpsi : uncertainty on psi [deg] | |
37 | +; OPTIONAL OUTPUT PARAMETERS: | |
38 | +; comments : string comments about the EXT SED | |
39 | +; ACCEPTED KEY-WORDS: | |
40 | +; help = if set, print this help | |
41 | +; COMMON BLOCKS: | |
42 | +; None | |
43 | +; SIDE EFFECTS: | |
44 | +; None | |
45 | +; RESTRICTIONS: | |
46 | +; None | |
47 | +; PROCEDURE: | |
48 | +; Straightforward | |
49 | +; EXAMPLES | |
50 | +; st=dustem_initialize_ext(10) | |
51 | +; help,st | |
52 | +; MODIFICATION HISTORY: | |
53 | +; Written by JPB | |
54 | +;- | |
55 | + | |
56 | +IF keyword_set(help) THEN BEGIN | |
57 | + doc_library,'dustem_initialize_ext' | |
58 | + sed=0. | |
59 | + goto,the_end | |
60 | +ENDIF | |
61 | + | |
62 | +iv=la_undef(4) | |
63 | +one_st={instru:'',filter:'',wave:iv,EXT_I:iv,EXT_Q:iv,EXT_U:iv,EXT_P:iv,EXT_smallp:iv,psi:iv,sigextII:iv,sigextQQ:iv,sigextUU:iv,sigextIQ:iv,sigextIU:iv,sigextQU:iv,sigextP:iv,sigextsmallp:iv,sigext_psi:iv} | |
64 | + | |
65 | +comments=['Dustem-Wrap EXT'] | |
66 | +comments=[comments,'instru: Instrument name'] | |
67 | +comments=[comments,'filter: Instrument filter'] | |
68 | +comments=[comments,'wave: Filter reference wavelength [mic]'] | |
69 | +comments=[comments,'EXT_I: EXT intensity [cm^2/H]'] | |
70 | +comments=[comments,'EXT_Q: Q Stokes parameter extinction cross-section [cm^2/H]'] | |
71 | +comments=[comments,'EXT_U: U Stokes parameter extinction cross-section [cm^2/H]'] | |
72 | +comments=[comments,'EXT_P: Extinction Polarized Intensity [cm^2/H]'] | |
73 | +comments=[comments,'EXT_smallp: Extinction Polarized Fraction []'] | |
74 | +comments=[comments,'psi: polarization angle [deg]'] | |
75 | +comments=[comments,'sigextII: variance on EXT_I [(cm^2/H)^2]'] | |
76 | +comments=[comments,'sigextQQ: variance on EXT_Q [(cm^2/H)^2]'] | |
77 | +comments=[comments,'sigextUU: variance on EXT_U [(cm^2/H)^2]'] | |
78 | +comments=[comments,'sigextIQ: covariance on EXT_I and EXT_Q [(cm^2/H)^2]'] | |
79 | +comments=[comments,'sigextIU: covariance on EXT_I and EXT_U [(cm^2/H)^2]'] | |
80 | +comments=[comments,'sigextQU: covariance on EXT_Q and EXT_U [(cm^2/Hs)^2]'] | |
81 | +comments=[comments,'sigextP: variance on Extinction Polarized Intensity (P) [(cm^2/H)^2]'] | |
82 | +comments=[comments,'sigextsmallp: variance on Extinction Polarized fraction (EXT_P) []'] | |
83 | +comments=[comments,'sigextpsi: variance on polarisation fraction (psi) [deg^2]'] | |
84 | + | |
85 | +sed=replicate(one_st,Next) | |
86 | + | |
87 | +the_end: | |
88 | +RETURN,sed | |
89 | + | |
90 | +END | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +PRO dustem_old2new_ext_format | |
2 | + | |
3 | + | |
4 | +model='THEMIS' | |
5 | +dustem_init,mode=model | |
6 | + | |
7 | +;dir=!dustem_wrap_soft_dir+'/Data/SEDs/' | |
8 | +dir='/Users/ilyeschoubani/Downloads/test_wrap_NY/' | |
9 | + | |
10 | +file=dir+'Serkowski_HD21.xcat' | |
11 | + | |
12 | +str='cp '+file+' '+file+'.old' | |
13 | +spawn,str | |
14 | + | |
15 | +old_ext=read_xcat(file,/silent,comments=old_comments) | |
16 | +Next=n_elements(old_ext) | |
17 | + | |
18 | +new_ext=dustem_initialize_ext(Next,comments=new_comments,help=help) | |
19 | +comments=['Written by dustem_old2new_ext_format.pro on '+systime(0),old_comments,new_comments] | |
20 | + | |
21 | +new_ext.instru=old_ext.instru | |
22 | +new_ext.filter=old_ext.filter | |
23 | +new_ext.wave=old_ext.wave | |
24 | +new_ext.EXT_I=old_ext.spec | |
25 | +new_ext.sigextII=(old_ext.error)^2 | |
26 | + | |
27 | +write_xcat,new_ext,file,comments=comments | |
28 | + | |
29 | +END | ... | ... |