Commit d4d18b1c authored by M Selig's avatar M Selig
Browse files

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
...@@ -486,7 +486,7 @@ class _about(object): ## nifty support class for global settings ...@@ -486,7 +486,7 @@ class _about(object): ## nifty support class for global settings
""" """
## version ## version
self._version = "0.6.0" self._version = "0.7.0"
## switches and notifications ## switches and notifications
self._errors = notification(default=True,ccode=notification._code) self._errors = notification(default=True,ccode=notification._code)
...@@ -774,7 +774,7 @@ class random(object): ...@@ -774,7 +774,7 @@ class random(object):
""" """
size = np.prod(shape,axis=0,dtype=np.int,out=None) size = np.prod(shape,axis=0,dtype=np.int,out=None)
if(datatype in [np.complex64,np.complex128]): if(issubclass(datatype,np.complexfloating)):
x = np.array([1+0j,0+1j,-1+0j,0-1j],dtype=datatype)[np.random.randint(4,high=None,size=size)] x = np.array([1+0j,0+1j,-1+0j,0-1j],dtype=datatype)[np.random.randint(4,high=None,size=size)]
else: else:
x = 2*np.random.randint(2,high=None,size=size)-1 x = 2*np.random.randint(2,high=None,size=size)-1
...@@ -816,7 +816,7 @@ class random(object): ...@@ -816,7 +816,7 @@ class random(object):
""" """
size = np.prod(shape,axis=0,dtype=np.int,out=None) size = np.prod(shape,axis=0,dtype=np.int,out=None)
if(datatype in [np.complex64,np.complex128]): if(issubclass(datatype,np.complexfloating)):
x = np.empty(size,dtype=datatype,order='C') x = np.empty(size,dtype=datatype,order='C')
x.real = np.random.normal(loc=0,scale=np.sqrt(0.5),size=size) x.real = np.random.normal(loc=0,scale=np.sqrt(0.5),size=size)
x.imag = np.random.normal(loc=0,scale=np.sqrt(0.5),size=size) x.imag = np.random.normal(loc=0,scale=np.sqrt(0.5),size=size)
...@@ -893,7 +893,7 @@ class random(object): ...@@ -893,7 +893,7 @@ class random(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.random>" return "<nifty_core.random>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -1693,10 +1693,10 @@ class space(object): ...@@ -1693,10 +1693,10 @@ class space(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.space>" return "<nifty_core.space>"
def __str__(self): def __str__(self):
return "nifty.space instance\n- para = "+str(self.para)+"\n- datatype = numpy."+str(np.result_type(self.datatype)) return "nifty_core.space instance\n- para = "+str(self.para)+"\n- datatype = numpy."+str(np.result_type(self.datatype))
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -1941,7 +1941,7 @@ class point_space(space): ...@@ -1941,7 +1941,7 @@ class point_space(space):
Number of degrees of freedom of the space. Number of degrees of freedom of the space.
""" """
## dof ~ dim ## dof ~ dim
if(self.datatype in [np.complex64,np.complex128]): if(issubclass(self.datatype,np.complexfloating)):
return 2*self.para[0] return 2*self.para[0]
else: else:
return self.para[0] return self.para[0]
...@@ -2142,10 +2142,10 @@ class point_space(space): ...@@ -2142,10 +2142,10 @@ class point_space(space):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.point_space>" return "<nifty_core.point_space>"
def __str__(self): def __str__(self):
return "nifty.point_space instance\n- num = "+str(self.para[0])+"\n- datatype = numpy."+str(np.result_type(self.datatype)) return "nifty_core.point_space instance\n- num = "+str(self.para[0])+"\n- datatype = numpy."+str(np.result_type(self.datatype))
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -3279,12 +3279,18 @@ class rg_space(space): ...@@ -3279,12 +3279,18 @@ class rg_space(space):
elif(naxes==2): elif(naxes==2):
if(np.iscomplexobj(x)): if(np.iscomplexobj(x)):
about.infos.cprint("INFO: absolute values, real and imaginary part plotted.") about.infos.cprint("INFO: absolute values and phases are plotted.")
if(title): if(title):
title += " " title += " "
self.get_plot(np.absolute(x),title=title+"(absolute)",vmin=vmin,vmax=vmax,power=False,unit=unit,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) self.get_plot(np.absolute(x),title=title+"(absolute)",vmin=vmin,vmax=vmax,power=False,unit=unit,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs)
self.get_plot(np.real(x),title=title+"(real part)",vmin=vmin,vmax=vmax,power=False,unit=unit,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) # self.get_plot(np.real(x),title=title+"(real part)",vmin=vmin,vmax=vmax,power=False,unit=unit,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs)
self.get_plot(np.imag(x),title=title+"(imaginary part)",vmin=vmin,vmax=vmax,power=False,unit=unit,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) # self.get_plot(np.imag(x),title=title+"(imaginary part)",vmin=vmin,vmax=vmax,power=False,unit=unit,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs)
if(unit):
unit = "rad"
if(cmap is None):
cmap = pl.cm.hsv_r
self.get_plot(np.angle(x,deg=False),title=title+"(phase)",vmin=-3.1416,vmax=3.1416,power=False,unit=unit,norm=None,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) ## values in [-pi,pi]
return None ## leave method
else: else:
if(vmin is None): if(vmin is None):
vmin = np.min(x,axis=None,out=None) vmin = np.min(x,axis=None,out=None)
...@@ -3334,14 +3340,14 @@ class rg_space(space): ...@@ -3334,14 +3340,14 @@ class rg_space(space):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.rg_space>" return "<nifty_core.rg_space>"
def __str__(self): def __str__(self):
naxes = (np.size(self.para)-1)//2 naxes = (np.size(self.para)-1)//2
num = self.para[:naxes][::-1].tolist() num = self.para[:naxes][::-1].tolist()
zerocenter = self.para[-naxes:][::-1].astype(np.bool).tolist() zerocenter = self.para[-naxes:][::-1].astype(np.bool).tolist()
dist = self.vol[::-1].tolist() dist = self.vol[::-1].tolist()
return "nifty.rg_space instance\n- num = "+str(num)+"\n- naxes = "+str(naxes)+"\n- hermitian = "+str(bool(self.para[naxes]<2))+"\n- purelyreal = "+str(bool(not self.para[naxes]))+"\n- zerocenter = "+str(zerocenter)+"\n- dist = "+str(dist)+"\n- fourier = "+str(self.fourier) return "nifty_core.rg_space instance\n- num = "+str(num)+"\n- naxes = "+str(naxes)+"\n- hermitian = "+str(bool(self.para[naxes]<2))+"\n- purelyreal = "+str(bool(not self.para[naxes]))+"\n- zerocenter = "+str(zerocenter)+"\n- dist = "+str(dist)+"\n- fourier = "+str(self.fourier)
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -4122,9 +4128,9 @@ class lm_space(space): ...@@ -4122,9 +4128,9 @@ class lm_space(space):
ax0.legend() ax0.legend()
ax0.set_xlim(xaxes[1],xaxes[-1]) ax0.set_xlim(xaxes[1],xaxes[-1])
ax0.set_xlabel(r"$l$") ax0.set_xlabel(r"$\ell$")
ax0.set_ylim(vmin,vmax) ax0.set_ylim(vmin,vmax)
ax0.set_ylabel(r"$l(2l+1) C_l$") ax0.set_ylabel(r"$\ell(2\ell+1) C_\ell$")
ax0.set_title(title) ax0.set_title(title)
else: else:
...@@ -4133,8 +4139,12 @@ class lm_space(space): ...@@ -4133,8 +4139,12 @@ class lm_space(space):
if(title): if(title):
title += " " title += " "
self.get_plot(np.absolute(x),title=title+"(absolute)",vmin=vmin,vmax=vmax,power=False,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) self.get_plot(np.absolute(x),title=title+"(absolute)",vmin=vmin,vmax=vmax,power=False,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs)
self.get_plot(np.real(x),title=title+"(real part)",vmin=vmin,vmax=vmax,power=False,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) # self.get_plot(np.real(x),title=title+"(real part)",vmin=vmin,vmax=vmax,power=False,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs)
self.get_plot(np.imag(x),title=title+"(imaginary part)",vmin=vmin,vmax=vmax,power=False,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) # self.get_plot(np.imag(x),title=title+"(imaginary part)",vmin=vmin,vmax=vmax,power=False,norm=norm,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs)
if(cmap is None):
cmap = pl.cm.hsv_r
self.get_plot(np.angle(x,deg=False),title=title+"(phase)",vmin=-3.1416,vmax=3.1416,power=False,norm=None,cmap=cmap,cbar=cbar,other=None,legend=False,**kwargs) ## values in [-pi,pi]
return None ## leave method
else: else:
if(vmin is None): if(vmin is None):
vmin = np.min(x,axis=None,out=None) vmin = np.min(x,axis=None,out=None)
...@@ -4165,7 +4175,7 @@ class lm_space(space): ...@@ -4165,7 +4175,7 @@ class lm_space(space):
sub = ax0.pcolormesh(xaxes,yaxes,np.ma.masked_where(np.isnan(xmesh),xmesh),cmap=cmap,norm=n_,vmin=vmin,vmax=vmax,clim=(vmin,vmax)) sub = ax0.pcolormesh(xaxes,yaxes,np.ma.masked_where(np.isnan(xmesh),xmesh),cmap=cmap,norm=n_,vmin=vmin,vmax=vmax,clim=(vmin,vmax))
ax0.set_xlim(xaxes[0],xaxes[-1]) ax0.set_xlim(xaxes[0],xaxes[-1])
ax0.set_xticks([0],minor=False) ax0.set_xticks([0],minor=False)
ax0.set_xlabel(r"$l$") ax0.set_xlabel(r"$\ell$")
ax0.set_ylim(yaxes[0],yaxes[-1]) ax0.set_ylim(yaxes[0],yaxes[-1])
ax0.set_yticks([0],minor=False) ax0.set_yticks([0],minor=False)
ax0.set_ylabel(r"$m$") ax0.set_ylabel(r"$m$")
...@@ -4191,10 +4201,10 @@ class lm_space(space): ...@@ -4191,10 +4201,10 @@ class lm_space(space):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.lm_space>" return "<nifty_core.lm_space>"
def __str__(self): def __str__(self):
return "nifty.lm_space instance\n- lmax = "+str(self.para[0])+"\n- mmax = "+str(self.para[1])+"\n- datatype = numpy."+str(np.result_type(self.datatype)) return "nifty_core.lm_space instance\n- lmax = "+str(self.para[0])+"\n- mmax = "+str(self.para[1])+"\n- datatype = numpy."+str(np.result_type(self.datatype))
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -4862,10 +4872,10 @@ class gl_space(space): ...@@ -4862,10 +4872,10 @@ class gl_space(space):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.gl_space>" return "<nifty_core.gl_space>"
def __str__(self): def __str__(self):
return "nifty.gl_space instance\n- nlat = "+str(self.para[0])+"\n- nlon = "+str(self.para[1])+"\n- datatype = numpy."+str(np.result_type(self.datatype)) return "nifty_core.gl_space instance\n- nlat = "+str(self.para[0])+"\n- nlon = "+str(self.para[1])+"\n- datatype = numpy."+str(np.result_type(self.datatype))
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -5460,10 +5470,10 @@ class hp_space(space): ...@@ -5460,10 +5470,10 @@ class hp_space(space):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.hp_space>" return "<nifty_core.hp_space>"
def __str__(self): def __str__(self):
return "nifty.hp_space instance\n- nside = "+str(self.para[0]) return "nifty_core.hp_space instance\n- nside = "+str(self.para[0])
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -6150,10 +6160,10 @@ class nested_space(space): ...@@ -6150,10 +6160,10 @@ class nested_space(space):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.nested_space>" return "<nifty_core.nested_space>"
def __str__(self): def __str__(self):
return "nifty.nested_space instance\n- nest = "+str(self.nest) return "nifty_core.nested_space instance\n- nest = "+str(self.nest)
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -6375,7 +6385,10 @@ class field(object): ...@@ -6375,7 +6385,10 @@ class field(object):
New field values either as a constant or an arbitrary array. New field values either as a constant or an arbitrary array.
""" """
self.val = self.domain.enforce_values(newval,extend=True) if(newval is None):
self.val = np.zeros(self.dim(split=True),dtype=self.domain.datatype,order='C')
else:
self.val = self.domain.enforce_values(newval,extend=True)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -6840,12 +6853,12 @@ class field(object): ...@@ -6840,12 +6853,12 @@ class field(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.field>" return "<nifty_core.field>"
def __str__(self): def __str__(self):
minmax = [np.min(self.val,axis=None,out=None),np.max(self.val,axis=None,out=None)] minmax = [np.min(self.val,axis=None,out=None),np.max(self.val,axis=None,out=None)]
medmean = [np.median(self.val,axis=None,out=None,overwrite_input=False),np.mean(self.val,axis=None,dtype=self.domain.datatype,out=None)] medmean = [np.median(self.val,axis=None,out=None,overwrite_input=False),np.mean(self.val,axis=None,dtype=self.domain.datatype,out=None)]
return "nifty.field instance\n- domain = "+repr(self.domain)+"\n- val = [...]"+"\n - min.,max. = "+str(minmax)+"\n - med.,mean = "+str(medmean)+"\n- target = "+repr(self.target) return "nifty_core.field instance\n- domain = "+repr(self.domain)+"\n- val = [...]"+"\n - min.,max. = "+str(minmax)+"\n - med.,mean = "+str(medmean)+"\n- target = "+repr(self.target)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -7517,6 +7530,7 @@ def exp(x): ...@@ -7517,6 +7530,7 @@ def exp(x):
array([ 2.20264658e+04, 2.68811714e+43]) array([ 2.20264658e+04, 2.68811714e+43])
>>> exp(field(point_space(2), val=[10, 100])).val >>> exp(field(point_space(2), val=[10, 100])).val
array([ 2.20264658e+04, 2.68811714e+43]) array([ 2.20264658e+04, 2.68811714e+43])
""" """
if(isinstance(x,field)): if(isinstance(x,field)):
return field(x.domain,val=np.exp(x.val),target=x.target) return field(x.domain,val=np.exp(x.val),target=x.target)
...@@ -7698,17 +7712,17 @@ class operator(object): ...@@ -7698,17 +7712,17 @@ class operator(object):
self.sym = bool(sym) self.sym = bool(sym)
self.uni = bool(uni) self.uni = bool(uni)
if(self.domain.discrete):
self.imp = True
else:
self.imp = bool(imp)
if(target is None)or(self.sym)or(self.uni): if(target is None)or(self.sym)or(self.uni):
target = self.domain target = self.domain
if(not isinstance(target,space)): elif(not isinstance(target,space)):
raise TypeError(about._errors.cstring("ERROR: invalid input.")) raise TypeError(about._errors.cstring("ERROR: invalid input."))
self.target = target self.target = target
if(self.domain.discrete)and(self.target.discrete):
self.imp = True
else:
self.imp = bool(imp)
if(para is not None): if(para is not None):
self.para = para self.para = para
...@@ -7731,7 +7745,7 @@ class operator(object): ...@@ -7731,7 +7745,7 @@ class operator(object):
Returns Returns
------- -------
nrow : int ncol : int
number of columns (equal to the dimension of the domain) number of columns (equal to the dimension of the domain)
""" """
return self.domain.dim(split=False) return self.domain.dim(split=False)
...@@ -7919,7 +7933,6 @@ class operator(object): ...@@ -7919,7 +7933,6 @@ class operator(object):
## evaluate ## evaluate
return self._debriefing(x,x_,self.domain,True) return self._debriefing(x,x_,self.domain,True)
def adjoint_inverse_times(self,x,**kwargs): def adjoint_inverse_times(self,x,**kwargs):
""" """
Applies the inverse adjoint operator to a given object. Applies the inverse adjoint operator to a given object.
...@@ -8026,7 +8039,7 @@ class operator(object): ...@@ -8026,7 +8039,7 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.domain domain = self.domain
return trace_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,**kwargs)(loop=loop) return trace_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=(ncpu,1)[bool(loop)],nrun=nrun,nper=nper,var=var,**kwargs)(loop=loop)
def inverse_tr(self,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=1,var=False,loop=False,**kwargs): def inverse_tr(self,domain=None,target=None,random="pm1",ncpu=2,nrun=8,nper=1,var=False,loop=False,**kwargs):
""" """
...@@ -8072,7 +8085,7 @@ class operator(object): ...@@ -8072,7 +8085,7 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.target domain = self.target
return trace_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,**kwargs)(loop=loop) return trace_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=(ncpu,1)[bool(loop)],nrun=nrun,nper=nper,var=var,**kwargs)(loop=loop)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -8143,7 +8156,7 @@ class operator(object): ...@@ -8143,7 +8156,7 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.domain domain = self.domain
diag = diagonal_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix,**kwargs)(loop=loop) diag = diagonal_probing(self,function=self.times,domain=domain,target=target,random=random,ncpu=(ncpu,1)[bool(loop)],nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix,**kwargs)(loop=loop)
if(diag is None): if(diag is None):
# about.warnings.cprint("WARNING: forwarding 'NoneType'.") # about.warnings.cprint("WARNING: forwarding 'NoneType'.")
return None return None
...@@ -8223,7 +8236,7 @@ class operator(object): ...@@ -8223,7 +8236,7 @@ class operator(object):
""" """
if(domain is None): if(domain is None):
domain = self.target domain = self.target
diag = diagonal_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=ncpu,nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix,**kwargs)(loop=loop) diag = diagonal_probing(self,function=self.inverse_times,domain=domain,target=target,random=random,ncpu=(ncpu,1)[bool(loop)],nrun=nrun,nper=nper,var=var,save=save,path=path,prefix=prefix,**kwargs)(loop=loop)
if(diag is None): if(diag is None):
# about.warnings.cprint("WARNING: forwarding 'NoneType'.") # about.warnings.cprint("WARNING: forwarding 'NoneType'.")
return None return None
...@@ -8528,7 +8541,7 @@ class operator(object): ...@@ -8528,7 +8541,7 @@ class operator(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(