forked from jdeast/EXOFASTv2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcmc2str.pro
67 lines (45 loc) · 1.43 KB
/
mcmc2str.pro
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
;; copies str while stripping all parameters that don't have
;; fit=1 or derived=1, and expand the value tag to an NSTEPS x NCHAINS
;; array
pro mcmc2str, pars, str
newpar
for i=0, n_tags(str)-1 do begin
if n_tags(str.(i)) ne 0 then begin
;; create new object structures
for k=0, n_tags(str.(i))-1 do begin
; if n_tags(str.(i))
if str.(i)[0].(k).fit or str.(i)[0].(k).derive then begin
newstr = create_struct(newstr, str.(i)[0].(k))
help, str.(i)[0].(k)
stop
endfor
endif else begin
;; copy metadata directly
endelse
endfor
stop
newpar =
for i=0, n_tags(str)-1 do begin
for j=0, n_elements(str.(i))-1 do begin
for k=0, n_tags(str.(i)[j])-1 do begin
if n_tags(str.(i)[j].(k)) eq 0 then begin
if tag_exist(str.(i)[j].(k),'fit') then begin
if str.(i)[j].(k).fit then tofit = [[tofit],[i,j,k]]
endif else begin
;; copy metadata directly
newstr = create_struct(newstr, newpar)
endelse
endif else begin
;; copy metadata directly
endelse
endfor
endfor
endfor
tofit = *(str.tofit)
npars = n_elements(tofit[0,*])
for i=0, npars-1 do $
str.(tofit[0,i])[tofit[1,i]].(tofit[2,i]).value = transpose(pars[i,*])
names = ['a','b']
values = [1,1]
newstr = create_struct(names,values)
end