Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neel Shah
NIFTy
Commits
69792e0f
Commit
69792e0f
authored
Jun 09, 2017
by
Theo Steininger
Browse files
Merge branch 'master' of gitlab.mpcdf.mpg.de:ift/NIFTy
parents
f8fcace5
ea96116b
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty/operators/smoothing_operator/direct_smoothing_operator.py
View file @
69792e0f
...
...
@@ -53,10 +53,13 @@ class DirectSmoothingOperator(SmoothingOperator):
wgt
=
[]
expfac
=
1.
/
(
2.
*
sigma
*
sigma
)
for
i
in
range
(
x
.
size
):
t
=
x
[
ibegin
[
i
]:
ibegin
[
i
]
+
nval
[
i
]]
-
x
[
i
]
t
=
np
.
exp
(
-
t
*
t
*
expfac
)
t
*=
1.
/
np
.
sum
(
t
)
wgt
.
append
(
t
)
if
nval
[
i
]
>
0
:
t
=
x
[
ibegin
[
i
]:
ibegin
[
i
]
+
nval
[
i
]]
-
x
[
i
]
t
=
np
.
exp
(
-
t
*
t
*
expfac
)
t
*=
1.
/
np
.
sum
(
t
)
wgt
.
append
(
t
)
else
:
wgt
.
append
(
np
.
array
([]))
return
ibegin
,
nval
,
wgt
...
...
@@ -146,7 +149,7 @@ class DirectSmoothingOperator(SmoothingOperator):
#MR FIXME: this causes calls of log(0.) which should probably be avoided
if
self
.
log_distances
:
np
.
log
(
distance_array
,
out
=
distance_array
)
np
.
log
(
np
.
maximum
(
distance_array
,
1e-15
),
out
=
distance_array
)
# collect the local data + ghost cells
local_data_Q
=
False
...
...
nifty/sugar.py
View file @
69792e0f
...
...
@@ -55,5 +55,5 @@ def create_power_operator(domain, power_spectrum, dtype=None,
fp
=
Field
(
power_domain
,
val
=
power_spectrum
,
dtype
=
dtype
,
distribution_strategy
=
distribution_strategy
)
f
=
fp
.
power_synthesize
(
mean
=
1
,
std
=
0
,
real_signal
=
False
)
f
**=
2
return
DiagonalOperator
(
domain
,
diagonal
=
f
,
bare
=
True
)
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