Commit df3bdf4c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

use more generic names where applicable

parent 52593191
import nifty5 as ift 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 import numpy as np
from scipy.io import loadmat
def get_random_LOS(n_los): def get_random_LOS(n_los):
...@@ -19,7 +15,7 @@ if __name__ == '__main__': ...@@ -19,7 +15,7 @@ if __name__ == '__main__':
position_space = ift.RGSpace([128, 128]) position_space = ift.RGSpace([128, 128])
# Setting up an amplitude model # 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.) position_space, 16, 1, 10, -4., 1, 0., 1.)
# Building the model for a correlated signal # Building the model for a correlated signal
...@@ -35,14 +31,15 @@ if __name__ == '__main__': ...@@ -35,14 +31,15 @@ if __name__ == '__main__':
Amp = power_distributor(A) Amp = power_distributor(A)
correlated_field_h = Amp * xi correlated_field_h = Amp * xi
correlated_field = ht(correlated_field_h) correlated_field = ht(correlated_field_h)
# # alternatively to the block above one can do: # alternatively to the block above one can do:
# correlated_field, _ = make_correlated_field(position_space, A) # correlated_field,_ = ift.library.make_correlated_field(position_space, A)
# apply some nonlinearity # apply some nonlinearity
signal = ift.PointwisePositiveTanh(correlated_field) signal = ift.PointwisePositiveTanh(correlated_field)
# Building the Line of Sight response # Building the Line of Sight response
LOS_starts, LOS_ends = get_random_LOS(100) 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 # build signal response model and model likelihood
signal_response = R(signal) signal_response = R(signal)
# specify noise # specify noise
......
...@@ -6,4 +6,4 @@ from .point_sources import PointSources ...@@ -6,4 +6,4 @@ from .point_sources import PointSources
from .poissonian_energy import PoissonianEnergy from .poissonian_energy import PoissonianEnergy
from .wiener_filter_curvature import WienerFilterCurvature from .wiener_filter_curvature import WienerFilterCurvature
from .wiener_filter_energy import WienerFilterEnergy 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
...@@ -62,6 +62,6 @@ def make_mf_correlated_field(s_space_spatial, s_space_energy, ...@@ -62,6 +62,6 @@ def make_mf_correlated_field(s_space_spatial, s_space_energy,
position = MultiField({'xi': Field.from_random('normal', h_space)}) position = MultiField({'xi': Field.from_random('normal', h_space)})
xi = Variable(position)['xi'] xi = Variable(position)['xi']
logsky_h = A*xi correlated_field_h = A*xi
logsky = ht(logsky_h) correlated_field = ht(correlated_field_h)
return PointwiseExponential(logsky) return PointwiseExponential(correlated_field)
...@@ -26,7 +26,7 @@ from ..sugar import log, makeOp ...@@ -26,7 +26,7 @@ from ..sugar import log, makeOp
class PoissonianEnergy(Energy): class PoissonianEnergy(Energy):
def __init__(self, lamb, d): def __init__(self, lamb, d):
""" """
lamb: Sky model object lamb: Model object
value = 0.5 * s.vdot(s), i.e. a log-Gauss distribution with unit value = 0.5 * s.vdot(s), i.e. a log-Gauss distribution with unit
covariance covariance
......
...@@ -19,7 +19,7 @@ from .model import Model ...@@ -19,7 +19,7 @@ from .model import Model
class Constant(Model): class Constant(Model):
"""A sky model with a constant (multi-)field as value. """A model with a constant (multi-)field as value.
Parameters Parameters
---------- ----------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment