Bases: object
Tuple supporting inplace update x+=y and scaling x=a*y where x,y is an ArithmeticTuple and a is a float.
Example of usage:
from esys.escript import Data
from numpy import array
a=eData(...)
b=array([1.,4.])
x=ArithmeticTuple(a,b)
y=5.*x
Bases: Boost.Python.instance
Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.
Make this object a copy of other
note: The two objects will act independently from now on. That is, changing other after this call will not change this object and vice versa.
note: | In the no argument form, a new object will be returned which is an independent copy of this object. |
---|
Selectively copy values from other Data.Datapoints which correspond to positive values in mask will be copied from other
Parameters: |
---|
Convert this object into lazy representation
Save the data as a netCDF file
Parameters: | fileName (string) – |
---|
Convert the data to expanded representation if it is not expanded already.
Return type: | Domain |
---|
Return type: | FunctionSpace |
---|
Return type: | int |
---|---|
Returns: | Number of datapoints in the object |
Returns: | the number of indices required to address a component of a datapoint |
---|---|
Return type: | positive int |
Returns the shape of the datapoints in this object as a python tuple. Scalar data has the shape ()
Return type: | tuple |
---|
Return tag number for the specified datapoint
Return type: | int |
---|---|
Parameters: | dpno (int) – datapoint number |
Returns: | Value of the specified datapoint |
---|---|
Return type: | tuple |
Parameters: | dataPointNo (int) – datapoint to access |
Get a specific datapoint from a specific process
Return type: | tuple |
---|---|
Parameters: |
|
Interpolate this object’s values into a new functionspace.
Creates a new Data object by interpolating using the source data (which are looked up in table) A must be the outer dimension on the table
param table: two dimensional collection of values param Amin: The base of locations in table type Amin: float param Astep: size of gap between each item in the table type Astep: float param undef: upper bound on interpolated values type undef: float param B: Scalar representing the second coordinate to be mapped into the table type B: Data param Bmin: The base of locations in table for 2nd dimension type Bmin: float param Bstep: size of gap between each item in the table for 2nd dimension type Bstep: float param check_boundaries: if true, then values outside the boundaries will be rejected. If false, then boundary values will be used. raise RuntimeError(DataException): if the coordinates do not map into the table or if the interpolated value is above undef rtype: Data
interpolateTable( (Data)arg1, (object)table, (float)Amin, (float)Astep [, (float)undef=1e+50 [, (bool)check_boundaries=False]]) -> Data
Return type: | bool |
---|---|
Returns: | True if this Data is an instance of DataConstant |
Note : | This does not mean the data is immutable. |
Is this object an instance of DataEmpty
Return type: | bool |
---|---|
Note : | This is not the same thing as asking if the object contains datapoints. |
Return type: | bool |
---|---|
Returns: | True if this Data is expanded. |
Return type: | bool |
---|---|
Returns: | True if this Data is lazy. |
Can this instance be modified. :rtype: bool
Return type: | bool |
---|---|
Returns: | True if this Data is not lazy. |
Return type: | bool |
---|---|
Returns: | True if this Data is expanded. |
Please consider using getSupLocator() from pdetools instead.
Please consider using getInfLocator() from pdetools instead.
1D interpolation with non equally spaced points
1D interpolation of slope with non equally spaced points
Convert the data to non-lazy representation.
Disallow modifications to this data object
Note : | This method does not allow you to undo protection. |
---|
Set the value of tagged Data.
param tagKey: tag to update type tagKey: int
param name: | tag to update |
---|---|
type name: | string |
param value: | value to set tagged data to |
type value: | object which acts like an array, tuple or list |
After this call the object will store values of the same shape as before but all components will be zero.
setValueOfDataPoint( (Data)arg1, (int)arg2, (object)arg3) -> None
setValueOfDataPoint( (Data)arg1, (int)arg2, (float)arg3) -> None :
Modify the value of a single datapoint.
param dataPointNo: type dataPointNo: int param value: type value: float or an object which acts like an array, tuple or list warning: Use of this operation is discouraged. It prevents some optimisations from operating.
Convert data to tagged representation if it is not already tagged or expanded
Return the datapoints of this object in a list. Each datapoint is stored as a tuple.
Parameters: | scalarastuple – if True, scalar data will be wrapped as a tuple. True => [(0), (1), (2)]; False => [0, 1, 2] |
---|
Bases: object
An abstract forward model that can be plugged into a cost function. Subclasses need to implement getValue(), getGradient(), and possibly getArguments().
Bases: esys.downunder.costfunctions.MeteredCostFunction
Class to define cost function J(m) for inversion with one or more forward models based on a multi-valued level set function m:
J(m) = J_reg(m) + sum_f mu_f * J_f(p)
where J_reg(m) is the regularization and cross gradient component of the cost function applied to a level set function m, J_f(p) are the data defect cost functions involving a physical forward model using the physical parameter(s) p and mu_f is the trade-off factor for model f.
A forward model depends on a set of physical parameters p which are constructed from components of the level set function m via mappings.
m0=Mapping() m1=Mapping() f0=ForwardModel() f1=ForwardModel()
J=InversionCostFunction(Regularization(), mappings=[m0, m1], forward_models=[(f0, 0), (f1,1)])
m0=Mapping() m1=Mapping() f0=ForwardModel() f1=ForwardModel()
J=InversionCostFunction(Regularization(numLevelSets=2), mappings=[(m0,0), (m1,0)], forward_models=[(f0, 0), (f1,1)])
Variables: | provides_inverse_Hessian_approximation – if true the class provides an approximative inverse of the Hessian operator. |
---|
returns an instance of an object used to represent a level set function initialized with zeros. Components can be overwritten by physical properties props. If present entries must correspond to the mappings arguments in the constructor. Use None for properties for which no value is given.
returns precalculated values that are shared in the calculation of f(x) and grad f(x) and the Hessian operator
Parameters: | x (x-type) – location of derivative |
---|
returns the domain of the cost function :rtype: ‘Domain`
returns the dual product of x and r
Return type: | float |
---|
returns the idx-th forward model.
Parameters: | idx (int) – model index. If cost function contains one model only idx can be omitted. |
---|
returns the gradient of f at x using the precalculated values for x.
Parameters: |
|
---|---|
Return type: | r-type |
returns an approximative evaluation p of the inverse of the Hessian operator of the cost function for a given gradient r at a given location x: H(x) p = r
Parameters: |
|
---|---|
Return type: | x-type |
Note : | In general it is assumed that the Hessian H(x) needs to be calculate in each call for a new location x. However, the solver may suggest that this is not required, typically when the iteration is close to completeness. |
returns the norm of x
Return type: | float |
---|
returns the number of trade-off factors being used including the trade-off factors used in the regularization component.
Return type: | int |
---|
returns a list of the physical properties from a given level set function m using the mappings of the cost function.
Parameters: |
|
---|---|
Return type: | list of Data |
returns the regularization
Return type: | Regularization |
---|
returns a list of the trade-off factors.
Return type: | list of float |
---|
returns the trade-off factors for the forward models
Return type: | float or list of float |
---|
returns the value f(x) using the precalculated values for x.
Parameters: | x (x-type) – a solution approximation |
---|---|
Return type: | float |
resets all statistical counters
sets the trade-off factors for the forward model and regularization terms.
Parameters: | mu (list of float) – list of trade-off factors. |
---|
sets the trade-off factors for the forward model components.
Parameters: | mu (float in case of a single model or a list of float with the length of the number of models.) – list of the trade-off factors. If not present ones are used. |
---|
sets the trade-off factors for the regularization component of the cost function, see Regularization for details.
Parameters: |
|
---|
notifies the class that the Hessian operator needs to be updated.
Bases: object
An abstract mapping class to map level set functions m to physical parameters p.
returns the value for the derivative of the mapping for m
returns the value of the inverse of the mapping for physical parameter p
returns a typical value for the derivative
returns the value of the mapping for m
Bases: esys.downunder.costfunctions.CostFunction
This an intrumented version of the CostFunction class. The function calls update statistical information. The actual work is done by the methods with corresponding name and a leading underscore. These functions need to be overwritten for a particular cost function implementation.
returns precalculated values that are shared in the calculation of f(x) and grad f(x) and the Hessian operator
Parameters: | x (x-type) – location of derivative |
---|
returns the dual product of x and r
Return type: | float |
---|
returns the gradient of f at x using the precalculated values for x.
Parameters: |
|
---|---|
Return type: | r-type |
returns an approximative evaluation p of the inverse of the Hessian operator of the cost function for a given gradient r at a given location x: H(x) p = r
Parameters: |
|
---|---|
Return type: | x-type |
Note : | In general it is assumed that the Hessian H(x) needs to be calculate in each call for a new location x. However, the solver may suggest that this is not required, typically when the iteration is close to completeness. |
returns the norm of x
Return type: | float |
---|
returns the value f(x) using the precalculated values for x.
Parameters: | x (x-type) – a solution approximation |
---|---|
Return type: | float |
resets all statistical counters
notifies the class that the Hessian operator needs to be updated. This method is called by the solver class.