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
53d42bea
Commit
53d42bea
authored
Jan 14, 2019
by
Philipp Arras
Browse files
Docs
parent
78464494
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/regridding_operator.py
View file @
53d42bea
...
...
@@ -26,6 +26,19 @@ from .linear_operator import LinearOperator
class
RegriddingOperator
(
LinearOperator
):
'''Interpolates a RGSpace to an RGSpace with coarser resolution linearly.
Parameters
----------
domain : Domain, DomainTuple or tuple of Domain
domain[space] needs to be an :class:`RGSpace`.
new_shape : tuple of int
Shape of the space which domain[space] is replaced by. Each entry must
be smaller or equal to the respective entry in `domain[space].shape`.
space : int
Index of space in `domain` on which the operator shall act.
Default is 0.
'''
def
__init__
(
self
,
domain
,
new_shape
,
space
=
0
):
self
.
_domain
=
DomainTuple
.
make
(
domain
)
self
.
_space
=
infer_space
(
self
.
_domain
,
space
)
...
...
@@ -38,6 +51,8 @@ class RegriddingOperator(LinearOperator):
raise
ValueError
(
"Shape mismatch"
)
if
any
([
a
>
b
for
a
,
b
in
zip
(
new_shape
,
dom
.
shape
)]):
raise
ValueError
(
"New shape must not be larger than old shape"
)
if
any
([
ii
<=
0
for
ii
in
new_shape
]):
raise
ValueError
(
'New shape must not be zero or negative.'
)
newdist
=
tuple
(
dom
.
distances
[
i
]
*
dom
.
shape
[
i
]
/
new_shape
[
i
]
for
i
in
range
(
len
(
dom
.
shape
)))
...
...
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