Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
Xavier Garrido
CAMEL
Commits
24454a5f
Commit
24454a5f
authored
Feb 16, 2017
by
Matthieu Tristram
Browse files
Put back options for "color" handling
parent
069b144a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
29 deletions
+36
-29
work/tools/python/camel.py
work/tools/python/camel.py
+36
-29
No files found.
work/tools/python/camel.py
View file @
24454a5f
...
...
@@ -400,9 +400,10 @@ def posterior1d( chains, params, nbin=50, smooth=1,
fig
=
plt
.
figure
(
figsize
=
figsize
)
if
len
(
colors
)
<
nchain
:
ax
=
plt
.
gca
()
color_cycle
=
ax
.
_get_lines
.
color_cycle
colors
=
[
next
(
color_cycle
)
for
i
in
range
(
nchain
)]
# ax = plt.gca()
# color_cycle = ax._get_lines.prop_cycler #ax._get_lines.color_cycle
# colors = [next(color_cycle) for i in range(nchain)]
colors
=
rcParams
[
'axes.color_cycle'
]
if
len
(
linestyles
)
<
nchain
:
linestyles
=
[
'-'
]
*
nchain
...
...
@@ -565,9 +566,10 @@ def triangle( chains, params, nbin=50, parnames=None, names=[], colors=[], lines
npar
=
len
(
params
)
if
len
(
colors
)
<
nchain
:
ax
=
plt
.
gca
()
color_cycle
=
ax
.
_get_lines
.
color_cycle
colors
=
[
next
(
color_cycle
)
for
i
in
range
(
nchain
)]
# ax = plt.gca()
# color_cycle = ax._get_lines.prop_cycler #ax._get_lines.color_cycle
# colors = [next(color_cycle) for i in range(nchain)]
colors
=
rcParams
[
'axes.color_cycle'
]
if
len
(
cmaps
)
<
nchain
:
cmaps
=
[
'Blues'
,
'Greens'
,
'Greys'
,
'Oranges'
,
'Purples'
]
...
...
@@ -861,6 +863,7 @@ def gauss_prior(x,m,s):
########################################################################
simple_lik_name
=
{
'smica_g30_ftl_full_pttptt'
:
'lensing'
,
'lowl_SMW_70_dx11d_2014_10_03_v5c_Ap'
:
'bflike'
,
'HiLLiPOP:DX11dHM_superExt_CO_TT'
:
'hlpTT'
,
'Hillipop:DX11dHM_superExt_CO_TT'
:
'hlpPS'
,
...
...
@@ -875,7 +878,7 @@ simple_lik_name = {
'BAO1D_dr12'
:
'BAO(1D)'
,
'boss_dr12'
:
'BAO(3D)'
,
'JLA'
:
'SNIa(JLA)'
}
}
def
writeExtendedBestFit
(
dbdir
,
bfwrite
=
False
,
outpath
=
""
):
#Extract Bestfit from logfile
...
...
@@ -1349,6 +1352,9 @@ class prof:
def
write
(
self
,
filename
):
"""
Write the profile in ASCII file
"""
params
=
[
self
.
parname
]
+
list
(
np
.
extract
(
self
.
_params
(
self
.
_s
[
0
])
!=
self
.
parname
,
self
.
_params
(
self
.
_s
[
0
])))
param_line
=
" "
.
join
(
params
)
+
"
\n
"
...
...
@@ -1453,9 +1459,7 @@ class prof:
def
_params
(
self
,
val
):
"""
Returns list of parameters in the fit
"""
#Returns list of parameters from the fit file for a given value of the parameter
import
os
path
,
dirs
,
files
=
os
.
walk
(
"%s/%s_%s"
%
(
self
.
dbdir
,
self
.
parname
,
val
)).
next
()
files
=
[
f
for
f
in
files
if
f
.
startswith
(
"best"
)]
...
...
@@ -1631,28 +1635,40 @@ class prof:
all plot arguments
"""
ax
=
plt
.
gca
()
color
=
kwargs
.
pop
(
"color"
,
next
(
ax
.
_get_lines
.
color_cycle
))
## from matplotlib import __version__
## if __version__ >= '1.5':
## colordef = next(ax._get_lines.prop_cycler)
## else:
## colordef = next(ax._get_lines.color_cycle)
color
=
kwargs
.
pop
(
"color"
,
None
)
linestyle
=
kwargs
.
pop
(
"linestyle"
,
'-'
)
label
=
kwargs
.
pop
(
"label"
,
None
)
marker
=
kwargs
.
pop
(
"marker"
,
'o'
)
if
extent
==
None
:
extent
=
(
self
.
_v
[
0
],
self
.
_v
[
-
1
])
#plot fit if done
#plot profile
refmin
=
self
.
ymin
if
self
.
_result
:
#use min(ftopot) to set the y shift
vartoplot
=
np
.
linspace
(
*
extent
,
num
=
1000
)
ftoplot
=
self
.
f
(
vartoplot
)
ax
.
plot
(
self
.
_v
,
self
.
_p
-
min
(
ftoplot
),
color
=
color
,
marker
=
marker
,
linestyle
=
''
)
ax
.
set_xlabel
(
parname
.
get
(
self
.
_nameforclass
,
self
.
_nameforclass
),
fontsize
=
fontsize
)
ax
.
set_ylabel
(
"$\chi^2-\chi^2_{min}$"
,
fontsize
=
fontsize
)
ax
.
set_ylim
((
-
0.1
,
5
))
refmin
=
min
(
ftoplot
)
baseplt
,
=
ax
.
plot
(
self
.
_v
,
self
.
_p
-
refmin
,
color
=
color
,
marker
=
marker
,
linestyle
=
''
)
ax
.
set_xlabel
(
parname
.
get
(
self
.
_nameforclass
,
self
.
_nameforclass
),
fontsize
=
fontsize
)
ax
.
set_ylabel
(
"$\chi^2-\chi^2_{min}$"
,
fontsize
=
fontsize
)
ax
.
set_ylim
((
-
0.1
,
5
))
color
=
baseplt
.
get_color
()
if
draw_CL
and
self
.
CL
==
68
:
plt
.
axhline
(
y
=
1
,
color
=
'k'
,
linestyle
=
'--'
)
if
draw_CL
and
self
.
CL
==
68
:
plt
.
axhline
(
y
=
1
,
color
=
'k'
,
linestyle
=
'--'
)
#plot fit
if
self
.
_result
:
ax
.
plot
(
vartoplot
,
ftoplot
-
min
(
ftoplot
),
color
=
color
,
linestyle
=
linestyle
,
label
=
label
,
**
kwargs
)
CI
=
(
self
.
_xlow
,
self
.
_xhigh
)
...
...
@@ -1669,14 +1685,5 @@ class prof:
ax
.
text
(
max
([
self
.
_xmin
,
0.
]),
4
,
' '
+
self
.
_result
,
horizontalalignment
=
'left'
)
else
:
ax
.
text
(
self
.
_xmin
,
4
,
self
.
_result
,
horizontalalignment
=
'center'
)
else
:
ax
.
plot
(
self
.
_v
,
self
.
_p
-
self
.
ymin
,
color
=
color
,
marker
=
marker
,
linestyle
=
''
)
ax
.
set_xlabel
(
parname
.
get
(
self
.
_nameforclass
,
self
.
_nameforclass
),
fontsize
=
fontsize
)
ax
.
set_ylabel
(
"$\chi^2-\chi^2_{min}$"
,
fontsize
=
fontsize
)
ax
.
set_ylim
((
-
0.1
,
5
))
if
draw_CL
and
self
.
CL
==
68
:
plt
.
axhline
(
y
=
1
,
color
=
'k'
,
linestyle
=
'--'
)
########################################################################
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment