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
b978003d
Commit
b978003d
authored
Sep 27, 2015
by
Ultima
Browse files
Modified .gitignore to not exclude everything except for optins.
parent
ed578dc2
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
b978003d
...
...
@@ -12,37 +12,3 @@
.spyderproject
.document
build
operators/*
!operators/__init__.py
!operators/nifty_explicit.py
!operators/nifty_operators.py
!operators/nifty_probing.py
!operators/nifty_probing_old.py
dummys/*
!dummys/__init__.py
!dummys/gfft_dummy.py
!dummys/MPI_dummy.py
rg/*
!rg/__init__.py
!rg/nifty_fft.py
!rg/nifty_rg.py
!rg/nifty_power_conversion_rg.py
lm/*
!lm/__init__.py
!lm/nifty_lm.py
!lm/nifty_power_conversion_lm.py
demos/*
!demos/__init__.py
!demos/demos_core.py
!demos/demo_faraday.py
!demos/demo_faraday_map.npy
!demos/demo_excaliwir.py
!demos/demo_wf1.py
!demos/demo_wf2.py
!demos/demo_wf3.py
\ No newline at end of file
operators/nifty_minimization.py
0 → 100644
View file @
b978003d
This diff is collapsed.
Click to expand it.
test/test_nifty_field.py
0 → 100644
View file @
b978003d
# -*- coding: utf-8 -*-
from
numpy.testing
import
assert_equal
,
\
assert_almost_equal
,
\
assert_raises
from
nose_parameterized
import
parameterized
import
unittest
import
itertools
import
numpy
as
np
from
nifty
import
space
,
\
point_space
,
\
rg_space
,
\
lm_space
,
\
hp_space
,
\
gl_space
,
\
field
from
nifty.nifty_core
import
POINT_DISTRIBUTION_STRATEGIES
from
nifty.rg.nifty_rg
import
RG_DISTRIBUTION_STRATEGIES
,
\
gc
as
RG_GC
from
nifty.lm.nifty_lm
import
LM_DISTRIBUTION_STRATEGIES
,
\
GL_DISTRIBUTION_STRATEGIES
,
\
HP_DISTRIBUTION_STRATEGIES
###############################################################################
def
custom_name_func
(
testcase_func
,
param_num
,
param
):
return
"%s_%s"
%
(
testcase_func
.
__name__
,
parameterized
.
to_safe_name
(
"_"
.
join
(
str
(
x
)
for
x
in
param
.
args
)),
)
###############################################################################
###############################################################################
all_point_datatypes
=
[
np
.
dtype
(
'bool'
),
np
.
dtype
(
'int16'
),
np
.
dtype
(
'int32'
),
np
.
dtype
(
'int64'
),
np
.
dtype
(
'float32'
),
np
.
dtype
(
'float64'
),
np
.
dtype
(
'complex64'
),
np
.
dtype
(
'complex128'
)]
all_lm_datatypes
=
[
np
.
dtype
(
'complex64'
),
np
.
dtype
(
'complex128'
)]
all_gl_datatypes
=
[
np
.
dtype
(
'float64'
),
np
.
dtype
(
'float128'
)]
all_hp_datatypes
=
[
np
.
dtype
(
'float64'
)]
###############################################################################
DATAMODELS
=
{}
DATAMODELS
[
'point_space'
]
=
[
'np'
]
+
POINT_DISTRIBUTION_STRATEGIES
DATAMODELS
[
'rg_space'
]
=
[
'np'
]
+
RG_DISTRIBUTION_STRATEGIES
DATAMODELS
[
'lm_space'
]
=
[
'np'
]
+
LM_DISTRIBUTION_STRATEGIES
DATAMODELS
[
'gl_space'
]
=
[
'np'
]
+
GL_DISTRIBUTION_STRATEGIES
DATAMODELS
[
'hp_space'
]
=
[
'np'
]
+
HP_DISTRIBUTION_STRATEGIES
###############################################################################
fft_modules
=
[]
for
name
in
[
'gfft'
,
'gfft_dummy'
,
'pyfftw'
]:
if
RG_GC
.
validQ
(
'fft_module'
,
name
):
fft_modules
+=
[
name
]
###############################################################################
point_like_spaces
=
[
'point_space'
,
'rg_space'
,
'lm_space'
,
'hp_space'
,
'gl_space'
]
###############################################################################
space_list
=
[]
# Add point_spaces
for
param
in
itertools
.
product
([
1
,
10
],
all_point_datatypes
,
DATAMODELS
[
'point_space'
]):
space_list
+=
[[
point_space
(
num
=
param
[
0
],
dtype
=
param
[
1
],
datamodel
=
param
[
2
])]]
# Add rg_spaces
for
param
in
itertools
.
product
([(
1
,),
(
4
,
6
),
(
5
,
8
)],
[
False
,
True
],
[
0
,
1
,
2
],
[
None
,
0.3
],
[
False
,
True
],
DATAMODELS
[
'rg_space'
],
fft_modules
):
space_list
+=
[[
rg_space
(
shape
=
param
[
0
],
zerocenter
=
param
[
1
],
complexity
=
param
[
2
],
distances
=
param
[
3
],
harmonic
=
param
[
4
],
datamodel
=
param
[
5
],
fft_module
=
param
[
6
])]]
###############################################################################
###############################################################################
class
Test_field_init
(
unittest
.
TestCase
):
@
parameterized
.
expand
(
space_list
)
def
test_successfull_init_and_attributes
(
self
,
s
):
s
=
s
[
0
]
f
=
field
(
s
)
assert
(
f
.
domain
is
s
)
assert
(
s
.
check_codomain
(
f
.
codomain
))
test/test_nifty_utilities.py
0 → 100644
View file @
b978003d
# -*- coding: utf-8 -*-
import
numpy
as
np
from
numpy.testing
import
assert_equal
,
\
assert_almost_equal
,
\
assert_raises
from
nose_parameterized
import
parameterized
import
unittest
from
nifty.nifty_utilities
import
hermitianize
,
\
_hermitianize_inverter
from
nifty.nifty_mpi_data
import
distributed_data_object
,
\
STRATEGIES
###############################################################################
def
custom_name_func
(
testcase_func
,
param_num
,
param
):
return
"%s_%s"
%
(
testcase_func
.
__name__
,
parameterized
.
to_safe_name
(
"_"
.
join
(
str
(
x
)
for
x
in
param
.
args
)),
)
###############################################################################
test_data
=
np
.
array
([[
-
10
,
9
,
10
,
2
,
-
7
,
-
8
],
[
-
5
,
5
,
5
,
-
1
,
9
,
3
],
[
-
2
,
-
2
,
8
,
9
,
9
,
-
10
],
[
-
8
,
-
5
,
-
2
,
-
10
,
-
7
,
7
],
[
10
,
6
,
-
2
,
6
,
-
3
,
-
1
],
[
8
,
1
,
10
,
-
7
,
6
,
-
6
]])
flipped_data
=
np
.
array
([[
-
10
,
-
8
,
-
7
,
2
,
10
,
9
],
[
8
,
-
6
,
6
,
-
7
,
10
,
1
],
[
10
,
-
1
,
-
3
,
6
,
-
2
,
6
],
[
-
8
,
7
,
-
7
,
-
10
,
-
2
,
-
5
],
[
-
2
,
-
10
,
9
,
9
,
8
,
-
2
],
[
-
5
,
3
,
9
,
-
1
,
5
,
5
]])
###############################################################################
###############################################################################
class
Test_hermitianize_inverter
(
unittest
.
TestCase
):
def
test_with_ndarray
(
self
):
assert_equal
(
_hermitianize_inverter
(
test_data
),
flipped_data
)
@
parameterized
.
expand
(
STRATEGIES
[
'global'
],
testcase_func_name
=
custom_name_func
)
def
test_with_d2o
(
self
,
distribution_strategy
):
d
=
distributed_data_object
(
test_data
,
distribution_strategy
=
distribution_strategy
)
assert_equal
(
_hermitianize_inverter
(
d
).
get_full_data
(),
flipped_data
)
\ No newline at end of file
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