Commit d4d18b1c authored by M Selig's avatar M Selig

Merge pull request #8 from mselig/develop

version update to 0.7.0
parents 87d151ee 6ef6ce0c
...@@ -17,4 +17,5 @@ demos/* ...@@ -17,4 +17,5 @@ demos/*
!demos/demo_faraday_map.npy !demos/demo_faraday_map.npy
!demos/demo_excaliwir.py !demos/demo_excaliwir.py
!demos/demo_wf1.py !demos/demo_wf1.py
!demos/demo_wf2.py !demos/demo_wf2.py
\ No newline at end of file !demos/demo_wf3.py
\ No newline at end of file
...@@ -64,6 +64,8 @@ apply to fields. ...@@ -64,6 +64,8 @@ apply to fields.
* ``response_operator`` - exemplary responses that include a convolution, * ``response_operator`` - exemplary responses that include a convolution,
masking and projection masking and projection
* ``propagator_operator`` - information propagator in Wiener filter theory * ``propagator_operator`` - information propagator in Wiener filter theory
* ``explicit_operator`` - linear operators with an explicit matrix
representation
* (and more) * (and more)
* (and more) * (and more)
...@@ -97,7 +99,7 @@ Requirements ...@@ -97,7 +99,7 @@ Requirements
Download Download
........ ........
The latest release is tagged **v0.6.0** and is available as a source package The latest release is tagged **v0.7.0** and is available as a source package
at `<https://github.com/mselig/nifty/tags>`_. The current version can be at `<https://github.com/mselig/nifty/tags>`_. The current version can be
obtained by cloning the repository:: obtained by cloning the repository::
...@@ -140,5 +142,7 @@ The NIFTY package is licensed under the ...@@ -140,5 +142,7 @@ The NIFTY package is licensed under the
`GPLv3 <http://www.gnu.org/licenses/gpl.html>`_ and is distributed *without any `GPLv3 <http://www.gnu.org/licenses/gpl.html>`_ and is distributed *without any
warranty*. warranty*.
----
**NIFTY** project homepage: `<http://www.mpa-garching.mpg.de/ift/nifty/>`_ **NIFTY** project homepage: `<http://www.mpa-garching.mpg.de/ift/nifty/>`_
...@@ -24,6 +24,7 @@ from nifty_core import * ...@@ -24,6 +24,7 @@ from nifty_core import *
from nifty_cmaps import * from nifty_cmaps import *
from nifty_power import * from nifty_power import *
from nifty_tools import * from nifty_tools import *
from nifty_explicit import *
......
## NIFTY (Numerical Information Field Theory) has been developed at the
## Max-Planck-Institute for Astrophysics.
##
## Copyright (C) 2013 Max-Planck-Society
##
## Author: Marco Selig
## Project homepage: <http://www.mpa-garching.mpg.de/ift/nifty/>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
## See the GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
.. __ ____ __
.. /__/ / _/ / /_
.. __ ___ __ / /_ / _/ __ __
.. / _ | / / / _/ / / / / / /
.. / / / / / / / / / /_ / /_/ /
.. /__/ /__/ /__/ /__/ \___/ \___ / demo
.. /______/
NIFTY demo applying a Wiener filter using explicit matrices.
"""
from __future__ import division
from nifty import * # version 0.7.0
from nifty.nifty_explicit import *
# some signal space; e.g., a one-dimensional regular grid
x_space = rg_space(128) # define signal space
k_space = x_space.get_codomain() # get conjugate space
# some power spectrum
power = (lambda k: 42 / (k + 1) ** 3)
S = power_operator(k_space, spec=power) # define signal covariance
s = S.get_random_field(domain=x_space) # generate signal
s -= s.val.mean()
R = response_operator(x_space, sigma=0.0, mask=1.0, assign=None) # define response
d_space = R.target # get data space
# some noise variance
delta = 1000 * (np.arange(1, x_space.dim() + 1) / x_space.dim()) ** 5
N = diagonal_operator(d_space, diag=delta, bare=True) # define noise covariance
n = N.get_random_field(domain=d_space) # generate noise
d = R(s) + n # compute data
j = R.adjoint_times(N.inverse_times(d)) # define information source
class M_operator(operator):
def _multiply(self, x):
N, R = self.para
return R.adjoint_times(N.inverse_times(R.times(x)))
C = explicify(S, newdomain=x_space, newtarget=x_space) # explicify S
M = M_operator(x_space, sym=True, uni=False, imp=True, para=(N, R))
M = explicify(M) # explicify M
D = (C.inverse() + M).inverse() # define information propagator
m = D(j) # reconstruct map
vminmax = {"vmin":1.5 * s.val.min(), "vmax":1.5 * s.val.max()}
s.plot(title="signal", **vminmax) # plot signal
d_ = field(x_space, val=d.val, target=k_space)
d_.plot(title="data", **vminmax) # plot data
m.plot(title="reconstructed map", error=D.diag(bare=True), **vminmax) # plot map
D.plot(title="information propagator", bare=True) # plot information propagator
This diff is collapsed.
This diff is collapsed.
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
""" """
from __future__ import division from __future__ import division
from scipy.interpolate import interp1d as ip ## conflicts with sphinx's autodoc from scipy.interpolate import interp1d as ip ## FIXME: conflicts with sphinx's autodoc
#import numpy as np #import numpy as np
from nifty_core import * from nifty_core import *
import smoothing as gs import smoothing as gs
...@@ -339,7 +339,7 @@ def infer_power(m,domain=None,Sk=None,D=None,pindex=None,pundex=None,kindex=None ...@@ -339,7 +339,7 @@ def infer_power(m,domain=None,Sk=None,D=None,pindex=None,pundex=None,kindex=None
var : {scalar, list, array}, *optional* var : {scalar, list, array}, *optional*
Variance of the assumed spectral smoothness prior (default: 10). Variance of the assumed spectral smoothness prior (default: 10).
force : bool, *optional*, *experimental* force : bool, *optional*, *experimental*
Indicates whether smoothness is to be enforces or not Indicates whether smoothness is to be enforced or not
(default: False). (default: False).
bare : bool, *optional* bare : bool, *optional*
Indicates whether the power spectrum entries returned are "bare" Indicates whether the power spectrum entries returned are "bare"
......
...@@ -260,7 +260,7 @@ class invertible_operator(operator): ...@@ -260,7 +260,7 @@ class invertible_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.invertible_operator>" return "<nifty_tools.invertible_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -417,10 +417,10 @@ class propagator_operator(operator): ...@@ -417,10 +417,10 @@ class propagator_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def _standard_M_times_1(self,x): ## applies > R_adjoint N_inverse R assuming N is diagonal def _standard_M_times_1(self,x,**kwargs): ## applies > R_adjoint N_inverse R assuming N is diagonal
return self.RN[0].adjoint_times(self.RN[1]._inverse_multiply(self.RN[0].times(x))) ## N.imp = True return self.RN[0].adjoint_times(self.RN[1]._inverse_multiply(self.RN[0].times(x))) ## N.imp = True
def _standard_M_times_2(self,x): ## applies > R_adjoint N_inverse R def _standard_M_times_2(self,x,**kwargs): ## applies > R_adjoint N_inverse R
return self.RN[0].adjoint_times(self.RN[1].inverse_times(self.RN[0].times(x))) return self.RN[0].adjoint_times(self.RN[1].inverse_times(self.RN[0].times(x)))
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -552,7 +552,7 @@ class propagator_operator(operator): ...@@ -552,7 +552,7 @@ class propagator_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.propagator_operator>" return "<nifty_tools.propagator_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -866,7 +866,7 @@ class conjugate_gradient(object): ...@@ -866,7 +866,7 @@ class conjugate_gradient(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.conjugate_gradient>" return "<nifty_tools.conjugate_gradient>"
##============================================================================= ##=============================================================================
...@@ -1130,7 +1130,7 @@ class steepest_descent(object): ...@@ -1130,7 +1130,7 @@ class steepest_descent(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.steepest_descent>" return "<nifty_tools.steepest_descent>"
##============================================================================= ##=============================================================================
...@@ -23,7 +23,7 @@ from distutils.core import setup ...@@ -23,7 +23,7 @@ from distutils.core import setup
import os import os
setup(name="nifty", setup(name="nifty",
version="0.6.0", version="0.7.0",
description="Numerical Information Field Theory", description="Numerical Information Field Theory",
author="Marco Selig", author="Marco Selig",
author_email="mselig@mpa-garching.mpg.de", author_email="mselig@mpa-garching.mpg.de",
...@@ -34,5 +34,6 @@ setup(name="nifty", ...@@ -34,5 +34,6 @@ setup(name="nifty",
"demos/demo_faraday.py", "demos/demo_faraday.py",
"demos/demo_faraday_map.npy", "demos/demo_faraday_map.npy",
"demos/demo_wf1.py", "demos/demo_wf1.py",
"demos/demo_wf2.py"]}, "demos/demo_wf2.py",
"demos/demo_wf3.py"]},
data_files=[(os.path.expanduser('~') + "/.nifty", ["nifty_config"])]) data_files=[(os.path.expanduser('~') + "/.nifty", ["nifty_config"])])
\ No newline at end of file
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