Blame view

src/idl/dustem_make_fits_predicted_ext.pro 3.33 KB
b7dca888   Jean-Philippe Bernard   improved to recov...
1
2
3
4
5
6
FUNCTION dustem_make_fits_predicted_ext ,syst_var $
										,dustem_predicted_ext $
										,str_input_ext=str_input_ext $
										,dustem_predicted_Qext=dustem_predicted_Qext, $
    									,dustem_predicted_Uext=dustem_predicted_Uext, $
										,help=help
244eeac8   Jean-Philippe Bernard   First commit
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

;+
; NAME:
;    dustem_make_fits_predicted_ext
; PURPOSE:
;    extracts dustemwrap predicted extinction SED from dustem system variable syst_var, to be put into fits files
; CATEGORY:
;    DustEMWrap, Distributed, High-Level, User Convenience
; CALLING SEQUENCE:
;    str_predicted_EXT=dustem_make_fits_predicted_ext(syst_var,dustem_predicted_ext[,str_input_ext=])
;    see dustem_write_fits_table.pro
; INPUTS:
;    syst_var  : dustem system variable (*!dustem_data or *!dustem_show)
;    dustem_predicted_ext : dustemwrap predicted extinction SED as output by dustem_compute_ext.pro
; OPTIONAL INPUT PARAMETERS:
b7dca888   Jean-Philippe Bernard   improved to recov...
22
23
;    dustem_predicted_Qext : Stokes Q extinction SED
;    dustem_predicted_Uext : Stokes U extinction SED
244eeac8   Jean-Philippe Bernard   First commit
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
; OUTPUTS:
;    str_predicted_EXT : dustemwrap predicted extinction SED as used to store into fits file
; OPTIONAL OUTPUT PARAMETERS:
;    str_input_ext : dustem wrap input extinction SED
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    The DustEMWrap IDL code must be installed
; PROCEDURE:
;    None
; EXAMPLES:
;    str_predicted_EXT=dustem_make_fits_predicted_ext(*!dustem_data,dustem_predicted_ext,str_input_ext=str_input_ext)
; MODIFICATION HISTORY:
;    Written by J.-Ph. Bernard Dec 2022
;    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_make_fits_predicted_ext'
  str_predicted_SED=-1
  goto,the_end
ENDIF


;===== define structures containing results
one_str_input_EXT={FILTER:'',Wavelength:la_undef(4),I:la_undef(5),Q:la_undef(5),U:la_undef(5),varianceII:la_undef(5),varianceQQ:la_undef(5),varianceUU:la_undef(5)}
one_str_predicted_EXT={FILTER:'',Wavelength:la_undef(4),I:la_undef(5),Q:la_undef(5),U:la_undef(5)}

Next=n_elements((*syst_var.ext).filt_names)
str_input_EXT=replicate(one_str_input_EXT,Next)
str_input_EXT.FILTER=(*syst_var.ext).filt_names
str_input_EXT.Wavelength=(*syst_var.ext).wav
str_input_EXT.I=(*syst_var.ext).values
str_input_EXT.varianceII=la_power((*syst_var.ext).sigma,2.)

;N_predicted_ext=n_elements(dustem_predicted_polext[0])
N_predicted_ext=n_elements(dustem_predicted_ext)
str_predicted_EXT=replicate(one_str_predicted_EXT,N_predicted_EXT)
fully_undefined_ext=str_predicted_ext
IF N_predicted_ext NE Next THEN BEGIN  ;This is for cases when the extinction data to fit did not have the dimension of computed extinction curve
	message,'I have a problem with dimensions ...',/continue
    stop
ENDIF ELSE BEGIN
	str_predicted_EXT.FILTER=(*syst_var.ext).filt_names    ;taken from input SED
	str_predicted_EXT.Wavelength=(*syst_var.ext).wav       ;taken from input SED
	str_predicted_EXT.I=dustem_predicted_ext
ENDELSE
;stop
IF !run_pol THEN BEGIN
	str_predicted_EXT.Q=interpol(dustem_predicted_Qext,(*syst_var.qext).wav,(*syst_var.ext).wav)
	str_predicted_EXT.U=interpol(dustem_predicted_Uext,(*syst_var.uext).wav,(*syst_var.ext).wav)
ENDIF ELSE BEGIN
	str_predicted_EXT.Q=fully_undefined_ext.Q
	str_predicted_EXT.U=fully_undefined_ext.U
ENDELSE

RETURN,str_predicted_EXT

END