Blame view

LabTools/IRAP/JPB/phangs_compare_seds_isrf.pro 2.18 KB
42b6dd57   Jean-Philippe Bernard   first commit
1

0f653ae3   Jean-Philippe Bernard   first commit
2
PRO phangs_compare_seds_isrf,isrf_class,N_seds=N_seds
38087e96   Jean-Philippe Bernard   first commit
3

0f653ae3   Jean-Philippe Bernard   first commit
4
;phangs_compare_seds_isrf,15,N_seds=1000L
42b6dd57   Jean-Philippe Bernard   first commit
5
6

dir=!phangs_data_dir+'/ISRF/GRIDS/'
38087e96   Jean-Philippe Bernard   first commit
7
isrf_class_str='_isrfclass'+strtrim(isrf_class,2)
42b6dd57   Jean-Philippe Bernard   first commit
8
9
10
model='DBP90'
table_name=dir+model+'_MuseISRF_JWST_G0_YPAH_YVSG_4Phangs'+isrf_class_str+'.fits'
st=mrdfits(table_name,1,h)
8cd73405   Jean-Philippe Bernard   first commit
11
Nst=n_elements(st)
42b6dd57   Jean-Philippe Bernard   first commit
12

51c39c71   Jean-Philippe Bernard   first commit
13
14
use_filters_names=['F360M','F0770W','F1000W','F1130W','F2100W']
filters=dustem_filter_names2filters(use_filters_names)
758aaa55   Jean-Philippe Bernard   first commit
15
Nfilters=n_elements(filters)
42b6dd57   Jean-Philippe Bernard   first commit
16
17

ii=100L
c750f66d   Jean-Philippe Bernard   first commit
18

38087e96   Jean-Philippe Bernard   first commit
19
Nseds=100L
0f653ae3   Jean-Philippe Bernard   first commit
20
21
IF keyword_set(N_seds) THEN Nseds=N_seds

42b6dd57   Jean-Philippe Bernard   first commit
22
Nparams=3
8cd73405   Jean-Philippe Bernard   first commit
23
true_params=fltarr(Nseds,Nparams)
2d3601c1   Jean-Philippe Bernard   first commit
24
fitted_params=fltarr(Nseds,Nparams)
8cd73405   Jean-Philippe Bernard   first commit
25
26
27
seed=1

FOR j=0L,Nseds-1 DO BEGIN
1045844e   Jean-Philippe Bernard   first commit
28
	;seed=1
b171b249   Jean-Philippe Bernard   first commit
29
	inn=abs(randomu(seed))
861fc7e8   Jean-Philippe Bernard   first commit
30
    ii=inn*Nst
38087e96   Jean-Philippe Bernard   first commit
31
    ;print,inn,ii
8cd73405   Jean-Philippe Bernard   first commit
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	sed=dustem_initialize_sed(Nfilters)
	;sed=fltarr(Nfilters)
	tags=tag_names(st)
	FOR i=0L,Nfilters-1 DO BEGIN
		ind=where(tags EQ 'I'+filters[i],count)
		sed[i].filter=filters[i]
		sed[i].stokesI=st[ii].(ind[0])
	ENDFOR
	sed.sigmaii=sed.stokesI*1.e-5
	FOR i=0L,Nparams-1 DO BEGIN
	  true_params[j,i]=st[ii].(i)
	ENDFOR

	;stop

5831d1e9   Jean-Philippe Bernard   first commit
47
48
	fit_isrf_class_str='_isrfclass0'
	table_name_2=dir+model+'_MuseISRF_JWST_G0_YPAH_YVSG_4Phangs'+fit_isrf_class_str+'.fits'
8cd73405   Jean-Philippe Bernard   first commit
49
50
51
52
53

	params=dustem_brute_force_fit(sed,table_name_2,filters,fact=fact,chi2=chi2,/normalize,rchi2=rchi2,show_sed=show_sed $
			   					 ,params_hit=params_hit,params_uncertainties=params_uncertainties,params_min=params_min,params_max=params_max $
			   					 ,fixed_parameters_description=fixed_parameters_description,fixed_parameters_values=fixed_parameters_values)
    fitted_params[j,*]=params
42b6dd57   Jean-Philippe Bernard   first commit
54

8cd73405   Jean-Philippe Bernard   first commit
55
ENDFOR
42b6dd57   Jean-Philippe Bernard   first commit
56

3a667b1d   Jean-Philippe Bernard   first commit
57
win=0L
38087e96   Jean-Philippe Bernard   first commit
58
xtit='True parameter ('+isrf_class_str+')'
3a667b1d   Jean-Philippe Bernard   first commit
59
60
61
62
ytit='recovered parameter (Mathis ISRF)'

window,win & win=win+1
cgplot,true_params[*,0],fitted_params[*,0],tit='G0',psym=4,/xlog,/ylog,xtit=xtit,ytit=ytit
32cccb36   Jean-Philippe Bernard   first commit
63
64
cgoplot,10^!x.crange,10^!y.crange,linestyle=2,color='red',thickness=3

3a667b1d   Jean-Philippe Bernard   first commit
65
66
window,win & win=win+1
cgplot,true_params[*,1],fitted_params[*,1],tit='Ypah',psym=4,/xlog,/ylog,xtit=xtit,ytit=ytit
32cccb36   Jean-Philippe Bernard   first commit
67
68
cgoplot,10^!x.crange,10^!y.crange,linestyle=2,color='red',thickness=3

3a667b1d   Jean-Philippe Bernard   first commit
69
70
window,win & win=win+1
cgplot,true_params[*,2],fitted_params[*,2],tit='Yvsg',psym=4,/xlog,/ylog,xtit=xtit,ytit=ytit
38087e96   Jean-Philippe Bernard   first commit
71
cgoplot,10^!x.crange,10^!y.crange,linestyle=2,color='red',thickness=3
3a667b1d   Jean-Philippe Bernard   first commit
72

32cccb36   Jean-Philippe Bernard   first commit
73
74
stop

42b6dd57   Jean-Philippe Bernard   first commit
75
END