Commit fc0ca7ea authored by Marco Selig's avatar Marco Selig
Browse files

minor changes; documentation updated.

parent 48f85f76
...@@ -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))
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -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))
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -3340,14 +3340,14 @@ class rg_space(space): ...@@ -3340,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)
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -4201,10 +4201,10 @@ class lm_space(space): ...@@ -4201,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))
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -4872,10 +4872,10 @@ class gl_space(space): ...@@ -4872,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))
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -5470,10 +5470,10 @@ class hp_space(space): ...@@ -5470,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])
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -6160,10 +6160,10 @@ class nested_space(space): ...@@ -6160,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)
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -6385,7 +6385,10 @@ class field(object): ...@@ -6385,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)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -6850,12 +6853,12 @@ class field(object): ...@@ -6850,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)
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...@@ -7527,6 +7530,7 @@ def exp(x): ...@@ -7527,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)
...@@ -8537,7 +8541,7 @@ class operator(object): ...@@ -8537,7 +8541,7 @@ class operator(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.operator>" return "<nifty_core.operator>"
##============================================================================= ##=============================================================================
...@@ -9125,7 +9129,7 @@ class diagonal_operator(operator): ...@@ -9125,7 +9129,7 @@ class diagonal_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.diagonal_operator>" return "<nifty_core.diagonal_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -9543,7 +9547,7 @@ class power_operator(diagonal_operator): ...@@ -9543,7 +9547,7 @@ class power_operator(diagonal_operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.power_operator>" return "<nifty_core.power_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -9882,7 +9886,7 @@ class projection_operator(operator): ...@@ -9882,7 +9886,7 @@ class projection_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.projection_operator>" return "<nifty_core.projection_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -10142,7 +10146,7 @@ class vecvec_operator(operator): ...@@ -10142,7 +10146,7 @@ class vecvec_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.vecvec_operator>" return "<nifty_core.vecvec_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -10341,7 +10345,7 @@ class response_operator(operator): ...@@ -10341,7 +10345,7 @@ class response_operator(operator):
## smooth ## smooth
x_ = self.domain.calc_smooth(x.val,sigma=self.sigma) x_ = self.domain.calc_smooth(x.val,sigma=self.sigma)
## mask ## mask
x_ = self.mask*x_ x_ *= self.mask
## assign ## assign
#return x_[self.assign.tolist()] #return x_[self.assign.tolist()]
return field(self.target,val=x_[self.assign.tolist()],target=kwargs.get("target",None)) return field(self.target,val=x_[self.assign.tolist()],target=kwargs.get("target",None))
...@@ -10351,7 +10355,7 @@ class response_operator(operator): ...@@ -10351,7 +10355,7 @@ class response_operator(operator):
## assign (transposed) ## assign (transposed)
x_[self.assign.tolist()] += x.val.flatten(order='C') x_[self.assign.tolist()] += x.val.flatten(order='C')
## mask ## mask
x_ = self.mask*x_ x_ *= self.mask
## smooth ## smooth
x_ = self.domain.calc_smooth(x_,sigma=self.sigma) x_ = self.domain.calc_smooth(x_,sigma=self.sigma)
#return x_ #return x_
...@@ -10399,7 +10403,7 @@ class response_operator(operator): ...@@ -10399,7 +10403,7 @@ class response_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.response_operator>" return "<nifty_core.response_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -10898,7 +10902,7 @@ class probing(object): ...@@ -10898,7 +10902,7 @@ class probing(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.probing>" return "<nifty_core.probing>"
##============================================================================= ##=============================================================================
...@@ -11257,7 +11261,7 @@ class trace_probing(probing): ...@@ -11257,7 +11261,7 @@ class trace_probing(probing):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.trace_probing>" return "<nifty_core.trace_probing>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -11684,7 +11688,7 @@ class diagonal_probing(probing): ...@@ -11684,7 +11688,7 @@ class diagonal_probing(probing):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.diagonal_probing>" return "<nifty_core.diagonal_probing>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
......
...@@ -1150,7 +1150,6 @@ class explicit_operator(operator): ...@@ -1150,7 +1150,6 @@ class explicit_operator(operator):
X = X.astype(max(min(X.dtype,self.domain.datatype),min(X.dtype,self.target.datatype))) X = X.astype(max(min(X.dtype,self.domain.datatype),min(X.dtype,self.target.datatype)))
else: else:
raise ValueError(about._errors.cstring("ERROR: dimension mismatch ( "+str(np.size(X))+" <> "+str(self.ncol())+" x "+str(self.ncol())+" ).")) raise ValueError(about._errors.cstring("ERROR: dimension mismatch ( "+str(np.size(X))+" <> "+str(self.ncol())+" x "+str(self.ncol())+" )."))
return explicit_operator(self.domain,self._calc_mul(X,1),bare=True,sym=sym,uni=uni,target=newtarget) return explicit_operator(self.domain,self._calc_mul(X,1),bare=True,sym=sym,uni=uni,target=newtarget)
def __imul__(self,X): ## __imul__ : self *= X def __imul__(self,X): ## __imul__ : self *= X
...@@ -1386,7 +1385,7 @@ class explicit_operator(operator): ...@@ -1386,7 +1385,7 @@ class explicit_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.explicit_operator>" return "<nifty_explicit.explicit_operator>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
...@@ -1846,7 +1845,7 @@ class explicit_probing(probing): ...@@ -1846,7 +1845,7 @@ class explicit_probing(probing):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def __repr__(self): def __repr__(self):
return "<nifty.explicit_probing>" return "<nifty_explicit.explicit_probing>"
##----------------------------------------------------------------------------- ##-----------------------------------------------------------------------------
......
...@@ -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>"
##============================================================================= ##=============================================================================
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