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
10
Merge Requests
10
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
f07a6090
Commit
f07a6090
authored
Feb 21, 2018
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
92e7fe7d
Pipeline
#25252
passed with stages
in 11 minutes and 2 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
5 additions
and
83 deletions
+5
-83
nifty4/domains/domain.py
nifty4/domains/domain.py
+0
-1
nifty4/domains/lm_space.py
nifty4/domains/lm_space.py
+0
-1
nifty4/minimization/conjugate_gradient.py
nifty4/minimization/conjugate_gradient.py
+0
-1
nifty4/operators/diagonal_operator.py
nifty4/operators/diagonal_operator.py
+1
-1
nifty4/operators/geometry_remover.py
nifty4/operators/geometry_remover.py
+0
-1
nifty4/sugar.py
nifty4/sugar.py
+3
-77
test/test_operators/test_laplace_operator.py
test/test_operators/test_laplace_operator.py
+1
-1
No files found.
nifty4/domains/domain.py
View file @
f07a6090
...
...
@@ -18,7 +18,6 @@
import
abc
from
..utilities
import
NiftyMetaBase
import
numpy
as
np
class
Domain
(
NiftyMetaBase
()):
...
...
nifty4/domains/lm_space.py
View file @
f07a6090
...
...
@@ -20,7 +20,6 @@ from __future__ import division
import
numpy
as
np
from
.structured_domain
import
StructuredDomain
from
..field
import
Field
,
exp
from
..
import
dobj
class
LMSpace
(
StructuredDomain
):
...
...
nifty4/minimization/conjugate_gradient.py
View file @
f07a6090
...
...
@@ -18,7 +18,6 @@
from
__future__
import
division
from
.minimizer
import
Minimizer
from
..field
import
Field
from
..
import
dobj
...
...
nifty4/operators/diagonal_operator.py
View file @
f07a6090
...
...
@@ -18,7 +18,7 @@
from
__future__
import
division
import
numpy
as
np
from
..field
import
Field
,
sqrt
from
..field
import
Field
from
..domain_tuple
import
DomainTuple
from
.endomorphic_operator
import
EndomorphicOperator
from
..
import
utilities
...
...
nifty4/operators/geometry_remover.py
View file @
f07a6090
...
...
@@ -16,7 +16,6 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from
..field
import
Field
from
..domains.unstructured_domain
import
UnstructuredDomain
from
..domain_tuple
import
DomainTuple
from
.linear_operator
import
LinearOperator
...
...
nifty4/sugar.py
View file @
f07a6090
...
...
@@ -17,18 +17,15 @@
# and financially supported by the Studienstiftung des deutschen Volkes.
import
numpy
as
np
from
.domains.structured_domain
import
StructuredDomain
from
.domains.power_space
import
PowerSpace
from
.field
import
Field
,
sqrt
from
.field
import
Field
from
.operators.diagonal_operator
import
DiagonalOperator
from
.operators.power_distributor
import
PowerDistributor
from
.operators.harmonic_transform_operator
import
HarmonicTransformOperator
from
.domain_tuple
import
DomainTuple
from
.
import
dobj
,
utilities
__all__
=
[
'PS_field'
,
'power_analyze'
,
'create_power_field'
,
'create_power_operator'
,
'create_harmonic_smoothing_operator'
]
...
...
@@ -117,78 +114,7 @@ def power_analyze(field, spaces=None, binbounds=None,
return
parts
[
0
]
+
1j
*
parts
[
1
]
if
keep_phase_information
else
parts
[
0
]
def
_power_synthesize_nonrandom
(
field
,
spaces
=
None
):
spaces
=
utilities
.
parse_spaces
(
spaces
,
len
(
field
.
domain
))
result_domain
=
list
(
field
.
domain
)
amplitude
=
sqrt
(
field
)
for
i
in
spaces
:
result_domain
[
i
]
=
field
.
domain
[
i
].
harmonic_partner
pd
=
PowerDistributor
(
result_domain
,
field
.
domain
[
i
],
i
)
amplitude
=
pd
(
amplitude
)
return
amplitude
def
_power_synthesize
(
field
,
spaces
=
None
,
real_power
=
True
,
real_signal
=
True
):
"""Returns a sampled field with `field` as its power spectrum.
This method draws a Gaussian random field in the harmonic partner
domain of this field's domains, using this field as power spectrum.
Parameters
----------
field : Field
The input field containing the power spectrum
spaces : None, int, or tuple of int, optional
Specifies the subdomains containing all the PowerSpaces which
should be converted (default : None).
if spaces is None : Tries to convert the whole domain.
real_power : bool, optional
Determines whether the power spectrum is treated as intrinsically
real or complex (default : True).
real_signal : bool, optional
True will result in a purely real signal-space field
(default : True).
Returns
-------
Field
The output object. A random field created with the power spectrum
stored in the `spaces` in `field`.
Notes
-----
For this the spaces specified by `spaces` must be of type PowerSpace.
This expects this field to be a power spectrum, i.e.
to have the unit of "field to be sampled"**2.
Raises
------
ValueError : If a domain specified by `spaces` is not a PowerSpace.
"""
spec
=
_power_synthesize_nonrandom
(
field
,
spaces
)
self_real
=
not
np
.
issubdtype
(
spec
.
dtype
,
np
.
complexfloating
)
if
(
not
real_power
)
and
self_real
:
raise
ValueError
(
"can't draw complex realizations from real spectrum"
)
# create random samples: one or two, depending on whether the
# power spectrum is real or complex
result
=
[
field
.
from_random
(
'normal'
,
mean
=
0.
,
std
=
1.
,
domain
=
spec
.
domain
,
dtype
=
np
.
float64
if
real_signal
else
np
.
complex128
)
for
x
in
range
(
1
if
real_power
else
2
)]
result
[
0
]
*=
spec
if
self_real
else
spec
.
real
if
not
real_power
:
result
[
1
]
*=
spec
.
imag
return
result
[
0
]
if
real_power
else
result
[
0
]
+
1j
*
result
[
1
]
def
create_power_field
(
domain
,
power_spectrum
):
def
_create_power_field
(
domain
,
power_spectrum
):
if
not
callable
(
power_spectrum
):
# we have a Field living on a PowerSpace
if
not
isinstance
(
power_spectrum
,
Field
):
raise
TypeError
(
"Field object expected"
)
...
...
@@ -227,7 +153,7 @@ def create_power_operator(domain, power_spectrum, space=None):
domain
=
DomainTuple
.
make
(
domain
)
space
=
utilities
.
infer_space
(
domain
,
space
)
return
DiagonalOperator
(
create_power_field
(
domain
[
space
],
power_spectrum
),
_
create_power_field
(
domain
[
space
],
power_spectrum
),
domain
=
domain
,
spaces
=
space
)
...
...
test/test_operators/test_laplace_operator.py
View file @
f07a6090
...
...
@@ -35,7 +35,7 @@ class LaplaceOperatorTests(unittest.TestCase):
assert_allclose
(
L
(
fp
).
vdot
(
L
(
fp
)),
L
.
adjoint_times
(
L
(
fp
)).
vdot
(
fp
))
@
expand
(
product
([
10
,
100
,
1000
]))
def
test_Laplace
(
self
,
sz
):
def
test_Laplace
2
(
self
,
sz
):
s
=
ift
.
RGSpace
(
sz
,
harmonic
=
True
,
distances
=
0.764
)
bb
=
ift
.
PowerSpace
.
useful_binbounds
(
s
,
logarithmic
=
False
)
p
=
ift
.
PowerSpace
(
s
,
binbounds
=
bb
)
...
...
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