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
4528dc6a
Commit
4528dc6a
authored
Mar 01, 2019
by
Lukas Platz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made zero mode prior params optional in SLAmplitude
parent
3ac39d77
Pipeline
#44418
failed with stages
in 9 minutes and 55 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
17 deletions
+27
-17
nifty5/library/smooth_linear_amplitude.py
nifty5/library/smooth_linear_amplitude.py
+27
-17
No files found.
nifty5/library/smooth_linear_amplitude.py
View file @
4528dc6a
...
...
@@ -118,7 +118,7 @@ def CepstrumOperator(target, a, k0):
return
sym
@
qht
@
makeOp
(
cepstrum
.
sqrt
())
def
SLAmplitude
(
*
,
target
,
n_pix
,
a
,
k0
,
sm
,
sv
,
im
,
iv
,
za
,
zq
,
def
SLAmplitude
(
*
,
target
,
n_pix
,
a
,
k0
,
sm
,
sv
,
im
,
iv
,
za
=
None
,
zq
=
None
,
keys
=
[
'tau'
,
'phi'
,
'zero_mode'
]):
'''Operator for parametrizing smooth amplitudes (square roots of power
spectra).
...
...
@@ -168,10 +168,10 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za, zq,
LogRGSpace (see :class:`ExpTransform`).
iv : float
Prior standard deviation of y-intercept of power law.
za : float
za : float
, optional
The alpha-parameter of the inverse-gamma distribution.
Setting the a seperate prior on the zeroGmode of the amplitude model.
zq : float
zq : float
, optional
The q-parameter of the inverse-gamma distribution.
Returns
...
...
@@ -186,10 +186,17 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za, zq,
a
,
k0
=
float
(
a
),
float
(
k0
)
sm
,
sv
,
im
,
iv
=
float
(
sm
),
float
(
sv
),
float
(
im
),
float
(
iv
)
za
,
zq
=
float
(
za
),
float
(
zq
)
if
sv
<=
0
or
iv
<=
0
:
raise
ValueError
if
za
!=
None
and
zq
!=
None
:
separate_zero_mode_prior
=
True
za
,
zq
=
float
(
za
),
float
(
zq
)
else
:
separate_zero_mode_prior
=
False
if
za
!=
None
or
zq
!=
None
:
raise
ValueError
(
"za and zq have to be given together"
)
et
=
ExpTransform
(
target
,
n_pix
)
dom
=
et
.
domain
[
0
]
...
...
@@ -208,16 +215,19 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za, zq,
# Combine linear and smooth component
loglog_ampl
=
0.5
*
(
smooth
+
linear
)
zero_mode
=
ValueInserter
(
et
.
target
,
(
0
,)
*
len
(
et
.
target
.
shape
))
mask
=
np
.
ones
(
et
.
target
.
shape
)
mask
[(
0
,)
*
len
(
et
.
target
.
shape
)]
=
0.
mask
=
from_global_data
(
et
.
target
,
mask
)
mask
=
DiagonalOperator
(
mask
)
zero_mode
=
zero_mode
@
InverseGammaOperator
(
zero_mode
.
domain
,
za
,
zq
)
@
FieldAdapter
(
zero_mode
.
domain
,
keys
[
2
])
# Go from loglog-space to linear-linear-space
print
(
keys
[
2
]
+
" mean: "
,
(
zq
/
(
1
+
za
)))
return
(
mask
@
(
et
@
loglog_ampl
.
exp
())
+
zero_mode
)
if
not
separate_zero_mode_prior
:
# Go from loglog-space to linear-linear-space
return
et
@
loglog_ampl
.
exp
()
else
:
zero_mode
=
ValueInserter
(
et
.
target
,
(
0
,)
*
len
(
et
.
target
.
shape
))
mask
=
np
.
ones
(
et
.
target
.
shape
)
mask
[(
0
,)
*
len
(
et
.
target
.
shape
)]
=
0.
mask
=
from_global_data
(
et
.
target
,
mask
)
mask
=
DiagonalOperator
(
mask
)
zero_mode
=
zero_mode
@
InverseGammaOperator
(
zero_mode
.
domain
,
za
,
zq
)
@
FieldAdapter
(
zero_mode
.
domain
,
keys
[
2
])
print
(
keys
[
2
]
+
" mean: "
,
(
zq
/
(
1
+
za
)))
return
mask
@
(
et
@
loglog_ampl
.
exp
())
+
zero_mode
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