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
b5fd6a56
Commit
b5fd6a56
authored
Jul 03, 2018
by
Martin Reinecke
Browse files
Merge branch 'bugfix' into 'NIFTy_5'
bug fix See merge request ift/nifty-dev!32
parents
6c9b81c5
a33c01ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/library/point_sources.py
View file @
b5fd6a56
...
@@ -38,7 +38,8 @@ class PointSources(Model):
...
@@ -38,7 +38,8 @@ class PointSources(Model):
# FIXME
# FIXME
outer_inv
=
np
.
clip
(
outer_inv
,
1e-20
,
None
)
outer_inv
=
np
.
clip
(
outer_inv
,
1e-20
,
None
)
outer
=
1
/
outer_inv
outer
=
1
/
outer_inv
grad
=
Field
.
from_local_data
(
u
.
domain
,
inner
*
outer
)
grad
=
Field
.
from_local_data
(
self
.
position
[
'points'
].
domain
,
inner
*
outer
)
grad
=
makeOp
(
MultiField
({
'points'
:
grad
}))
grad
=
makeOp
(
MultiField
({
'points'
:
grad
}))
return
SelectionOperator
(
grad
.
target
,
'points'
)
*
grad
return
SelectionOperator
(
grad
.
target
,
'points'
)
*
grad
...
...
nifty5/operators/slope_operator.py
View file @
b5fd6a56
...
@@ -7,6 +7,8 @@ from .linear_operator import LinearOperator
...
@@ -7,6 +7,8 @@ from .linear_operator import LinearOperator
class
SlopeOperator
(
LinearOperator
):
class
SlopeOperator
(
LinearOperator
):
def
__init__
(
self
,
domain
,
target
,
sigmas
):
def
__init__
(
self
,
domain
,
target
,
sigmas
):
# MR FIXME: check explicitly for the required domain types etc.
# Maybe compute domain from target automatically?
self
.
_domain
=
DomainTuple
.
make
(
domain
)
self
.
_domain
=
DomainTuple
.
make
(
domain
)
self
.
_target
=
DomainTuple
.
make
(
target
)
self
.
_target
=
DomainTuple
.
make
(
target
)
...
@@ -24,7 +26,7 @@ class SlopeOperator(LinearOperator):
...
@@ -24,7 +26,7 @@ class SlopeOperator(LinearOperator):
for
i
in
range
(
self
.
ndim
):
for
i
in
range
(
self
.
ndim
):
rng
=
np
.
arange
(
target
.
shape
[
i
])
rng
=
np
.
arange
(
target
.
shape
[
i
])
tmp
=
np
.
minimum
(
tmp
=
np
.
minimum
(
rng
,
target
.
shape
[
i
]
+
1
-
rng
)
*
target
.
bindistances
[
i
]
rng
,
target
.
shape
[
i
]
+
1
-
rng
)
*
target
.
bindistances
[
i
]
self
.
pos
[
i
]
+=
tmp
.
reshape
(
self
.
pos
[
i
]
+=
tmp
.
reshape
(
(
1
,)
*
i
+
(
shape
[
i
],)
+
(
1
,)
*
(
self
.
ndim
-
i
-
1
))
(
1
,)
*
i
+
(
shape
[
i
],)
+
(
1
,)
*
(
self
.
ndim
-
i
-
1
))
...
...
Write
Preview
Supports
Markdown
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