Skip to content
GitLab
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
fc0ca7ea
Commit
fc0ca7ea
authored
Jan 28, 2014
by
Marco Selig
Browse files
minor changes; documentation updated.
parent
48f85f76
Changes
4
Hide whitespace changes
Inline
Side-by-side
nifty_core.py
View file @
fc0ca7ea
...
...
@@ -893,7 +893,7 @@ class random(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.random>"
return
"<nifty
_core
.random>"
##-----------------------------------------------------------------------------
...
...
@@ -1693,10 +1693,10 @@ class space(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.space>"
return
"<nifty
_core
.space>"
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):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.point_space>"
return
"<nifty
_core
.point_space>"
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):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.rg_space>"
return
"<nifty
_core
.rg_space>"
def
__str__
(
self
):
naxes
=
(
np
.
size
(
self
.
para
)
-
1
)
//
2
num
=
self
.
para
[:
naxes
][::
-
1
].
tolist
()
zerocenter
=
self
.
para
[
-
naxes
:][::
-
1
].
astype
(
np
.
bool
).
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):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.lm_space>"
return
"<nifty
_core
.lm_space>"
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):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.gl_space>"
return
"<nifty
_core
.gl_space>"
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):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.hp_space>"
return
"<nifty
_core
.hp_space>"
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):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.nested_space>"
return
"<nifty
_core
.nested_space>"
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):
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):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.field>"
return
"<nifty
_core
.field>"
def
__str__
(
self
):
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
)]
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):
array([ 2.20264658e+04, 2.68811714e+43])
>>> exp(field(point_space(2), val=[10, 100])).val
array([ 2.20264658e+04, 2.68811714e+43])
"""
if
(
isinstance
(
x
,
field
)):
return
field
(
x
.
domain
,
val
=
np
.
exp
(
x
.
val
),
target
=
x
.
target
)
...
...
@@ -8537,7 +8541,7 @@ class operator(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.operator>"
return
"<nifty
_core
.operator>"
##=============================================================================
...
...
@@ -9125,7 +9129,7 @@ class diagonal_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.diagonal_operator>"
return
"<nifty
_core
.diagonal_operator>"
##-----------------------------------------------------------------------------
...
...
@@ -9543,7 +9547,7 @@ class power_operator(diagonal_operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.power_operator>"
return
"<nifty
_core
.power_operator>"
##-----------------------------------------------------------------------------
...
...
@@ -9882,7 +9886,7 @@ class projection_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.projection_operator>"
return
"<nifty
_core
.projection_operator>"
##-----------------------------------------------------------------------------
...
...
@@ -10142,7 +10146,7 @@ class vecvec_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.vecvec_operator>"
return
"<nifty
_core
.vecvec_operator>"
##-----------------------------------------------------------------------------
...
...
@@ -10341,7 +10345,7 @@ class response_operator(operator):
## smooth
x_
=
self
.
domain
.
calc_smooth
(
x
.
val
,
sigma
=
self
.
sigma
)
## mask
x_
=
self
.
mask
*
x_
x_
*
=
self
.
mask
## assign
#return x_[self.assign.tolist()]
return
field
(
self
.
target
,
val
=
x_
[
self
.
assign
.
tolist
()],
target
=
kwargs
.
get
(
"target"
,
None
))
...
...
@@ -10351,7 +10355,7 @@ class response_operator(operator):
## assign (transposed)
x_
[
self
.
assign
.
tolist
()]
+=
x
.
val
.
flatten
(
order
=
'C'
)
## mask
x_
=
self
.
mask
*
x_
x_
*
=
self
.
mask
## smooth
x_
=
self
.
domain
.
calc_smooth
(
x_
,
sigma
=
self
.
sigma
)
#return x_
...
...
@@ -10399,7 +10403,7 @@ class response_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.response_operator>"
return
"<nifty
_core
.response_operator>"
##-----------------------------------------------------------------------------
...
...
@@ -10898,7 +10902,7 @@ class probing(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.probing>"
return
"<nifty
_core
.probing>"
##=============================================================================
...
...
@@ -11257,7 +11261,7 @@ class trace_probing(probing):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.trace_probing>"
return
"<nifty
_core
.trace_probing>"
##-----------------------------------------------------------------------------
...
...
@@ -11684,7 +11688,7 @@ class diagonal_probing(probing):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.diagonal_probing>"
return
"<nifty
_core
.diagonal_probing>"
##-----------------------------------------------------------------------------
...
...
nifty_explicit.py
View file @
fc0ca7ea
...
...
@@ -1150,7 +1150,6 @@ class explicit_operator(operator):
X
=
X
.
astype
(
max
(
min
(
X
.
dtype
,
self
.
domain
.
datatype
),
min
(
X
.
dtype
,
self
.
target
.
datatype
)))
else
:
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
)
def
__imul__
(
self
,
X
):
## __imul__ : self *= X
...
...
@@ -1386,7 +1385,7 @@ class explicit_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.explicit_operator>"
return
"<nifty
_explicit
.explicit_operator>"
##-----------------------------------------------------------------------------
...
...
@@ -1846,7 +1845,7 @@ class explicit_probing(probing):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.explicit_probing>"
return
"<nifty
_explicit
.explicit_probing>"
##-----------------------------------------------------------------------------
...
...
nifty_power.py
View file @
fc0ca7ea
...
...
@@ -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*
Variance of the assumed spectral smoothness prior (default: 10).
force : bool, *optional*, *experimental*
Indicates whether smoothness is to be enforce
s
or not
Indicates whether smoothness is to be enforce
d
or not
(default: False).
bare : bool, *optional*
Indicates whether the power spectrum entries returned are "bare"
...
...
nifty_tools.py
View file @
fc0ca7ea
...
...
@@ -260,7 +260,7 @@ class invertible_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.invertible_operator>"
return
"<nifty
_tools
.invertible_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
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
)))
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...
...
@@ -552,7 +552,7 @@ class propagator_operator(operator):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.propagator_operator>"
return
"<nifty
_tools
.propagator_operator>"
##-----------------------------------------------------------------------------
...
...
@@ -866,7 +866,7 @@ class conjugate_gradient(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.conjugate_gradient>"
return
"<nifty
_tools
.conjugate_gradient>"
##=============================================================================
...
...
@@ -1130,7 +1130,7 @@ class steepest_descent(object):
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def
__repr__
(
self
):
return
"<nifty.steepest_descent>"
return
"<nifty
_tools
.steepest_descent>"
##=============================================================================
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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