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
18a419e6
Commit
18a419e6
authored
Jan 22, 2018
by
Martin Reinecke
Browse files
make 'plot' directly available
parent
1a867445
Pipeline
#23896
passed with stage
in 4 minutes and 41 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
demos/critical_filtering.py
View file @
18a419e6
...
...
@@ -51,7 +51,7 @@ if __name__ == "__main__":
data_power
=
ift
.
log
(
ift
.
power_analyze
(
fft
.
adjoint_times
(
d
),
binbounds
=
p_space
.
binbounds
))
d_data
=
d
.
val
ift
.
plotting
.
plot
(
d
,
name
=
"data.png"
)
ift
.
plot
(
d
,
name
=
"data.png"
)
IC1
=
ift
.
GradientNormController
(
verbose
=
True
,
iteration_limit
=
100
,
tol_abs_gradnorm
=
0.1
)
...
...
@@ -90,5 +90,5 @@ if __name__ == "__main__":
# Plot current estimate
ift
.
dobj
.
mprint
(
i
)
if
i
%
5
==
0
:
ift
.
plotting
.
plot
(
fft
(
m0
),
name
=
'map.png'
)
if
i
%
5
0
==
0
:
ift
.
plot
(
fft
(
m0
),
name
=
'map.png'
)
demos/log_normal_wiener_filter.py
View file @
18a419e6
...
...
@@ -68,14 +68,13 @@ if __name__ == "__main__":
# Plotting
plotdict
=
{
"xlabel"
:
"Pixel index"
,
"ylabel"
:
"Pixel index"
,
"colormap"
:
"Planck-like"
}
ift
.
plotting
.
plot
(
mock_signal
,
name
=
"mock_signal.png"
,
**
plotdict
)
ift
.
plot
(
mock_signal
,
name
=
"mock_signal.png"
,
**
plotdict
)
logdata
=
np
.
log
(
ift
.
dobj
.
to_global_data
(
data
.
val
)).
reshape
(
signal_space
.
shape
)
ift
.
plotting
.
plot
(
ift
.
Field
(
signal_space
,
val
=
ift
.
dobj
.
from_global_data
(
logdata
)),
name
=
"log_of_data.png"
,
**
plotdict
)
# ift.plotting.plot(m1,name='m_LBFGS.png', **plotdict)
ift
.
plotting
.
plot
(
m2
,
name
=
'm_Newton.png'
,
**
plotdict
)
# ift.plotting.plot(m3, name='m_SteepestDescent.png', **plotdict)
ift
.
plot
(
ift
.
Field
(
signal_space
,
val
=
ift
.
dobj
.
from_global_data
(
logdata
)),
name
=
"log_of_data.png"
,
**
plotdict
)
# ift.plot(m1,name='m_LBFGS.png', **plotdict)
ift
.
plot
(
m2
,
name
=
'm_Newton.png'
,
**
plotdict
)
# ift.plot(m3, name='m_SteepestDescent.png', **plotdict)
# Probing the variance
class
Proby
(
ift
.
DiagonalProberMixin
,
ift
.
Prober
):
...
...
@@ -85,4 +84,4 @@ if __name__ == "__main__":
sm
=
ift
.
FFTSmoothingOperator
(
signal_space
,
sigma
=
0.02
)
variance
=
sm
(
proby
.
diagonal
.
weight
(
-
1
))
ift
.
plotting
.
plot
(
variance
,
name
=
'variance.png'
,
**
plotdict
)
ift
.
plot
(
variance
,
name
=
'variance.png'
,
**
plotdict
)
demos/nonlinear_critical_filter.py
View file @
18a419e6
...
...
@@ -110,7 +110,7 @@ if __name__ == "__main__":
# excitation monopole to 1
m0
,
t0
=
adjust_zero_mode
(
m0
,
t0
)
ift
.
plotting
.
plot
(
true_sky
)
ift
.
plotting
.
plot
(
nonlinearity
(
FFT
.
adjoint_times
(
power0
*
m0
)),
title
=
'reconstructed_sky'
)
ift
.
plotting
.
plot
(
MeasurementOperator
.
adjoint_times
(
d
))
ift
.
plot
(
true_sky
)
ift
.
plot
(
nonlinearity
(
FFT
.
adjoint_times
(
power0
*
m0
)),
title
=
'reconstructed_sky'
)
ift
.
plot
(
MeasurementOperator
.
adjoint_times
(
d
))
demos/paper_demos/cartesian_wiener_filter.py
View file @
18a419e6
...
...
@@ -107,13 +107,12 @@ if __name__ == "__main__":
sm
=
ift
.
FFTSmoothingOperator
(
plot_space
,
sigma
=
0.03
)
plotdict
=
{
"xlabel"
:
"Pixel index"
,
"ylabel"
:
"Pixel index"
,
"colormap"
:
"Planck-like"
}
ift
.
plotting
.
plot
(
ift
.
plot
(
ift
.
log
(
ift
.
sqrt
(
sm
(
ift
.
Field
(
plot_space
,
val
=
variance
.
val
.
real
)))),
name
=
'uncertainty.png'
,
zmin
=
0.
,
zmax
=
3.
,
title
=
"Uncertainty map"
,
**
plotdict
)
ift
.
plotting
.
plot
(
ift
.
Field
(
plot_space
,
val
=
mock_signal
.
val
.
real
),
name
=
'mock_signal.png'
,
**
plotdict
)
ift
.
plotting
.
plot
(
ift
.
Field
(
plot_space
,
val
=
data
.
val
.
real
),
name
=
'data.png'
,
**
plotdict
)
ift
.
plotting
.
plot
(
ift
.
Field
(
plot_space
,
val
=
m
.
val
.
real
),
name
=
'map.png'
,
**
plotdict
)
ift
.
plot
(
ift
.
Field
(
plot_space
,
val
=
mock_signal
.
val
.
real
),
name
=
'mock_signal.png'
,
**
plotdict
)
ift
.
plot
(
ift
.
Field
(
plot_space
,
val
=
data
.
val
.
real
),
name
=
'data.png'
,
**
plotdict
)
ift
.
plot
(
ift
.
Field
(
plot_space
,
val
=
m
.
val
.
real
),
name
=
'map.png'
,
**
plotdict
)
demos/paper_demos/wiener_filter.py
View file @
18a419e6
...
...
@@ -69,8 +69,8 @@ if __name__ == "__main__":
# Plotting
plotdict
=
{
"xlabel"
:
"Pixel index"
,
"ylabel"
:
"Pixel index"
,
"colormap"
:
"Planck-like"
}
ift
.
plotting
.
plot
(
variance
,
name
=
"uncertainty.png"
,
**
plotdict
)
ift
.
plotting
.
plot
(
mock_signal
,
name
=
"mock_signal.png"
,
**
plotdict
)
ift
.
plotting
.
plot
(
ift
.
Field
(
signal_space
,
val
=
data
.
val
),
name
=
"data.png"
,
**
plotdict
)
ift
.
plotting
.
plot
(
m
,
name
=
"map.png"
,
**
plotdict
)
ift
.
plot
(
variance
,
name
=
"uncertainty.png"
,
**
plotdict
)
ift
.
plot
(
mock_signal
,
name
=
"mock_signal.png"
,
**
plotdict
)
ift
.
plot
(
ift
.
Field
(
signal_space
,
val
=
data
.
val
),
name
=
"data.png"
,
**
plotdict
)
ift
.
plot
(
m
,
name
=
"map.png"
,
**
plotdict
)
demos/wiener_filter_via_curvature.py
View file @
18a419e6
...
...
@@ -77,9 +77,8 @@ if __name__ == "__main__":
sspace2
=
ift
.
RGSpace
(
shape
,
distances
=
L
/
N_pixels
/
nu
.
m
)
ift
.
plotting
.
plot
(
ift
.
Field
(
sspace2
,
mock_signal
.
val
)
/
nu
.
K
,
name
=
"mock_signal.png"
)
ift
.
plot
(
ift
.
Field
(
sspace2
,
mock_signal
.
val
)
/
nu
.
K
,
name
=
"mock_signal.png"
)
data
=
ift
.
dobj
.
to_global_data
(
data
.
val
).
reshape
(
sspace2
.
shape
)
/
nu
.
K
data
=
ift
.
Field
(
sspace2
,
val
=
ift
.
dobj
.
from_global_data
(
data
))
/
nu
.
K
ift
.
plotting
.
plot
(
ift
.
Field
(
sspace2
,
val
=
data
),
name
=
"data.png"
)
ift
.
plotting
.
plot
(
ift
.
Field
(
sspace2
,
m_s
.
val
)
/
nu
.
K
,
name
=
"map.png"
)
ift
.
plot
(
ift
.
Field
(
sspace2
,
val
=
data
),
name
=
"data.png"
)
ift
.
plot
(
ift
.
Field
(
sspace2
,
m_s
.
val
)
/
nu
.
K
,
name
=
"map.png"
)
demos/wiener_filter_via_hamiltonian.py
View file @
18a419e6
...
...
@@ -62,8 +62,8 @@ if __name__ == "__main__":
energy
,
convergence
=
minimizer
(
energy
)
m
=
energy
.
position
D
=
energy
.
curvature
ift
.
plotting
.
plot
(
ss
,
name
=
"signal.png"
,
colormap
=
"Planck-like"
)
ift
.
plotting
.
plot
(
fft
(
m
),
name
=
"m.png"
,
colormap
=
"Planck-like"
)
ift
.
plot
(
ss
,
name
=
"signal.png"
,
colormap
=
"Planck-like"
)
ift
.
plot
(
fft
(
m
),
name
=
"m.png"
,
colormap
=
"Planck-like"
)
# sampling the uncertainty map
sample_variance
=
ift
.
Field
.
zeros
(
s_space
)
...
...
@@ -77,4 +77,4 @@ if __name__ == "__main__":
sample_mean
/=
n_samples
sample_variance
/=
n_samples
variance
=
sample_variance
-
sample_mean
**
2
ift
.
plotting
.
plot
(
variance
,
name
=
"variance.png"
,
colormap
=
"Planck-like"
)
ift
.
plot
(
variance
,
name
=
"variance.png"
,
colormap
=
"Planck-like"
)
nifty4/__init__.py
View file @
18a419e6
...
...
@@ -9,6 +9,6 @@ from .spaces import *
from
.operators
import
*
from
.probing
import
*
from
.sugar
import
*
from
.
import
plot
ting
from
.
plotting
import
plot
from
.
import
library
from
.
import
dobj
nifty4/domain_object.py
View file @
18a419e6
...
...
@@ -114,7 +114,4 @@ class DomainObject(with_metaclass(
@
property
def
total_volume
(
self
):
tmp
=
self
.
dvol
()
if
np
.
isscalar
(
tmp
):
return
self
.
dim
*
tmp
else
:
return
np
.
sum
(
tmp
)
return
self
.
dim
*
tmp
if
np
.
isscalar
(
tmp
)
else
np
.
sum
(
tmp
)
nifty4/field.py
View file @
18a419e6
...
...
@@ -541,7 +541,7 @@ class Field(object):
minmax
=
[
self
.
min
(),
self
.
max
()]
mean
=
self
.
mean
()
return
"nifty4.Field instance
\n
- domain = "
+
\
repr
(
self
.
_domain
)
+
\
self
.
_domain
.
__str__
(
)
+
\
"
\n
- val = "
+
repr
(
self
.
val
)
+
\
"
\n
- min.,max. = "
+
str
(
minmax
)
+
\
"
\n
- mean = "
+
str
(
mean
)
...
...
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