read_muse_templates_info.pro
4.13 KB
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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
FUNCTION read_muse_templates_info,age_values=age_values,metalicity_values=metalicity_values,young=young,object=object,Nbins=Nbins,Nage=Nage,NZ=NZ,bins=bins
dustem_define_la_common
use_object='NGC0628'
IF keyword_set(object) THEN use_object=object
;stop
IF keyword_set(young) THEN BEGIN
dir='/Volumes/PILOT_FLIGHT1/PHANGS_MUSE/DR2p2/coopt/MUSEDAP/young'
file=dir+'/'+use_object+'-0.92asec_templates_SFH_info.fits'
ENDIF ELSE BEGIN
dir='/Volumes/PILOT_FLIGHT1/PHANGS_MUSE/DR2p2/coopt/MUSEDAP/fiducial'
file=dir+'/'+use_object+'-0.92asec_templates_SFH_info.fits'
ENDELSE
st_templates=mrdfits(file,1,h)
help,st_templates,/str
;** Structure <cd20ff78>, 5 tags, length=40, data length=40, refs=1:
; ID LONG64 0
; AGE DOUBLE 1.9953000
; Z DOUBLE -0.40000000
; M_ DOUBLE 0.63730000
; M__LV DOUBLE 0.75800000
;print,minmax(st_templates.id)
; 0 67
;print,minmax(st_templates.age)
;0.0063000000 15.848900
;print,minmax(st_templates.Z)
; -0.72000000 0.41000000
order=sort(st_templates.age)
ages=st_templates[order].age
un=uniq(ages)
age_values=ages[un]
Nage=n_elements(age_values)
order=sort(st_templates.Z)
metalicity=st_templates[order].Z
un=uniq(metalicity)
metalicity_values=metalicity[un]
NZ=n_elements(metalicity_values)
Nbins=Nage*NZ
print,age_values
print,metalicity_values
;stop
bins=lonarr(Nage,NZ)
bins[*]=la_undef(2)
FOR i=0L,Nage-1 DO BEGIN
FOR j=0L,NZ-1 DO BEGIN
ind=where(st_templates.age EQ age_values[i] AND st_templates.Z EQ metalicity_values[j],count)
IF count NE 0 THEN BEGIN
bins[i,j]=st_templates[ind].id
ENDIF ELSE BEGIN
message,'Did not find age='+strtrim(age_values[i],2)+' Z='+strtrim(metalicity_values[j],2),/info
;stop
ENDELSE
ENDFOR
ENDFOR
; round metalicity values to match ssps file names
try=round(metalicity_values*100)/100.
metalicity_values=try
print,age_values
print,metalicity_values
;stop
; 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]
; metalicity_values=[-1.49, -0.96, -0.35, +0.06, +0.26, +0.4]
RETURN,st_templates
; ENDIF ELSE BEGIN
; dir='/Volumes/PILOT_FLIGHT1/PHANGS_MUSE/DR2p2/coopt/MUSEDAP/fiducial'
; ;NGC0628-0.92asec_templates_SFH_info.fits
; file=dir+'/'+use_object+'-0.92asec_templates_SFH_info.fits'
; st_templates=mrdfits(file,1,h)
; help,st_templates,/str
; ;** Structure <a93050c8>, 5 tags, length=40, data length=40, refs=1:
; ; ID LONG64 0
; ; AGE DOUBLE 0.15000000
; ; Z DOUBLE 0.25590000
; ; M_ DOUBLE 0.75750000
; ; M__LV DOUBLE 0.16300000
; print,age_values
; ; 0.030000000 0.050000000 0.080000000 0.15000000 0.25000000 0.40000000 0.60000000 1.0000000 1.7500000 3.0000000 5.0000000 8.5000000 13.500000
; print,metalicity_values
; ; -1.4863000 -0.96140000 -0.35120000 0.060000000 0.25590000 0.39710000
; order=sort(st_templates.age)
; ages=st_templates[order].age
; un=uniq(ages)
; age_values=ages[un]
; Nage=n_elements(age_values)
; order=sort(st_templates.Z)
; metalicity=st_templates[order].Z
; un=uniq(metalicity)
; metalicity_values=metalicity[un]
; NZ=n_elements(metalicity_values)
; Nbins=Nage*NZ
; stop
; 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]
; metalicity_values=[-1.49, -0.96, -0.35, +0.06, +0.26, +0.4]
; Nage=n_elements(age_values)
; NZ=n_elements(metalicity_values)
; Nbins=Nage*NZ
; one_st={ID:0LL,AGE:la_undef(5),Z:la_undef(5),M_:la_undef(5),M__LV:la_undef(5)}
; st_templates=replicate(one_st,Nbins)
; bins=lonarr(Nage,NZ)
; bins[*]=la_undef(2)
; ;stop
; FOR i=0L,Nbins-1 DO BEGIN
; bins[i]=i
; st_templates[i].ID=i
; ij=index2ij([i],[NAGE,NZ])
; st_templates[i].AGE=age_values[ij[0,0]]
; st_templates[i].Z=metalicity_values[ij[0,1]]
; ENDFOR
; ENDELSE
; RETURN,st_templates
END