Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
aa2512f9
Commit
aa2512f9
authored
Nov 18, 2019
by
Philipp Haim
Browse files
Options
Downloads
Patches
Plain Diff
Fix zero mode in finalize
parent
5439f0a9
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!373
Correlated Field model for DomainTuple
,
!367
WIP: Normalized amplitudes pp
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
nifty5/library/correlated_fields.py
+2
-29
2 additions, 29 deletions
nifty5/library/correlated_fields.py
with
2 additions
and
29 deletions
nifty5/library/correlated_fields.py
+
2
−
29
View file @
aa2512f9
...
@@ -229,26 +229,6 @@ class _SpecialSum(EndomorphicOperator):
...
@@ -229,26 +229,6 @@ class _SpecialSum(EndomorphicOperator):
return
self
.
_contractor
.
adjoint
(
self
.
_contractor
(
x
))
return
self
.
_contractor
.
adjoint
(
self
.
_contractor
(
x
))
class
_slice_extractor
(
LinearOperator
):
#FIXME it should be tested if the the domain and target are consistent with the slice
def
__init__
(
self
,
domain
,
target
,
sl
):
self
.
_domain
=
makeDomain
(
domain
)
self
.
_target
=
makeDomain
(
target
)
self
.
_sl
=
sl
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
x
=
x
.
to_global_data
()
if
mode
==
self
.
TIMES
:
res
=
x
[
self
.
_sl
]
res
=
res
.
reshape
(
self
.
_target
.
shape
)
else
:
res
=
np
.
zeros
(
self
.
_domain
.
shape
)
res
[
self
.
_sl
]
=
x
return
from_global_data
(
self
.
_tgt
(
mode
),
res
)
class
_Distributor
(
LinearOperator
):
class
_Distributor
(
LinearOperator
):
def
__init__
(
self
,
dofdex
,
domain
,
target
,
space
=
0
):
def
__init__
(
self
,
dofdex
,
domain
,
target
,
space
=
0
):
self
.
_dofdex
=
dofdex
self
.
_dofdex
=
dofdex
...
@@ -269,7 +249,6 @@ class _Distributor(LinearOperator):
...
@@ -269,7 +249,6 @@ class _Distributor(LinearOperator):
return
from_global_data
(
self
.
_tgt
(
mode
),
res
)
return
from_global_data
(
self
.
_tgt
(
mode
),
res
)
class
_Amplitude
(
Operator
):
class
_Amplitude
(
Operator
):
def
__init__
(
self
,
target
,
fluctuations
,
flexibility
,
asperity
,
def
__init__
(
self
,
target
,
fluctuations
,
flexibility
,
asperity
,
loglogavgslope
,
azm
,
key
,
dofdex
):
loglogavgslope
,
azm
,
key
,
dofdex
):
...
@@ -437,20 +416,14 @@ class CorrelatedFieldMaker:
...
@@ -437,20 +416,14 @@ class CorrelatedFieldMaker:
hspace
=
makeDomain
([
UnstructuredDomain
(
self
.
_total_N
)]
+
hspace
=
makeDomain
([
UnstructuredDomain
(
self
.
_total_N
)]
+
[
dd
[
-
1
].
get_default_codomain
()
for
dd
in
self
.
_position_spaces
])
[
dd
[
-
1
].
get_default_codomain
()
for
dd
in
self
.
_position_spaces
])
spaces
=
list
(
1
+
np
.
arange
(
n_amplitudes
))
spaces
=
list
(
1
+
np
.
arange
(
n_amplitudes
))
zeroind
=
(
slice
(
None
),)
+
(
0
,)
*
(
len
(
hspace
.
shape
)
-
1
)
else
:
else
:
hspace
=
makeDomain
(
hspace
=
makeDomain
(
[
dd
[
-
1
].
get_default_codomain
()
for
dd
in
self
.
_position_spaces
])
[
dd
[
-
1
].
get_default_codomain
()
for
dd
in
self
.
_position_spaces
])
spaces
=
tuple
(
range
(
n_amplitudes
))
spaces
=
tuple
(
range
(
n_amplitudes
))
spaces
=
list
(
np
.
arange
(
n_amplitudes
))
spaces
=
list
(
np
.
arange
(
n_amplitudes
))
zeroind
=
(
0
,)
*
len
(
hspace
.
shape
)
foo
=
np
.
ones
(
hspace
.
shape
)
foo
[
zeroind
]
=
0
ZeroModeInserter
=
_slice_extractor
(
hspace
,
expander
=
ContractionOperator
(
hspace
,
spaces
=
spaces
).
adjoint
self
.
_azm
.
target
,
zeroind
).
adjoint
azm
=
expander
@
zeromode
azm
=
Adder
(
from_global_data
(
hspace
,
foo
))
@
ZeroModeInserter
@
zeromode
#spaces = np.array(range(n_amplitudes)) + 1 - 1//self._total_N
#spaces = np.array(range(n_amplitudes)) + 1 - 1//self._total_N
ht
=
HarmonicTransformOperator
(
hspace
,
ht
=
HarmonicTransformOperator
(
hspace
,
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment