Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neel Shah
NIFTy
Commits
b53c531b
Commit
b53c531b
authored
Jan 13, 2019
by
Philipp Arras
Browse files
Unify default in docstrings
parent
0b28ae99
Changes
11
Hide whitespace changes
Inline
Side-by-side
nifty5/domains/log_rg_space.py
View file @
b53c531b
...
...
@@ -38,7 +38,7 @@ class LogRGSpace(StructuredDomain):
FIXME
harmonic : bool, optional
Whether the space represents a grid in position or harmonic space.
(d
efault: False
)
.
D
efault: False.
"""
_needed_for_hash
=
[
'_shape'
,
'_bindistances'
,
'_t_0'
,
'_harmonic'
]
...
...
nifty5/domains/power_space.py
View file @
b53c531b
...
...
@@ -31,13 +31,14 @@ class PowerSpace(StructuredDomain):
----------
harmonic_partner : StructuredDomain
The harmonic domain of which this is the power space.
binbounds : None, or tuple of float (default: None)
if None:
There will be as many bins as there are distinct k-vector lengths
in the harmonic partner space.
The `binbounds` property of the PowerSpace will also be None.
binbounds : None, or tuple of float
FIXME Add docu for binbounds
By default (binbounds=None):
There are as many bins as there are distinct k-vector lengths in
the harmonic partner space.
The `binbounds` property of the PowerSpace will be None.
else:
t
he bin bounds requested for this PowerSpace. The array
T
he bin bounds requested for this PowerSpace. The array
must be sorted and strictly ascending. The first entry is the right
boundary of the first bin, and the last entry is the left boundary
of the last bin, i.e. thee will be `len(binbounds)+1` bins in
...
...
nifty5/domains/rg_space.py
View file @
b53c531b
...
...
@@ -31,19 +31,16 @@ class RGSpace(StructuredDomain):
shape : int or tuple of int
Number of grid points or numbers of gridpoints along each axis.
distances : None or float or tuple of float, optional
Distance between two grid points along each axis
(default: None).
Distance between two grid points along each axis.
If distances is None:
- if harmonic==True, all distances will be set to 1
- if harmonic==False, the distance along each axis will be
By default (distances=None):
- If harmonic==True, all distances will be set to 1
- If harmonic==False, the distance along each axis will be
set to the inverse of the number of points along that axis.
harmonic : bool, optional
Whether the space represents a grid in position or harmonic space.
(d
efault: False
)
.
D
efault: False.
"""
_needed_for_hash
=
[
"_distances"
,
"_shape"
,
"_harmonic"
]
...
...
nifty5/field.py
View file @
b53c531b
...
...
@@ -349,14 +349,14 @@ class Field(object):
x : Field
x must be defined on the same domain as `self`.
spaces : None, int or tuple of int
(default: None)
spaces : None, int or tuple of int
The dot product is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
Default: None.
Returns
-------
float, complex, either scalar (for full dot products)
or Field (for partial dot products)
float, complex, either scalar (for full dot products) or Field (for partial dot products).
"""
if
not
isinstance
(
x
,
Field
):
raise
TypeError
(
"The dot-partner must be an instance of "
+
...
...
@@ -379,8 +379,8 @@ class Field(object):
Parameters
----------
ord : int
, default=2
a
ccepted values: 1, 2, ..., np.inf
ord : int
A
ccepted values: 1, 2, ..., np.inf
. Default: 2.
Returns
-------
...
...
@@ -441,9 +441,9 @@ class Field(object):
Parameters
----------
spaces : None, int or tuple of int
(default: None)
spaces : None, int or tuple of int
The summation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
tuple. If None, it is carried out over all sub-domains.
Default: None.
Returns
-------
...
...
@@ -461,9 +461,10 @@ class Field(object):
Parameters
----------
spaces : None, int or tuple of int
(default: None)
spaces : None, int or tuple of int
The summation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
Default: None.
Returns
-------
...
...
@@ -484,9 +485,10 @@ class Field(object):
Parameters
----------
spaces : None, int or tuple of int
(default: None)
spaces : None, int or tuple of int
The operation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
Default: None.
Returns
-------
...
...
@@ -544,9 +546,9 @@ class Field(object):
Parameters
----------
spaces : None, int or tuple of int
(default: None)
spaces : None, int or tuple of int
The operation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
tuple. If None, it is carried out over all sub-domains.
Default: None.
Returns
-------
...
...
@@ -566,9 +568,10 @@ class Field(object):
Parameters
----------
spaces : None, int or tuple of int
(default: None)
spaces : None, int or tuple of int
The operation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
Default: None.
Returns
-------
...
...
@@ -594,9 +597,10 @@ class Field(object):
Parameters
----------
spaces : None, int or tuple of int
(default: None)
spaces : None, int or tuple of int
The operation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
Default: None.
Returns
-------
...
...
nifty5/library/los_response.py
View file @
b53c531b
...
...
@@ -125,7 +125,7 @@ class LOSResponse(LinearOperator):
The LOS response then returns the expected integral
over the input given that the length of the LOS is unknown and
therefore the result is averaged over different endpoints.
d
efault: None
D
efault: None
.
truncation: float (optional)
Use only if the sigmas keyword argument is used!
This truncates the probability of the endpoint lying more sigmas away
...
...
@@ -133,7 +133,7 @@ class LOSResponse(LinearOperator):
distances. It should hold that `1./(1./length-sigma*truncation)>0`
for all lengths of the LOSs and all corresponding sigma of sigmas.
If unsure, leave blank.
d
efault: 3.
D
efault: 3.
Notes
-----
...
...
nifty5/linearization.py
View file @
b53c531b
...
...
@@ -20,7 +20,6 @@ import numpy as np
from
.field
import
Field
from
.multi_field
import
MultiField
from
.sugar
import
makeOp
from
.operators.scaling_operator
import
ScalingOperator
class
Linearization
(
object
):
...
...
@@ -30,15 +29,15 @@ class Linearization(object):
Parameters
----------
val : Field
/
MultiField
t
he value of the operator application
val : Field
or
MultiField
T
he value of the operator application
.
jac : LinearOperator
t
he Jacobian
metric : LinearOperator or None
(default: None)
t
he metric
want_metric : bool
(default: False)
i
f True, the metric will be computed for other Linearizations derived
from this one.
T
he Jacobian
.
metric : LinearOperator or None
T
he metric
. Default: None.
want_metric : bool
I
f True, the metric will be computed for other Linearizations derived
from this one.
Default: False.
"""
def
__init__
(
self
,
val
,
jac
,
metric
=
None
,
want_metric
=
False
):
self
.
_val
=
val
...
...
@@ -54,28 +53,28 @@ class Linearization(object):
Parameters
----------
val : Field
/
MultiField
val : Field
or
MultiField
the value of the operator application
jac : LinearOperator
the Jacobian
metric : LinearOperator or None
(default: None)
t
he metric
metric : LinearOperator or None
T
he metric
. Default: None.
"""
return
Linearization
(
val
,
jac
,
metric
,
self
.
_want_metric
)
@
property
def
domain
(
self
):
"""DomainTuple
/
MultiDomain : the Jacobian's domain"""
"""DomainTuple
or
MultiDomain : the Jacobian's domain"""
return
self
.
_jac
.
domain
@
property
def
target
(
self
):
"""DomainTuple
/
MultiDomain : the Jacobian's target (i.e. the value's domain)"""
"""DomainTuple
or
MultiDomain : the Jacobian's target (i.e. the value's domain)"""
return
self
.
_jac
.
target
@
property
def
val
(
self
):
"""Field
/
MultiField : the value"""
"""Field
or
MultiField : the value"""
return
self
.
_val
@
property
...
...
@@ -85,7 +84,7 @@ class Linearization(object):
@
property
def
gradient
(
self
):
"""Field
/
MultiField : the gradient
"""Field
or
MultiField : the gradient
Notes
-----
...
...
nifty5/minimization/conjugate_gradient.py
View file @
b53c531b
...
...
@@ -53,7 +53,7 @@ class ConjugateGradient(Minimizer):
linear conjugate gradient minimization will fail.
preconditioner : Operator *optional*
This operator can be provided which transforms the variables of the
system to improve the conditioning
(d
efault: None
)
.
system to improve the conditioning
. D
efault: None.
Returns
-------
...
...
nifty5/minimization/energy.py
View file @
b53c531b
...
...
@@ -109,12 +109,12 @@ class Energy(NiftyMetaBase()):
"""
Parameters
----------
x: Field
/
MultiField
x: Field
or
MultiField
Argument for the metric operator
Returns
-------
Field
/
MultiField:
Field
or
MultiField:
Output of the metric operator
"""
raise
NotImplementedError
...
...
nifty5/minimization/line_search.py
View file @
b53c531b
...
...
@@ -118,18 +118,18 @@ class LineSearch(NiftyMetaBase()):
preferred_initial_step_size : float, optional
Newton-based methods should intialize this to 1.
c1 : float
Parameter for Armijo condition rule.
(
Default: 1e-4
)
Parameter for Armijo condition rule. Default: 1e-4
.
c2 : float
Parameter for curvature condition rule.
(
Default: 0.9
)
Parameter for curvature condition rule. Default: 0.9
.
max_step_size : float
Maximum step allowed in to be made in the descent direction.
(
Default: 1e30
)
Default: 1e30
.
max_iterations : int, optional
Maximum number of iterations performed by the line search algorithm.
(
Default: 100
)
Default: 100
.
max_zoom_iterations : int, optional
Maximum number of iterations performed by the zoom algorithm.
(
Default: 100
)
Default: 100
.
"""
def
__init__
(
self
,
preferred_initial_step_size
=
None
,
c1
=
1e-4
,
c2
=
0.9
,
...
...
@@ -159,7 +159,7 @@ class LineSearch(NiftyMetaBase()):
Vector pointing into the search direction.
f_k_minus_1 : float, optional
Value of the fuction (which is being minimized) at the k-1
iteration of the line search procedure.
(
Default: None
)
iteration of the line search procedure. Default: None
.
Returns
-------
...
...
nifty5/operators/simple_linear_operators.py
View file @
b53c531b
...
...
@@ -29,7 +29,7 @@ class VdotOperator(LinearOperator):
Parameters
----------
field : Field
/
MultiField
field : Field
or
MultiField
The field used to build the scalar product with the operator input
"""
def
__init__
(
self
,
field
):
...
...
nifty5/plot.py
View file @
b53c531b
...
...
@@ -273,25 +273,25 @@ class Plot(object):
Parameters
----------
f: Field
,
or list of Field
objects
f: Field or list of Field
If `f` is a single Field, it must be defined on a single `RGSpace`,
`PowerSpace`, `HPSpace`, `GLSpace`.
If it is a list, all list members must be Fields defined over the
same one-dimensional `RGSpace` or `PowerSpace`.
title: string
title of the plot
title of the plot
.
xlabel: string
l
abel for the x axis
L
abel for the x axis
.
ylabel: string
l
abel for the y axis
L
abel for the y axis
.
[xyz]min, [xyz]max: float
l
imits for the values to plot
L
imits for the values to plot
.
colormap: string
c
olor map to use for the plot (if it is a 2D plot)
C
olor map to use for the plot (if it is a 2D plot)
.
linewidth: float or list of floats
l
ine width
L
ine width
.
label: string of list of strings
a
nnotation string
A
nnotation string
.
alpha: float or list of floats
transparency value
"""
...
...
@@ -304,15 +304,16 @@ class Plot(object):
Parameters
----------
title: string
title of the full plot
nx, ny: integer (default: square root of the numer of plots, rounded up)
number of subplots to use in x- and y-direction
xsize, ysize: float (default: 6)
dimensions of the full plot in inches
name: string (default: "")
if left empty, the plot will be shown on the screen,
Title of the full plot.
nx, ny: int
Number of subplots to use in x- and y-direction.
Default: square root of the numer of plots, rounded up.
xsize, ysize: float
Dimensions of the full plot in inches. Default: 6.
name: string
If left empty, the plot will be shown on the screen,
otherwise it will be written to a file with the given name.
Supported extensions: .png and .pdf
Supported extensions: .png and .pdf
. Default: None.
"""
import
matplotlib.pyplot
as
plt
nplot
=
len
(
self
.
_plots
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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