Skip to content
GitLab
Menu
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
53d607e9
Commit
53d607e9
authored
Jan 16, 2018
by
Martin Reinecke
Browse files
more fixes; nosetests are passin now
parent
de7c2aba
Pipeline
#23750
passed with stage
in 4 minutes and 36 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/library/wiener_filter_curvature.py
View file @
53d607e9
...
@@ -55,10 +55,10 @@ class WienerFilterCurvature(EndomorphicOperator):
...
@@ -55,10 +55,10 @@ class WienerFilterCurvature(EndomorphicOperator):
covariance.
covariance.
"""
"""
power
=
sqrt
(
power_analyze
(
self
.
S
.
diagonal
()))
power
=
power_analyze
(
sqrt
(
self
.
S
.
diagonal
()))
mock_signal
=
power_synthesize
(
power
,
real_signal
=
True
)
mock_signal
=
power_synthesize
(
power
,
real_signal
=
True
)
noise
=
self
.
N
.
diagonal
()
.
weight
(
-
1
)
noise
=
self
.
N
.
diagonal
()
mock_noise
=
Field
.
from_random
(
random_type
=
"normal"
,
mock_noise
=
Field
.
from_random
(
random_type
=
"normal"
,
domain
=
self
.
N
.
domain
,
dtype
=
noise
.
dtype
)
domain
=
self
.
N
.
domain
,
dtype
=
noise
.
dtype
)
...
...
nifty/operators/dof_projection_operator.py
View file @
53d607e9
...
@@ -62,7 +62,7 @@ class DOFProjectionOperator(LinearOperator):
...
@@ -62,7 +62,7 @@ class DOFProjectionOperator(LinearOperator):
self
.
_pshape
=
(
presize
,
self
.
_dofdex
.
size
,
postsize
)
self
.
_pshape
=
(
presize
,
self
.
_dofdex
.
size
,
postsize
)
def
_times
(
self
,
x
):
def
_times
(
self
,
x
):
arr
=
dobj
.
local_data
(
x
.
weight
(
1
).
val
)
arr
=
dobj
.
local_data
(
x
.
val
)
arr
=
arr
.
reshape
(
self
.
_pshape
)
arr
=
arr
.
reshape
(
self
.
_pshape
)
oarr
=
np
.
zeros
(
self
.
_hshape
,
dtype
=
x
.
dtype
)
oarr
=
np
.
zeros
(
self
.
_hshape
,
dtype
=
x
.
dtype
)
np
.
add
.
at
(
oarr
,
(
slice
(
None
),
self
.
_dofdex
,
slice
(
None
)),
arr
)
np
.
add
.
at
(
oarr
,
(
slice
(
None
),
self
.
_dofdex
,
slice
(
None
)),
arr
)
...
@@ -75,7 +75,7 @@ class DOFProjectionOperator(LinearOperator):
...
@@ -75,7 +75,7 @@ class DOFProjectionOperator(LinearOperator):
res
=
Field
(
self
.
_target
,
res
=
Field
(
self
.
_target
,
dobj
.
from_local_data
(
self
.
_target
.
shape
,
oarr
,
dobj
.
from_local_data
(
self
.
_target
.
shape
,
oarr
,
dobj
.
default_distaxis
()))
dobj
.
default_distaxis
()))
return
res
.
weight
(
-
1
,
spaces
=
self
.
_space
)
return
res
def
_adjoint_times
(
self
,
x
):
def
_adjoint_times
(
self
,
x
):
res
=
Field
.
empty
(
self
.
_domain
,
dtype
=
x
.
dtype
)
res
=
Field
.
empty
(
self
.
_domain
,
dtype
=
x
.
dtype
)
...
...
nifty/operators/laplace_operator.py
View file @
53d607e9
...
@@ -96,13 +96,13 @@ class LaplaceOperator(EndomorphicOperator):
...
@@ -96,13 +96,13 @@ class LaplaceOperator(EndomorphicOperator):
ret
[
sl_l
]
=
deriv
ret
[
sl_l
]
=
deriv
ret
[
prefix
+
(
-
1
,)]
=
0.
ret
[
prefix
+
(
-
1
,)]
=
0.
ret
[
sl_r
]
-=
deriv
ret
[
sl_r
]
-=
deriv
ret
/=
np
.
sqrt
(
dposc
)
ret
/=
dposc
ret
[
prefix
+
(
slice
(
None
,
2
),)]
=
0.
ret
[
prefix
+
(
slice
(
None
,
2
),)]
=
0.
ret
[
prefix
+
(
-
1
,)]
=
0.
ret
[
prefix
+
(
-
1
,)]
=
0.
ret
=
dobj
.
from_local_data
(
locval
.
shape
,
ret
,
dobj
.
distaxis
(
locval
))
ret
=
dobj
.
from_local_data
(
locval
.
shape
,
ret
,
dobj
.
distaxis
(
locval
))
if
dobj
.
distaxis
(
locval
)
!=
dobj
.
distaxis
(
x
.
val
):
if
dobj
.
distaxis
(
locval
)
!=
dobj
.
distaxis
(
x
.
val
):
ret
=
dobj
.
redistribute
(
ret
,
dist
=
dobj
.
distaxis
(
x
.
val
))
ret
=
dobj
.
redistribute
(
ret
,
dist
=
dobj
.
distaxis
(
x
.
val
))
return
Field
(
self
.
domain
,
val
=
ret
)
.
weight
(
-
0.5
,
spaces
=
self
.
_space
)
return
Field
(
self
.
domain
,
val
=
ret
)
def
_adjoint_times
(
self
,
x
):
def
_adjoint_times
(
self
,
x
):
axes
=
x
.
domain
.
axes
[
self
.
_space
]
axes
=
x
.
domain
.
axes
[
self
.
_space
]
...
@@ -113,11 +113,11 @@ class LaplaceOperator(EndomorphicOperator):
...
@@ -113,11 +113,11 @@ class LaplaceOperator(EndomorphicOperator):
sl_r
=
prefix
+
(
slice
(
1
,
None
),)
# "right" slice
sl_r
=
prefix
+
(
slice
(
1
,
None
),)
# "right" slice
dpos
=
self
.
_dpos
.
reshape
((
1
,)
*
axis
+
(
nval
-
1
,))
dpos
=
self
.
_dpos
.
reshape
((
1
,)
*
axis
+
(
nval
-
1
,))
dposc
=
self
.
_dposc
.
reshape
((
1
,)
*
axis
+
(
nval
,))
dposc
=
self
.
_dposc
.
reshape
((
1
,)
*
axis
+
(
nval
,))
yf
=
x
.
weight
(
0.5
,
spaces
=
self
.
_space
).
val
yf
=
x
.
val
if
axis
==
dobj
.
distaxis
(
yf
):
if
axis
==
dobj
.
distaxis
(
yf
):
yf
=
dobj
.
redistribute
(
yf
,
nodist
=
(
axis
,))
yf
=
dobj
.
redistribute
(
yf
,
nodist
=
(
axis
,))
y
=
dobj
.
local_data
(
yf
)
y
=
dobj
.
local_data
(
yf
)
y
/=
np
.
sqrt
(
dposc
)
y
/=
dposc
y
[
prefix
+
(
slice
(
None
,
2
),)]
=
0.
y
[
prefix
+
(
slice
(
None
,
2
),)]
=
0.
y
[
prefix
+
(
-
1
,)]
=
0.
y
[
prefix
+
(
-
1
,)]
=
0.
deriv
=
(
y
[
sl_r
]
-
y
[
sl_l
])
/
dpos
# defined between points
deriv
=
(
y
[
sl_r
]
-
y
[
sl_l
])
/
dpos
# defined between points
...
@@ -128,7 +128,7 @@ class LaplaceOperator(EndomorphicOperator):
...
@@ -128,7 +128,7 @@ class LaplaceOperator(EndomorphicOperator):
ret
=
dobj
.
from_local_data
(
x
.
shape
,
ret
,
dobj
.
distaxis
(
yf
))
ret
=
dobj
.
from_local_data
(
x
.
shape
,
ret
,
dobj
.
distaxis
(
yf
))
if
dobj
.
distaxis
(
yf
)
!=
dobj
.
distaxis
(
x
.
val
):
if
dobj
.
distaxis
(
yf
)
!=
dobj
.
distaxis
(
x
.
val
):
ret
=
dobj
.
redistribute
(
ret
,
dist
=
dobj
.
distaxis
(
x
.
val
))
ret
=
dobj
.
redistribute
(
ret
,
dist
=
dobj
.
distaxis
(
x
.
val
))
return
Field
(
self
.
domain
,
val
=
ret
)
.
weight
(
-
1
,
spaces
=
self
.
_space
)
return
Field
(
self
.
domain
,
val
=
ret
)
def
apply
(
self
,
x
,
mode
):
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
self
.
_check_input
(
x
,
mode
)
...
...
nifty/probing/trace_prober_mixin.py
View file @
53d607e9
...
@@ -37,9 +37,9 @@ class TraceProberMixin(object):
...
@@ -37,9 +37,9 @@ class TraceProberMixin(object):
def
finish_probe
(
self
,
probe
,
pre_result
):
def
finish_probe
(
self
,
probe
,
pre_result
):
if
self
.
__evaluate_probe_in_signal_space
:
if
self
.
__evaluate_probe_in_signal_space
:
fft
=
create_composed_fft_operator
(
self
.
_domain
,
all_to
=
'position'
)
fft
=
create_composed_fft_operator
(
self
.
_domain
,
all_to
=
'position'
)
result
=
fft
(
probe
[
1
]).
weight
(
-
1
).
vdot
(
fft
(
pre_result
))
result
=
fft
(
probe
[
1
]).
vdot
(
fft
(
pre_result
))
else
:
else
:
result
=
probe
[
1
].
weight
(
-
1
).
vdot
(
pre_result
)
result
=
probe
[
1
].
vdot
(
pre_result
)
self
.
__sum_of_probings
+=
result
self
.
__sum_of_probings
+=
result
if
self
.
compute_variance
:
if
self
.
compute_variance
:
...
...
nifty/sugar.py
View file @
53d607e9
...
@@ -40,7 +40,7 @@ def PS_field(pspace, func, dtype=None):
...
@@ -40,7 +40,7 @@ def PS_field(pspace, func, dtype=None):
def
_single_power_analyze
(
field
,
idx
,
binbounds
):
def
_single_power_analyze
(
field
,
idx
,
binbounds
):
power_domain
=
PowerSpace
(
field
.
domain
[
idx
],
binbounds
)
power_domain
=
PowerSpace
(
field
.
domain
[
idx
],
binbounds
)
ppo
=
PowerProjectionOperator
(
field
.
domain
,
power_domain
,
idx
)
ppo
=
PowerProjectionOperator
(
field
.
domain
,
power_domain
,
idx
)
return
ppo
(
field
.
weight
(
-
1
))
return
ppo
(
field
.
weight
(
1
))
.
weight
(
-
1
)
# divides by bin size
def
power_analyze
(
field
,
spaces
=
None
,
binbounds
=
None
,
def
power_analyze
(
field
,
spaces
=
None
,
binbounds
=
None
,
...
@@ -103,7 +103,6 @@ def power_analyze(field, spaces=None, binbounds=None,
...
@@ -103,7 +103,6 @@ def power_analyze(field, spaces=None, binbounds=None,
else
:
else
:
parts
=
[
field
.
real
*
field
.
real
+
field
.
imag
*
field
.
imag
]
parts
=
[
field
.
real
*
field
.
real
+
field
.
imag
*
field
.
imag
]
parts
=
[
part
.
weight
(
1
,
spaces
)
for
part
in
parts
]
for
space_index
in
spaces
:
for
space_index
in
spaces
:
parts
=
[
_single_power_analyze
(
field
=
part
,
parts
=
[
_single_power_analyze
(
field
=
part
,
idx
=
space_index
,
idx
=
space_index
,
...
...
Philipp Arras
@parras
mentioned in issue
#209 (closed)
·
Feb 06, 2018
mentioned in issue
#209 (closed)
mentioned in issue #209
Toggle commit list
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