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
13
Merge Requests
13
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
f9c22026
Commit
f9c22026
authored
Aug 16, 2018
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup SlopeOperator interface
parent
412b149a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
20 deletions
+10
-20
nifty5/library/amplitude_model.py
nifty5/library/amplitude_model.py
+4
-6
nifty5/operators/qht_operator.py
nifty5/operators/qht_operator.py
+1
-2
nifty5/operators/slope_operator.py
nifty5/operators/slope_operator.py
+4
-10
test/test_operators/test_adjoint.py
test/test_operators/test_adjoint.py
+1
-2
No files found.
nifty5/library/amplitude_model.py
View file @
f9c22026
...
...
@@ -106,23 +106,21 @@ class AmplitudeModel(Operator):
from
..operators.symmetrizing_operator
import
SymmetrizingOperator
h_space
=
s_space
.
get_default_codomain
()
p_space
=
PowerSpace
(
h_space
)
self
.
_exp_transform
=
ExpTransform
(
p_space
,
Npixdof
)
self
.
_exp_transform
=
ExpTransform
(
PowerSpace
(
h_space
),
Npixdof
)
logk_space
=
self
.
_exp_transform
.
domain
[
0
]
qht
=
QHTOperator
(
target
=
logk_space
)
dof_space
=
qht
.
domain
[
0
]
param_space
=
UnstructuredDomain
(
2
)
sym
=
SymmetrizingOperator
(
logk_space
)
phi_mean
=
np
.
array
([
sm
,
im
])
phi_sig
=
np
.
array
([
sv
,
iv
])
self
.
_slope
=
SlopeOperator
(
param_space
,
logk_space
,
phi_sig
)
self
.
_norm_phi_mean
=
Field
.
from_global_data
(
param_space
,
self
.
_slope
=
SlopeOperator
(
logk_space
,
phi_sig
)
self
.
_norm_phi_mean
=
Field
.
from_global_data
(
self
.
_slope
.
domain
,
phi_mean
/
phi_sig
)
self
.
_domain
=
MultiDomain
.
make
({
keys
[
0
]:
dof_space
,
keys
[
1
]:
param_space
})
keys
[
1
]:
self
.
_slope
.
domain
})
self
.
_target
=
self
.
_exp_transform
.
target
kern
=
lambda
k
:
_ceps_kernel
(
dof_space
,
k
,
ceps_a
,
ceps_k
)
...
...
nifty5/operators/qht_operator.py
View file @
f9c22026
...
...
@@ -52,8 +52,7 @@ class QHTOperator(LinearOperator):
raise
ValueError
(
"target[space] has to be a LogRGSpace!"
)
if
self
.
_target
[
self
.
_space
].
harmonic
:
raise
TypeError
(
"target[space] must be a nonharmonic space"
)
raise
TypeError
(
"target[space] must be a nonharmonic space"
)
self
.
_domain
=
[
dom
for
dom
in
self
.
_target
]
self
.
_domain
[
self
.
_space
]
=
\
...
...
nifty5/operators/slope_operator.py
View file @
f9c22026
...
...
@@ -34,31 +34,25 @@ class SlopeOperator(LinearOperator):
This operator creates a field on a LogRGSpace, which is created
according to a slope of given entries, (mean, y-intercept).
The slope mean is the powerlaw of the field in normal-space.
The slope mean is the power
law of the field in normal-space.
Parameters
----------
domain : domain or DomainTuple, shape=(2,)
It has to be an
d
UnstructuredDomain.
It has to be an UnstructuredDomain.
The domain of the slope mean and the y-intercept mean.
target : domain or DomainTuple
The output domain has to a LogRGSpace
sigmas : np.array, shape=(2,)
The slope variance and the y-intercept variance.
"""
def
__init__
(
self
,
domain
,
target
,
sigmas
):
def
__init__
(
self
,
target
,
sigmas
):
if
not
isinstance
(
target
,
LogRGSpace
):
raise
TypeError
if
not
(
isinstance
(
domain
,
UnstructuredDomain
)
and
domain
.
shape
==
(
2
,)):
raise
TypeError
self
.
_domain
=
DomainTuple
.
make
(
domain
)
self
.
_domain
=
DomainTuple
.
make
(
UnstructuredDomain
((
2
,)))
self
.
_target
=
DomainTuple
.
make
(
target
)
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
if
self
.
domain
[
0
].
shape
!=
(
len
(
self
.
target
[
0
].
shape
)
+
1
,):
raise
AssertionError
(
"Shape mismatch!"
)
self
.
_sigmas
=
sigmas
self
.
ndim
=
len
(
self
.
target
[
0
].
shape
)
self
.
pos
=
np
.
zeros
((
self
.
ndim
,)
+
self
.
target
[
0
].
shape
)
...
...
test/test_operators/test_adjoint.py
View file @
f9c22026
...
...
@@ -74,8 +74,7 @@ class Consistency_Tests(unittest.TestCase):
tmp
=
ift
.
ExpTransform
(
ift
.
PowerSpace
(
args
[
0
]),
args
[
1
],
args
[
2
])
tgt
=
tmp
.
domain
[
0
]
sig
=
np
.
array
([
0.3
,
0.13
])
dom
=
ift
.
UnstructuredDomain
(
2
)
op
=
ift
.
SlopeOperator
(
dom
,
tgt
,
sig
)
op
=
ift
.
SlopeOperator
(
tgt
,
sig
)
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
@
expand
(
product
(
_h_spaces
+
_p_spaces
+
_pow_spaces
,
...
...
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