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
1d0e22b7
Commit
1d0e22b7
authored
Sep 19, 2017
by
Martin Reinecke
Browse files
minor tweaks
parent
7c821ad1
Changes
3
Hide whitespace changes
Inline
Side-by-side
nifty2go/field.py
View file @
1d0e22b7
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
# and financially supported by the Studienstiftung des deutschen Volkes.
from
__future__
import
division
from
__future__
import
division
,
print_function
from
builtins
import
range
from
builtins
import
range
import
numpy
as
np
import
numpy
as
np
from
.spaces.power_space
import
PowerSpace
from
.spaces.power_space
import
PowerSpace
...
@@ -195,8 +195,8 @@ class Field(object):
...
@@ -195,8 +195,8 @@ class Field(object):
# power_space instances
# power_space instances
for
sp
in
self
.
domain
:
for
sp
in
self
.
domain
:
if
not
sp
.
harmonic
and
not
isinstance
(
sp
,
PowerSpace
):
if
not
sp
.
harmonic
and
not
isinstance
(
sp
,
PowerSpace
):
raise
TypeError
(
"
Field has a space in `domain` which is "
print
(
"WARNING:
Field has a space in `domain` which is "
"neither harmonic nor a PowerSpace."
)
"neither harmonic nor a PowerSpace."
)
# check if the `spaces` input is valid
# check if the `spaces` input is valid
if
spaces
is
None
:
if
spaces
is
None
:
...
...
nifty2go/nifty_utilities.py
View file @
1d0e22b7
...
@@ -48,7 +48,7 @@ def get_slice_list(shape, axes):
...
@@ -48,7 +48,7 @@ def get_slice_list(shape, axes):
If axes(axis) does not match shape.
If axes(axis) does not match shape.
"""
"""
if
not
shape
:
if
shap
e
is
Non
e
:
raise
ValueError
(
"shape cannot be None."
)
raise
ValueError
(
"shape cannot be None."
)
if
axes
:
if
axes
:
...
...
nifty2go/operators/fft_operator/fft_operator_support.py
View file @
1d0e22b7
...
@@ -60,6 +60,17 @@ class RGRGTransformation(Transformation):
...
@@ -60,6 +60,17 @@ class RGRGTransformation(Transformation):
axes2
=
axes
[:
i
]
+
axes
[
i
+
1
:]
axes2
=
axes
[:
i
]
+
axes
[
i
+
1
:]
RGRGTransformation
.
_fill_upper_half
(
tmp
[
dim1
],
res
[
dim1
],
axes2
)
RGRGTransformation
.
_fill_upper_half
(
tmp
[
dim1
],
res
[
dim1
],
axes2
)
@
staticmethod
def
_fill_array
(
tmp
,
res
,
axes
):
if
axes
is
None
:
axes
=
range
(
a
.
ndim
)
lastaxis
=
axes
[
-
1
]
ntmplast
=
tmp
.
shape
[
lastaxis
]
slice1
=
[
slice
(
None
)]
*
lastaxis
+
[
slice
(
0
,
ntmplast
)]
np
.
add
(
tmp
.
real
,
tmp
.
imag
,
out
=
res
[
slice1
])
RGRGTransformation
.
_fill_upper_half
(
tmp
,
res
,
axes
)
return
res
@
staticmethod
@
staticmethod
def
_hartley
(
a
,
axes
=
None
):
def
_hartley
(
a
,
axes
=
None
):
# Check if the axes provided are valid given the shape
# Check if the axes provided are valid given the shape
...
@@ -71,15 +82,7 @@ class RGRGTransformation(Transformation):
...
@@ -71,15 +82,7 @@ class RGRGTransformation(Transformation):
if
issubclass
(
a
.
dtype
.
type
,
np
.
complexfloating
):
if
issubclass
(
a
.
dtype
.
type
,
np
.
complexfloating
):
raise
TypeError
(
"Hartley tansform requires real-valued arrays."
)
raise
TypeError
(
"Hartley tansform requires real-valued arrays."
)
tmp
=
rfftn
(
a
,
axes
=
axes
)
tmp
=
rfftn
(
a
,
axes
=
axes
)
res
=
np
.
empty_like
(
a
)
return
RGRGTransformation
.
_fill_array
(
tmp
,
np
.
empty_like
(
a
),
axes
)
if
axes
is
None
:
axes
=
range
(
a
.
ndim
)
lastaxis
=
axes
[
-
1
]
ntmplast
=
tmp
.
shape
[
lastaxis
]
slice1
=
[
slice
(
None
)]
*
lastaxis
+
[
slice
(
0
,
ntmplast
)]
np
.
add
(
tmp
.
real
,
tmp
.
imag
,
out
=
res
[
slice1
])
RGRGTransformation
.
_fill_upper_half
(
tmp
,
res
,
axes
)
return
res
def
transform
(
self
,
val
,
axes
=
None
):
def
transform
(
self
,
val
,
axes
=
None
):
"""
"""
...
...
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