Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PE_CBL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FWF-DEPENDABLE
PE_CBL
Commits
a2b2aea4
Commit
a2b2aea4
authored
Jul 12, 2024
by
Stefano Serafin
Browse files
Options
Downloads
Patches
Plain Diff
added code to plot parameter distributions
parent
d793dece
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
graphics.py
+44
-7
44 additions, 7 deletions
graphics.py
with
44 additions
and
7 deletions
graphics.py
+
44
−
7
View file @
a2b2aea4
...
@@ -131,10 +131,47 @@ def plot_CBL_PE(exp,figtitle,parameter_id=0,plot_spread=False,ax=None):
...
@@ -131,10 +131,47 @@ def plot_CBL_PE(exp,figtitle,parameter_id=0,plot_spread=False,ax=None):
pt
=
exp
.
nr
.
parameter_transform
pt
=
exp
.
nr
.
parameter_transform
parameter_number
=
exp
.
nr
.
parameter_number
parameter_number
=
exp
.
nr
.
parameter_number
b
=
exp
.
da
.
backgrounds
[:,
-
parameter_number
:,:][:,
parameter_id
,:]
par_tran
=
exp
.
da
.
backgrounds
[:,
-
parameter_number
:,:][:,
parameter_id
,:]
par_
b
=
pt
[
parameter_id
](
exp
.
da
.
backgrounds
[:,
-
parameter_number
:,:][:,
parameter_id
,:]
,
kind
=
'
inv
'
)
par_
phys
=
pt
[
parameter_id
](
par_tran
,
kind
=
'
inv
'
)
t
=
exp
.
da
.
time
/
3600.
t
=
exp
.
da
.
time
/
3600.
plot_parameter_histogram
=
True
if
plot_parameter_histogram
:
print
(
par_tran
[
-
1
,:])
p10beg_tran
=
np
.
percentile
(
par_tran
[
0
,:],
10
)
p90beg_tran
=
np
.
percentile
(
par_tran
[
0
,:],
90
)
p10end_tran
=
np
.
percentile
(
par_tran
[
-
1
,:],
10
)
p90end_tran
=
np
.
percentile
(
par_tran
[
-
1
,:],
90
)
p10beg_phys
=
np
.
percentile
(
par_phys
[
0
,:],
10
)
p90beg_phys
=
np
.
percentile
(
par_phys
[
0
,:],
90
)
p10end_phys
=
np
.
percentile
(
par_phys
[
-
1
,:],
10
)
p90end_phys
=
np
.
percentile
(
par_phys
[
-
1
,:],
90
)
#
fig
=
p
.
figure
(
151
)
fig
.
set_size_inches
(
6
,
3
)
#
ax1
=
fig
.
add_subplot
(
1
,
2
,
1
)
ax1
.
hist
(
par_phys
[
0
,:],
bins
=
np
.
linspace
(
0
,
5
,
51
),
density
=
True
,
histtype
=
'
step
'
,
color
=
'
blue
'
,
label
=
'
initial
'
)
ax1
.
axvspan
(
p10beg_phys
,
p90beg_phys
,
color
=
'
blue
'
,
lw
=
0
,
alpha
=
0.1
)
ax1
.
hist
(
par_phys
[
-
1
,:],
bins
=
np
.
linspace
(
0
,
5
,
51
),
density
=
True
,
histtype
=
'
step
'
,
color
=
'
red
'
,
label
=
'
final
'
)
ax1
.
axvspan
(
p10end_phys
,
p90end_phys
,
color
=
'
red
'
,
lw
=
0
,
alpha
=
0.1
)
ax1
.
axvline
(
x
=
exp
.
nr
.
parameter_true
,
color
=
'
black
'
,
dashes
=
[
3
,
1
])
ax1
.
set_xlabel
(
r
'
$p$
'
)
ax1
.
set_ylabel
(
'
probability density
'
)
#
ax2
=
fig
.
add_subplot
(
1
,
2
,
2
)
ax2
.
hist
(
par_tran
[
0
,:],
bins
=
np
.
linspace
(
np
.
log
(
0.01
),
np
.
log
(
5
),
51
),
density
=
True
,
histtype
=
'
step
'
,
color
=
'
blue
'
,
label
=
'
initial
'
)
ax2
.
axvspan
(
p10beg_tran
,
p90beg_tran
,
color
=
'
blue
'
,
lw
=
0
,
alpha
=
0.1
)
ax2
.
hist
(
par_tran
[
-
1
,:],
bins
=
np
.
linspace
(
np
.
log
(
0.01
),
np
.
log
(
5
),
51
),
density
=
True
,
histtype
=
'
step
'
,
color
=
'
red
'
,
label
=
'
final
'
)
ax2
.
axvspan
(
p10end_tran
,
p90end_tran
,
color
=
'
red
'
,
lw
=
0
,
alpha
=
0.1
)
ax2
.
axvline
(
x
=
pt
[
parameter_id
](
exp
.
nr
.
parameter_true
,
kind
=
'
dir
'
),
color
=
'
black
'
,
dashes
=
[
3
,
1
])
ax2
.
set_xlabel
(
r
'
log($p$)
'
)
ax2
.
set_ylabel
(
'
probability density
'
)
#
fig
.
tight_layout
()
fig
.
savefig
(
'
p_histogram_%s.png
'
%
exp
.
label
,
format
=
'
png
'
,
dpi
=
300
)
p
.
close
(
fig
)
if
ax
is
None
:
if
ax
is
None
:
printfigure
=
True
printfigure
=
True
else
:
else
:
...
@@ -151,10 +188,10 @@ def plot_CBL_PE(exp,figtitle,parameter_id=0,plot_spread=False,ax=None):
...
@@ -151,10 +188,10 @@ def plot_CBL_PE(exp,figtitle,parameter_id=0,plot_spread=False,ax=None):
else
:
else
:
ax1
=
ax
ax1
=
ax
ax1
.
step
(
t
,
par_
b
.
mean
(
axis
=
1
),
color
=
mean_color
)
ax1
.
step
(
t
,
par_
phys
.
mean
(
axis
=
1
),
color
=
mean_color
)
for
i
in
range
(
t
.
size
-
1
):
for
i
in
range
(
t
.
size
-
1
):
bmin
=
np
.
percentile
(
par_
b
,
10
,
axis
=
1
)[
i
+
1
]
bmin
=
np
.
percentile
(
par_
phys
,
10
,
axis
=
1
)[
i
+
1
]
bmax
=
np
.
percentile
(
par_
b
,
90
,
axis
=
1
)[
i
+
1
]
bmax
=
np
.
percentile
(
par_
phys
,
90
,
axis
=
1
)[
i
+
1
]
ax1
.
fill_between
(
t
[
i
:
i
+
2
],
\
ax1
.
fill_between
(
t
[
i
:
i
+
2
],
\
y1
=
[
bmin
,
bmin
],
\
y1
=
[
bmin
,
bmin
],
\
y2
=
[
bmax
,
bmax
],
\
y2
=
[
bmax
,
bmax
],
\
...
@@ -166,8 +203,8 @@ def plot_CBL_PE(exp,figtitle,parameter_id=0,plot_spread=False,ax=None):
...
@@ -166,8 +203,8 @@ def plot_CBL_PE(exp,figtitle,parameter_id=0,plot_spread=False,ax=None):
if
printfigure
and
plot_spread
:
if
printfigure
and
plot_spread
:
ax2
=
fig
.
add_subplot
(
ii
,
1
,
2
)
ax2
=
fig
.
add_subplot
(
ii
,
1
,
2
)
ax2
.
plot
(
t
,
par_
b
.
std
(
axis
=
1
),
color
=
mean_color
,
label
=
'
physical
'
)
ax2
.
plot
(
t
,
par_
phys
.
std
(
axis
=
1
),
color
=
mean_color
,
label
=
'
physical
'
)
ax2
.
plot
(
t
,
b
.
std
(
axis
=
1
),
color
=
mean_color_2
,
label
=
'
transformed
'
,
linestyle
=
'
--
'
)
ax2
.
plot
(
t
,
par_tran
.
std
(
axis
=
1
),
color
=
mean_color_2
,
label
=
'
transformed
'
,
linestyle
=
'
--
'
)
ax2
.
legend
()
ax2
.
legend
()
ax2
.
set_title
(
'
Parameter spread
'
)
ax2
.
set_title
(
'
Parameter spread
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment