Skip to content
GitLab
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
49218708
Commit
49218708
authored
Nov 14, 2019
by
Philipp Arras
Browse files
Actually return amplitude in one-space case
parent
beebf0dc
Pipeline
#63676
passed with stages
in 9 minutes and 15 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
demos/find_amplitude_parameters.py
View file @
49218708
...
...
@@ -38,7 +38,7 @@ if __name__ == '__main__':
fa
.
add_fluctuations
(
ift
.
RGSpace
(
32
),
3
,
5
,
1
,
1e-6
,
2
,
1e-6
,
slope_means
[
1
],
1
,
'freq'
)
correlated_field
=
fa
.
finalize
()
amplitudes
=
fa
.
amplitudes
amplitudes
=
fa
.
normalized_
amplitudes
plt
.
style
.
use
(
'seaborn-notebook'
)
tgt
=
correlated_field
.
target
...
...
demos/getting_started_3.py
View file @
49218708
...
...
@@ -61,7 +61,7 @@ if __name__ == '__main__':
cfmaker
.
add_fluctuations
(
position_space
,
1.
,
1e-2
,
1
,
.
5
,
.
1
,
.
5
,
-
3
,
0.5
,
''
)
correlated_field
=
cfmaker
.
finalize
()
A
=
cfmaker
.
amplitude
s
[
0
]
A
=
cfmaker
.
amplitude
# Apply a nonlinearity
signal
=
ift
.
sigmoid
(
correlated_field
)
...
...
demos/getting_started_mf.py
View file @
49218708
...
...
@@ -78,8 +78,8 @@ if __name__ == '__main__':
-
1.5
,
.
5
,
'amp2'
)
correlated_field
=
cfmaker
.
finalize
()
A1
=
cfmaker
.
amplitudes
[
0
]
A2
=
cfmaker
.
amplitudes
[
1
]
A1
=
cfmaker
.
normalized_
amplitudes
[
0
]
A2
=
cfmaker
.
normalized_
amplitudes
[
1
]
DC
=
SingleDomain
(
correlated_field
.
target
,
position_space
)
# Apply a nonlinearity
...
...
demos/newamplitudes.py
View file @
49218708
...
...
@@ -7,7 +7,7 @@ sspace = ift.RGSpace((128,))
fa
=
ift
.
CorrelatedFieldMaker
.
make
(
10
,
0.1
,
''
)
fa
.
add_fluctuations
(
sspace
,
10
,
2
,
1
,
1e-6
,
2
,
1e-6
,
-
2
,
1e-6
,
'spatial'
)
op
=
fa
.
finalize
()
A
=
fa
.
amplitude
s
[
0
]
A
=
fa
.
amplitude
cstpos
=
ift
.
from_random
(
'normal'
,
op
.
domain
)
p1
,
p2
=
[
ift
.
Plot
()
for
_
in
range
(
2
)]
...
...
nifty5/library/correlated_fields.py
View file @
49218708
...
...
@@ -372,7 +372,7 @@ class CorrelatedFieldMaker:
lst
=
[(
'Offset amplitude'
,
self
.
amplitude_total_offset
),
(
'Total fluctuation amplitude'
,
self
.
total_fluctuation
)]
namps
=
len
(
self
.
a
mplitudes
)
namps
=
len
(
self
.
_
a
)
if
namps
>
1
:
for
ii
in
range
(
namps
):
lst
.
append
((
'Slice fluctuation (space {})'
.
format
(
ii
),
...
...
@@ -399,9 +399,19 @@ class CorrelatedFieldMaker:
return
fluctuations_slice_mean
/
np
.
mean
(
np
.
sqrt
(
scm
))
@
property
def
amplitudes
(
self
):
def
normalized_
amplitudes
(
self
):
return
self
.
_a
@
property
def
amplitude
(
self
):
if
len
(
self
.
_a
)
>
1
:
s
=
(
'If more than one spectrum is present in the model,'
,
' no unique set of amplitudes exist because only the'
,
' relative scale is determined.'
)
raise
NotImplementedError
(
s
)
expand
=
VdotOperator
(
full
(
self
.
_a
[
0
].
target
,
1
)).
adjoint
return
self
.
_a
[
0
]
*
(
expand
@
self
.
amplitude_total_offset
)
@
property
def
amplitude_total_offset
(
self
):
return
self
.
_azm
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment