Blame view

src/idl/dustem_greybody_mpfit.pro 2.05 KB
427f1205   Jean-Michel Glorian   version 4.2 merged
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
FUNCTION dustem_greybody_mpfit,x,params,_EXTRA=extra,cc_sed=cc_sed,help=help

;+
; NAME:
;    dustem_greybody_mpfit
; PURPOSE:
;    function used to fit greybody with dustem_mpfit_sed
; CATEGORY:
;    Dustem
; CALLING SEQUENCE:
;    res=dustem_greybody_mpfit(x,params[,_EXTRA=extra][,cc_sed=cc_sed][,/help])
; INPUTS:
;    x         = necessary for interface but unused
;    params    = Model parameters normalized to initial values ([amplitude,T,beta])
; OPTIONAL INPUT PARAMETERS:
;    cc_sed    = SED color correction factors
;    _extra    = extra parameters for the plot routine
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help      = If set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    SED and model are plotted if !dustem_show_plot
; RESTRICTIONS:
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    None
; EXAMPLES
;    res=dustem_greybody_mpfit(x,params[,_EXTRA=extra][,cc_sed=cc_sed][,/help])
; MODIFICATION HISTORY:
;    Written by J.-Ph. Bernard
;    see evolution details on the dustem cvs maintained at CESR
;    Contact J.-Ph. Bernard (Jean-Philippe.Bernard@cesr.fr) in case of problems.
;-


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

pp=params*(*(*!dustem_fit).PARAM_INIT_VALUES)

6730c3f8   Jean-Philippe Bernard   modified to be co...
49
50
;sed=dustem_compute_gb_sed(pp,_extra=extra,waves=ww,spec=spectre)
sed=dustem_compute_gb_sed_fast(pp,_extra=extra,waves=ww,spec=spectre)
427f1205   Jean-Michel Glorian   version 4.2 merged
51
;stop
6730c3f8   Jean-Philippe Bernard   modified to be co...
52
;====== Plot if needed
427f1205   Jean-Michel Glorian   version 4.2 merged
53
IF !dustem_show_plot NE 0 THEN BEGIN
427f1205   Jean-Michel Glorian   version 4.2 merged
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  dustem_gb_plot_fit_sed,ww,spectre,sed,_extra=extra,res=params*(*(*!dustem_fit).param_init_values),chi2=(*!dustem_fit).chi2,rchi2=(*!dustem_fit).rchi2
;  wait,0.1  ;Sorry for efficiency but needed to see the plot
ENDIF

;=== Caution, do not use message below here, even
;=== with the /info and /continue options, or the
;=== fit procedure will detect an error !
;=== use print instead.
;IF defined(extra) THEN BEGIN
;  IF keyword_set(extra.plot_it) THEN BEGIN
;    print,'dustem_greybody_mpfit: Current parameters values:',pp
;  ENDIF
;ENDIF

the_end:

RETURN,sed
END