Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
9f48a61e
Commit
9f48a61e
authored
Apr 19, 2018
by
Philipp Arras
Browse files
More plotting
parent
81a0d8b6
Pipeline
#27595
passed with stage
in 1 minute and 28 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
demos/krylov_sampling.py
View file @
9f48a61e
...
@@ -80,12 +80,17 @@ plt.legend()
...
@@ -80,12 +80,17 @@ plt.legend()
plt
.
savefig
(
'Krylov_reconstruction.png'
)
plt
.
savefig
(
'Krylov_reconstruction.png'
)
plt
.
close
()
plt
.
close
()
pltdict
=
{
'alpha'
:
.
2
,
'linewidth'
:
.
2
}
pltdict
=
{
'alpha'
:
.
3
,
'linewidth'
:
.
2
}
for
i
in
range
(
N_samps
):
for
i
in
range
(
N_samps
):
if
i
==
0
:
plt
.
plot
(
sky
(
samps_old
[
i
]).
val
,
color
=
'b'
,
**
pltdict
,
label
=
'Traditional samples'
)
plt
.
plot
(
sky
(
samps
[
i
]).
val
,
color
=
'r'
,
**
pltdict
,
label
=
'Krylov samples'
)
else
:
plt
.
plot
(
sky
(
samps_old
[
i
]).
val
,
color
=
'b'
,
**
pltdict
)
plt
.
plot
(
sky
(
samps_old
[
i
]).
val
,
color
=
'b'
,
**
pltdict
)
plt
.
plot
(
sky
(
samps
[
i
]).
val
,
color
=
'r'
,
**
pltdict
)
plt
.
plot
(
sky
(
samps
[
i
]).
val
,
color
=
'r'
,
**
pltdict
)
plt
.
plot
((
s_x
-
m_x
).
val
,
color
=
'k'
)
plt
.
plot
((
s_x
-
m_x
).
val
,
color
=
'k'
,
label
=
'signal - mean'
)
plt
.
savefig
(
'Krylov_samples.png'
)
plt
.
legend
()
plt
.
savefig
(
'Krylov_samples_residuals.png'
)
plt
.
close
()
plt
.
close
()
D_hat_old
=
ift
.
Field
.
zeros
(
x_space
).
val
D_hat_old
=
ift
.
Field
.
zeros
(
x_space
).
val
...
@@ -93,10 +98,10 @@ D_hat_new = ift.Field.zeros(x_space).val
...
@@ -93,10 +98,10 @@ D_hat_new = ift.Field.zeros(x_space).val
for
i
in
range
(
N_samps
):
for
i
in
range
(
N_samps
):
D_hat_old
+=
sky
(
samps_old
[
i
]).
val
**
2
D_hat_old
+=
sky
(
samps_old
[
i
]).
val
**
2
D_hat_new
+=
sky
(
samps
[
i
]).
val
**
2
D_hat_new
+=
sky
(
samps
[
i
]).
val
**
2
plt
.
plot
(
np
.
sqrt
(
D_hat_old
/
N_samps
),
'r--'
,
label
=
'
Old
uncertainty'
)
plt
.
plot
(
np
.
sqrt
(
D_hat_old
/
N_samps
),
'r--'
,
label
=
'
Traditional
uncertainty'
)
plt
.
plot
(
-
np
.
sqrt
(
D_hat_old
/
N_samps
),
'r--'
)
plt
.
plot
(
-
np
.
sqrt
(
D_hat_old
/
N_samps
),
'r--'
)
plt
.
fill_between
(
range
(
len
(
D_hat_new
)),
-
np
.
sqrt
(
D_hat_new
/
N_samps
),
np
.
sqrt
(
plt
.
fill_between
(
range
(
len
(
D_hat_new
)),
-
np
.
sqrt
(
D_hat_new
/
N_samps
),
np
.
sqrt
(
D_hat_new
/
N_samps
),
facecolor
=
'0.5'
,
alpha
=
0.5
,
label
=
'
New
unvertainty'
)
D_hat_new
/
N_samps
),
facecolor
=
'0.5'
,
alpha
=
0.5
,
label
=
'
Krylov
unvertainty'
)
plt
.
plot
((
s_x
-
m_x
).
val
,
color
=
'k'
,
label
=
'signal - mean'
)
plt
.
plot
((
s_x
-
m_x
).
val
,
color
=
'k'
,
label
=
'signal - mean'
)
plt
.
legend
()
plt
.
legend
()
plt
.
savefig
(
'Krylov_uncertainty.png'
)
plt
.
savefig
(
'Krylov_uncertainty.png'
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment