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
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
ift
NIFTy
Commits
148e6fbc
Commit
148e6fbc
authored
Jul 15, 2015
by
Ultima
Browse files
Started rework of operators. operator finished. diagonal_operator started.
parent
df30d59c
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
nifty_core.py
View file @
148e6fbc
...
...
@@ -1728,6 +1728,11 @@ class point_space(space):
"""
raise
AttributeError
(
about
.
_errors
.
cstring
(
"ERROR: power spectra ill-defined for (unstructured) point space."
))
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
calc_real_Q
(
self
,
x
):
return
np
.
all
(
np
.
isreal
(
x
))
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
get_plot
(
self
,
x
,
title
=
""
,
vmin
=
None
,
vmax
=
None
,
unit
=
""
,
norm
=
None
,
other
=
None
,
legend
=
False
,
**
kwargs
):
...
...
nifty_mpi_data.py
View file @
148e6fbc
...
...
@@ -23,8 +23,9 @@
##initialize the 'found-packages'-dictionary
found
=
{}
found
=
{}
import
numpy
as
np
from
nifty_about
import
about
...
...
@@ -49,8 +50,6 @@ except(ImportError):
found
[
'h5py'
]
=
False
found
[
'h5py_parallel'
]
=
False
class
distributed_data_object
(
object
):
"""
...
...
@@ -217,7 +216,7 @@ class distributed_data_object(object):
return
False
## Case 4: 'other' is something different
## -> make a numpy casting and make a recursi
on
## -> make a numpy casting and make a recursi
ve call
else
:
temp_other
=
np
.
array
(
other
)
return
self
.
__eq__
(
temp_other
)
...
...
@@ -543,10 +542,22 @@ class distributed_data_object(object):
return
temp_d2o
def
is_completely_real
(
self
):
local_realiness
=
np
.
all
(
self
.
isreal
())
local_realiness
=
np
.
all
(
self
.
isreal
()
.
get_local_data
()
)
global_realiness
=
self
.
distributor
.
_allgather
(
local_realiness
)
return
np
.
all
(
global_realiness
)
def
all
(
self
):
local_all
=
np
.
all
(
self
.
get_local_data
())
global_all
=
self
.
distributor
.
_allgather
(
local_all
)
return
np
.
all
(
global_all
)
def
any
(
self
):
local_any
=
np
.
any
(
self
.
get_local_data
())
global_any
=
self
.
distributor
.
_allgather
(
local_any
)
return
np
.
all
(
global_any
)
def
set_local_data
(
self
,
data
,
hermitian
=
False
,
copy
=
False
):
"""
Stores data directly in the local data attribute. No distribution
...
...
@@ -1464,10 +1475,12 @@ class _not_distributor(object):
return
np
.
array
(
data
).
astype
(
self
.
dtype
,
copy
=
False
).
\
reshape
(
self
.
global_shape
)
def
disperse_data
(
self
,
data
,
data_update
,
key
,
**
kwargs
):
data
[
key
]
=
np
.
array
(
data_update
,
copy
=
False
).
astype
(
self
.
dtype
)
def
disperse_data
(
self
,
data
,
to_slices
,
data_update
,
from_slices
=
None
,
**
kwargs
):
data
[
to_slices
]
=
np
.
array
(
data_update
[
from_slices
],
copy
=
False
).
astype
(
self
.
dtype
)
def
collect_data
(
self
,
data
,
slice_objects
,
**
kwargs
):
def
collect_data
(
self
,
data
,
slice_objects
,
**
kwargs
):
return
data
[
slice_objects
]
def
consolidate_data
(
self
,
data
,
**
kwargs
):
...
...
operators/nifty_operators.py
View file @
148e6fbc
This diff is collapsed.
Click to expand it.
rg/nifty_rg.py
View file @
148e6fbc
...
...
@@ -1162,12 +1162,10 @@ class rg_space(point_space):
Weighted array.
"""
#x = self.cast(x)
if
isinstance
(
x
,
distributed_data_object
):
is_hermitianQ
=
x
.
hermitian
## weight
x
=
x
*
self
.
get_weight
(
power
=
power
)
if
isinstance
(
x
,
distributed_data_object
):
x
.
hermitian
=
is_hermitianQ
return
x
def
get_weight
(
self
,
power
=
1
):
...
...
@@ -1452,6 +1450,12 @@ class rg_space(point_space):
power_spectrum
/=
rho
return
power_spectrum
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
calc_real_Q
(
self
,
x
):
try
:
return
x
.
is_completely_real
()
except
(
AttributeError
):
return
np
.
all
(
np
.
isreal
(
x
))
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...
...
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