Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
23c5f455
Commit
23c5f455
authored
Jun 01, 2017
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PEP8 and test tweaking
parent
339398ad
Pipeline
#13205
passed with stage
in 5 minutes and 15 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
36 deletions
+56
-36
nifty/config/nifty_config.py
nifty/config/nifty_config.py
+3
-2
nifty/operators/fft_operator/transformations/rg_transforms.py
...y/operators/fft_operator/transformations/rg_transforms.py
+4
-2
test/test_operators/test_fft_operator.py
test/test_operators/test_fft_operator.py
+1
-1
test/test_spaces/test_power_space.py
test/test_spaces/test_power_space.py
+48
-31
No files found.
nifty/config/nifty_config.py
View file @
23c5f455
...
...
@@ -31,8 +31,9 @@ dependency_injector = keepers.DependencyInjector(
'pyHealpix'
,
'plotly'
])
dependency_injector
.
register
((
'pyfftw'
,
'fftw_mpi'
),
lambda
z
:
hasattr
(
z
,
'FFTW_MPI'
))
dependency_injector
.
register
((
'pyfftw'
,
'fftw_scalar'
))
dependency_injector
.
register
((
'pyfftw'
,
'fftw_mpi'
),
lambda
z
:
hasattr
(
z
,
'FFTW_MPI'
))
dependency_injector
.
register
((
'pyfftw'
,
'fftw_scalar'
))
# Initialize the variables
variable_fft_module
=
keepers
.
Variable
(
...
...
nifty/operators/fft_operator/transformations/rg_transforms.py
View file @
23c5f455
...
...
@@ -634,9 +634,11 @@ class ScalarFFT(Transform):
# perform the transformation
if
fftw_scalar
is
not
None
:
if
self
.
codomain
.
harmonic
:
result_val
=
fftw_scalar
.
interfaces
.
numpy_fft
.
fftn
(
local_val
,
axes
=
axes
)
result_val
=
fftw_scalar
.
interfaces
.
numpy_fft
.
fftn
(
local_val
,
axes
=
axes
)
else
:
result_val
=
fftw_scalar
.
interfaces
.
numpy_fft
.
ifftn
(
local_val
,
axes
=
axes
)
result_val
=
fftw_scalar
.
interfaces
.
numpy_fft
.
ifftn
(
local_val
,
axes
=
axes
)
else
:
if
self
.
codomain
.
harmonic
:
result_val
=
np
.
fft
.
fftn
(
local_val
,
axes
=
axes
)
...
...
test/test_operators/test_fft_operator.py
View file @
23c5f455
...
...
@@ -62,7 +62,7 @@ class FFTOperatorTests(unittest.TestCase):
res
=
foo
.
get_distance_array
(
'not'
)
assert_equal
(
res
[
zc1
*
(
dim1
//
2
),
zc2
*
(
dim2
//
2
)],
0.
)
@
expand
(
product
([
"scalar"
,
"mpi"
],
[
10
,
11
],
[
False
,
True
],
[
False
,
True
],
@
expand
(
product
([
"scalar"
,
"mpi"
],
[
10
,
11
],
[
False
,
True
],
[
False
,
True
],
[
0.1
,
1
,
3.7
],
[
np
.
float64
,
np
.
complex128
,
np
.
float32
,
np
.
complex64
]))
def
test_fft1D
(
self
,
module
,
dim1
,
zc1
,
zc2
,
d
,
itp
):
...
...
test/test_spaces/test_power_space.py
View file @
23c5f455
...
...
@@ -28,30 +28,34 @@ from nifty import PowerSpace, RGSpace, Space, LMSpace
from
types
import
NoneType
from
test.common
import
expand
from
itertools
import
product
,
chain
#needed to check wether fftw is available
#
needed to check wether fftw is available
from
d2o.config
import
dependency_injector
as
gdi
from
nose.plugins.skip
import
SkipTest
HARMONIC_SPACES
=
[
RGSpace
((
8
,),
harmonic
=
True
),
RGSpace
((
7
,),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
8
,),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
7
,
8
),
harmonic
=
True
),
RGSpace
((
7
,
8
),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
6
,
6
),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
7
,
5
),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
5
,
5
),
harmonic
=
True
),
RGSpace
((
4
,
5
,
7
),
harmonic
=
True
),
RGSpace
((
4
,
5
,
7
),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
7
,),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
8
,),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
7
,
8
),
harmonic
=
True
),
RGSpace
((
7
,
8
),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
6
,
6
),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
7
,
5
),
harmonic
=
True
,
zerocenter
=
True
),
RGSpace
((
5
,
5
),
harmonic
=
True
),
RGSpace
((
4
,
5
,
7
),
harmonic
=
True
),
RGSpace
((
4
,
5
,
7
),
harmonic
=
True
,
zerocenter
=
True
),
LMSpace
(
6
),
LMSpace
(
9
)]
#Try all sensible kinds of combinations of spaces, distributuion strategy and
#binning parameters
_maybe_fftw
=
[
"fftw"
]
if
(
'fftw_mpi'
in
gdi
)
else
[]
CONSISTENCY_CONFIGS_IMPLICIT
=
product
(
HARMONIC_SPACES
,
[
"not"
,
"equal"
]
+
_maybe_fftw
,
[
None
],
[
None
,
3
,
4
],
[
True
,
False
])
CONSISTENCY_CONFIGS_EXPLICIT
=
product
(
HARMONIC_SPACES
,
[
"not"
,
"equal"
]
+
_maybe_fftw
,
[[
0.
,
1.3
]],[
None
],[
False
])
CONSISTENCY_CONFIGS
=
chain
(
CONSISTENCY_CONFIGS_IMPLICIT
,
CONSISTENCY_CONFIGS_EXPLICIT
)
# Try all sensible kinds of combinations of spaces, distributuion strategy and
# binning parameters
CONSISTENCY_CONFIGS_IMPLICIT
=
product
(
HARMONIC_SPACES
,
[
"not"
,
"equal"
,
"fftw"
],
[
None
],
[
None
,
3
,
4
],
[
True
,
False
])
CONSISTENCY_CONFIGS_EXPLICIT
=
product
(
HARMONIC_SPACES
,
[
"not"
,
"equal"
,
"fftw"
],
[[
0.
,
1.3
]],
[
None
],
[
False
])
CONSISTENCY_CONFIGS
=
chain
(
CONSISTENCY_CONFIGS_IMPLICIT
,
CONSISTENCY_CONFIGS_EXPLICIT
)
# [harmonic_partner, distribution_strategy,
# logarithmic, nbin, binbounds, expected]
...
...
@@ -128,27 +132,40 @@ class PowerSpaceInterfaceTest(unittest.TestCase):
p
=
PowerSpace
(
r
)
assert_
(
isinstance
(
getattr
(
p
,
attribute
),
expected_type
))
class
PowerSpaceConsistencyCheck
(
unittest
.
TestCase
):
@
expand
(
CONSISTENCY_CONFIGS
)
def
test_pipundexInversion
(
self
,
harmonic_partner
,
distribution_strategy
,
binbounds
,
nbin
,
logarithmic
):
binbounds
,
nbin
,
logarithmic
):
if
distribution_strategy
==
"fftw"
and
"fftw_mpi"
not
in
gdi
:
raise
SkipTest
p
=
PowerSpace
(
harmonic_partner
=
harmonic_partner
,
distribution_strategy
=
distribution_strategy
,
logarithmic
=
logarithmic
,
nbin
=
nbin
,
binbounds
=
binbounds
)
assert_equal
(
p
.
pindex
.
flatten
()[
p
.
pundex
],
np
.
arange
(
p
.
dim
),
assert_equal
(
p
.
pindex
.
flatten
()[
p
.
pundex
],
np
.
arange
(
p
.
dim
),
err_msg
=
'pundex is not right-inverse of pindex!'
)
@
expand
(
CONSISTENCY_CONFIGS
)
def
test_rhopindexConsistency
(
self
,
harmonic_partner
,
distribution_strategy
,
binbounds
,
nbin
,
logarithmic
):
def
test_rhopindexConsistency
(
self
,
harmonic_partner
,
distribution_strategy
,
binbounds
,
nbin
,
logarithmic
):
if
distribution_strategy
==
"fftw"
and
"fftw_mpi"
not
in
gdi
:
raise
SkipTest
p
=
PowerSpace
(
harmonic_partner
=
harmonic_partner
,
distribution_strategy
=
distribution_strategy
,
logarithmic
=
logarithmic
,
nbin
=
nbin
,
binbounds
=
binbounds
)
assert_equal
(
p
.
pindex
.
flatten
().
bincount
(),
p
.
rho
,
err_msg
=
'rho is not equal to pindex degeneracy'
)
class
PowerSpaceFunctionalityTest
(
unittest
.
TestCase
):
@
expand
(
CONS
ISTENCY
_CONFIGS
)
@
expand
(
CONS
TRUCTOR
_CONFIGS
)
def
test_constructor
(
self
,
harmonic_partner
,
distribution_strategy
,
logarithmic
,
nbin
,
binbounds
,
expected
):
if
distribution_strategy
==
"fftw"
and
"fftw_mpi"
not
in
gdi
:
raise
SkipTest
if
'error'
in
expected
:
with
assert_raises
(
expected
[
'error'
]):
PowerSpace
(
harmonic_partner
=
harmonic_partner
,
...
...
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