Skip to content
GitLab
Menu
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
bf680c24
Commit
bf680c24
authored
Jul 03, 2018
by
Martin Reinecke
Browse files
Merge branch 'goodbye_blue_sky' into 'NIFTy_5'
Goodbye blue sky Closes
#32
See merge request ift/nifty-dev!30
parents
fe28eda9
1eecc5ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
demos/getting_started_3.py
View file @
bf680c24
import
nifty5
as
ift
from
nifty5.library.los_response
import
LOSResponse
from
nifty5.library.amplitude_model
import
make_amplitude_model
from
nifty5.library.smooth_sky
import
make_correlated_field
import
numpy
as
np
from
scipy.io
import
loadmat
def
get_random_LOS
(
n_los
):
...
...
@@ -19,7 +15,7 @@ if __name__ == '__main__':
position_space
=
ift
.
RGSpace
([
128
,
128
])
# Setting up an amplitude model
A
,
amplitude_internals
=
make_amplitude_model
(
A
,
amplitude_internals
=
ift
.
library
.
make_amplitude_model
(
position_space
,
16
,
1
,
10
,
-
4.
,
1
,
0.
,
1.
)
# Building the model for a correlated signal
...
...
@@ -35,14 +31,15 @@ if __name__ == '__main__':
Amp
=
power_distributor
(
A
)
correlated_field_h
=
Amp
*
xi
correlated_field
=
ht
(
correlated_field_h
)
#
#
alternatively to the block above one can do:
# correlated_field,
_ = make_correlated_field(position_space, A)
# alternatively to the block above one can do:
# correlated_field,_ =
ift.library.
make_correlated_field(position_space, A)
# apply some nonlinearity
signal
=
ift
.
PointwisePositiveTanh
(
correlated_field
)
# Building the Line of Sight response
LOS_starts
,
LOS_ends
=
get_random_LOS
(
100
)
R
=
LOSResponse
(
position_space
,
starts
=
LOS_starts
,
ends
=
LOS_ends
)
R
=
ift
.
library
.
LOSResponse
(
position_space
,
starts
=
LOS_starts
,
ends
=
LOS_ends
)
# build signal response model and model likelihood
signal_response
=
R
(
signal
)
# specify noise
...
...
nifty5/library/__init__.py
View file @
bf680c24
...
...
@@ -6,4 +6,4 @@ from .point_sources import PointSources
from
.poissonian_energy
import
PoissonianEnergy
from
.wiener_filter_curvature
import
WienerFilterCurvature
from
.wiener_filter_energy
import
WienerFilterEnergy
from
.
smooth_sky
import
make_correlated_field
,
make_mf_correlated_field
from
.
correlated_fields
import
make_correlated_field
,
make_mf_correlated_field
nifty5/library/
smooth_sky
.py
→
nifty5/library/
correlated_fields
.py
View file @
bf680c24
...
...
@@ -62,6 +62,6 @@ def make_mf_correlated_field(s_space_spatial, s_space_energy,
position
=
MultiField
({
'xi'
:
Field
.
from_random
(
'normal'
,
h_space
)})
xi
=
Variable
(
position
)[
'xi'
]
logsky
_h
=
A
*
xi
logsky
=
ht
(
logsky
_h
)
return
PointwiseExponential
(
logsky
)
correlated_field
_h
=
A
*
xi
correlated_field
=
ht
(
correlated_field
_h
)
return
PointwiseExponential
(
correlated_field
)
nifty5/library/poissonian_energy.py
View file @
bf680c24
...
...
@@ -26,7 +26,7 @@ from ..sugar import log, makeOp
class
PoissonianEnergy
(
Energy
):
def
__init__
(
self
,
lamb
,
d
):
"""
lamb:
Sky m
odel object
lamb:
M
odel object
value = 0.5 * s.vdot(s), i.e. a log-Gauss distribution with unit
covariance
...
...
nifty5/models/constant.py
View file @
bf680c24
...
...
@@ -19,7 +19,7 @@ from .model import Model
class
Constant
(
Model
):
"""A
sky
model with a constant (multi-)field as value.
"""A model with a constant (multi-)field as value.
Parameters
----------
...
...
Write
Preview
Supports
Markdown
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