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
f389aa57
Commit
f389aa57
authored
Mar 01, 2017
by
Theo Steininger
Browse files
Fixed a dtype bug in GFFT
parent
c3989d90
Pipeline
#10517
failed with stages
in 29 minutes and 36 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/field.py
View file @
f389aa57
...
...
@@ -151,11 +151,11 @@ class Field(Loggable, Versionable, object):
def
power_analyze
(
self
,
spaces
=
None
,
log
=
False
,
nbin
=
None
,
binbounds
=
None
,
real_signal
=
True
):
#
assert that
all spaces in `self.domain` are either harmonic or
#
check if
all spaces in `self.domain` are either harmonic or
# power_space instances
for
sp
in
self
.
domain
:
if
not
sp
.
harmonic
and
not
isinstance
(
sp
,
PowerSpace
):
raise
AttributeError
(
self
.
logger
.
info
(
"Field has a space in `domain` which is neither "
"harmonic nor a PowerSpace."
)
...
...
@@ -288,11 +288,11 @@ class Field(Loggable, Versionable, object):
def
power_synthesize
(
self
,
spaces
=
None
,
real_signal
=
True
,
mean
=
None
,
std
=
None
):
#
assert that
all spaces in `self.domain` are either of signal-type or
#
check if
all spaces in `self.domain` are either of signal-type or
# power_space instances
for
sp
in
self
.
domain
:
if
not
sp
.
harmonic
and
not
isinstance
(
sp
,
PowerSpace
):
raise
AttributeError
(
self
.
logger
.
info
(
"Field has a space in `domain` which is neither "
"harmonic nor a PowerSpace."
)
...
...
@@ -352,11 +352,7 @@ class Field(Loggable, Versionable, object):
preserve_gaussian_variance
=
True
)[
0
]
for
x
in
result_list
]
else
:
# # if the synthesized field is complex in signal space,
# # one must correct the variance here, since one draws
# # sqrt(twice) the power via real- and imaginary-part
# result_val_list = [x.val*np.sqrt(0.5) for x in result_list]
result_val_list
=
[
x
.
val
for
x
in
result_list
]
result_val_list
=
[
x
.
val
for
x
in
result_list
]
# weight the random fields with the power spectrum
# therefore get the pindex from the power space
...
...
nifty/operators/fft_operator/transformations/rg_transforms.py
View file @
f389aa57
...
...
@@ -592,6 +592,7 @@ class GFFT(Transform):
# Array for storing the result
return_val
=
None
result_dtype
=
np
.
result_type
(
np
.
complex
,
self
.
codomain
.
dtype
)
for
slice_list
in
utilities
.
get_slice_list
(
temp_inp
.
shape
,
axes
):
...
...
@@ -601,7 +602,7 @@ class GFFT(Transform):
else
:
# initialize the return_val object if needed
if
return_val
is
None
:
return_val
=
np
.
empty_like
(
temp_inp
)
return_val
=
np
.
empty_like
(
temp_inp
,
dtype
=
result_dtype
)
inp
=
temp_inp
[
slice_list
]
inp
=
self
.
fft_machine
.
gfft
(
...
...
@@ -622,12 +623,11 @@ class GFFT(Transform):
else
:
return_val
[
slice_list
]
=
inp
result_dtype
=
np
.
result_type
(
np
.
complex
,
self
.
codomain
.
dtype
)
if
isinstance
(
val
,
distributed_data_object
):
new_val
=
val
.
copy_empty
(
dtype
=
result_dtype
)
new_val
.
set_full_data
(
return_val
,
copy
=
False
)
return_val
=
new_val
else
:
return_val
=
return_val
.
astype
(
result_type
,
copy
=
False
)
return_val
=
return_val
.
astype
(
result_
d
type
,
copy
=
False
)
return
return_val
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