Bases: object
Base class for function minimization methods.
return the cost function to be minimized
Return type: | CostFunction |
---|
Returns a dictionary of minimizer-specific options.
Returns the result of the minimization.
Outputs a summary of the completed minimization process to the logger.
Executes the minimization algorithm for f starting with the initial guess x0.
Returns: | the result of the minimization |
---|
Sets a callback function to be called after every iteration. The arguments to the function are: (k, x, Jx, g_Jxx), where k is the current iteration, x is the current estimate, Jx=f(x) and g_Jxx=grad f(x).
set the cost function to be minimized
Parameters: | J (CostFunction) – the cost function to be minimized |
---|
Sets the maximum number of iterations before the minimizer terminates.
Sets minimizer-specific options. For a list of possible options see getOptions().
Sets the tolerance for the stopping criterion. The minimizer stops when an appropriate norm is less than m_tol.
Bases: esys.downunder.mappings.Mapping
Maps an unbounded parameter to a bounded range. The mapping is smooth and continuous.
returns the value for the derivative of the mapping for m
returns the value of the inverse of the mapping for s
returns a typical value for the derivative
returns the value of the mapping for m
Bases: esys.downunder.coordinates.ReferenceSystem
Identifies the Cartesian coordinate system
creates an appropriate coordinate transformation on a given domain
Parameters: | domain (esys.escript.AbstractDomain) – domain of transformation |
---|---|
Return type: | SpatialCoordinateTransformation |
returns the name of the reference system
returns if the reference system is Cartesian
Return type: | bool |
---|
test if argument other defines the same reference system
Parameters: | other (ReferenceSystem) – a second reference system |
---|---|
Returns: | True if other is a CartesianReferenceSystem instance. |
Return type: | bool |
Note : | every two CartesianReferenceSystem instances are considered as being the same. |
Bases: object
A function f(x) that can be minimized (base class).
Example of usage:
cf=DerivedCostFunction()
# ... calculate x ...
args=cf.getArguments(x) # this could be potentially expensive!
f=cf.getValue(x, *args)
# ... it could be required to update x without using the gradient...
# ... but then ...
gf=cf.getGradient(x, *args)
The class distinguishes between the representation of the solution x (x-type) and the gradients (r-type).
Variables: | provides_inverse_Hessian_approximation – This member should be set to True in subclasses that provide a valid implementation of getInverseHessianApproximation() |
---|
returns precalculated values that are shared in the calculation of f(x) and grad f(x) and the Hessian operator. The default implementation returns an empty tuple.
Note
The tuple returned by this call will be passed back to this CostFunction in other calls(eg: getGradient). Its contents are not specified at this level because no code, other than the CostFunction which created it, will be interacting with it. That is, the implementor can put whatever information they find useful in it.
Parameters: | x (x-type) – location of derivative |
---|---|
Return type: | tuple |
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 calculated 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. |
Note : | Subclasses that implement this method should set the class variable provides_inverse_Hessian_approximation to True to enable the solver to call this method. |
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 |
notifies the class that the Hessian operator needs to be updated. This method is called by the solver class.
Bases: object
A class that provides survey data for the inversion process. This is an abstract base class that implements common functionality. Methods to be overwritten by subclasses are marked as such. This class assumes 2D data which is mapped to a slice of a 3D domain. For other setups override the methods as required.
returns a tuple of tuples ( (x0, y0), (nx, ny), (dx, dy) ), where
This method must be implemented in subclasses.
Returns the type of survey data managed by this source. Subclasses must return GRAVITY or MAGNETIC as appropriate.
returns the reference coordinate system
Return type: | ReferenceSystem |
---|
Returns the subsampling factor that was set via setSubsamplingFactor (see there).
This method is called by the DomainBuilder to retrieve the survey data as Data objects on the given domain.
Subclasses should return one or more Data objects with survey data interpolated on the given escript domain. The exact return type depends on the type of data.
Parameters: |
|
---|
All data source coordinates are converted to UTM (Universal Transverse Mercator) in order to have useful domain extents. Subclasses should implement this method and return the UTM zone number of the projected coordinates.
Sets the data subsampling factor (default=1).
The factor is applied in all dimensions. For example a 2D dataset with 300 x 150 data points will be reduced to 150 x 75 when a subsampling factor of 2 is used. This becomes important when adding data of varying resolution to a DomainBuilder.
Bases: esys.downunder.mappings.LinearMapping
Density mapping with depth weighting
rho = rho0 + drho * ( (x_2 - z0)/l_z)^(beta/2) ) * m
returns the value for the derivative of the mapping for m
returns the value of the inverse of the mapping for s
returns a typical value for the derivative
returns the value of the mapping for m
Bases: object
This class is responsible for constructing an escript Domain object with suitable extents and resolution for survey data (DataSource objects) that are added to it.
The domain covers a region above and below the Earth surface. The East-West direction is used as the x- or longitudinal or x[0] direction, the North-South direction is used as the y- or latitudinal or x[1] direction, the vertical direction is denoted by z or radial or x[2] direction. The corresponding terms are used synonymously.
Adds a survey data provider to the domain builder. An exception is raised if the domain has already been built or if the UTM zone of source does not match the UTM zone of sources already added to the domain builder (see Inversion Cookbook for more information). An exception is also raised if the dimensionality of the data source is incompatible with this domain builder. That is, the dimensionality of the data must be one less than the dimensionality of the domain (specified in the constructor).
Parameters: | source (DataSource) – The data source to be added. Its reference system needs to match the reference system of the DomainBuilder. |
---|
Defines the depth below which the density anomaly is set to a given value. If no value is given zero is assumed.
Parameters: | depth (float) – depth below which the density is fixed. If not set, no constraint at depth is applied. |
---|
Defines the depth below which the susceptibility anomaly is set to a given value. If no value is given zero is assumed.
Parameters: | depth (float) – depth below which the susceptibility is fixed. If not set, no constraint at depth is applied. |
---|
Returns the background magnetic flux density.
Returns a domain that spans the data area plus padding.
The domain is created the first time this method is called, subsequent calls return the same domain so anything that affects the domain (such as padding) needs to be set beforehand.
Returns: | The escript domain for this data source |
---|---|
Return type: | esys.escript.Domain |
Returns a list of gravity surveys, see getSurveys for details.
Returns a list of magnetic surveys, see getSurveys for details.
returns the reference coordinate system
Return type: | ReferenceSystem |
---|
Returns the density mask data object which is non-zero for cells whose density value is fixed, zero otherwise.
Returns the susceptibility mask data object which is non-zero for cells whose susceptibility value is fixed, zero otherwise.
Returns a list of Data objects for all surveys of type datatype available to this domain builder.
Returns: | List of surveys which are tuples (anomaly,error). |
---|---|
Return type: | list |
Sets the background magnetic flux density B=(B_East, B_North, B_Vertical)
Sets the amount of padding around the dataset in number of elements (cells).
When the domain is constructed pad_x (pad_y) elements are added on each side of the x- (y-) dimension. The arguments must be non-negative.
Parameters: |
|
---|---|
Note : | pad_y is ignored for 2-dimensional datasets. |
Sets the amount of padding around the dataset as a fraction of the dataset side lengths.
For example, calling setFractionalPadding(0.2, 0.1) with a data source of size 10x20 will result in the padded data set size 14x24 (10*(1+2*0.2), 20*(1+2*0.1))
Parameters: |
|
---|---|
Note : | pad_y is ignored for 2-dimensional domains. |
Sets the amount of padding around the dataset in longitude and latitude.
The final domain size will be the extent in the latitudinal (in longitudinal) direction of the dataset plus twice the value of pad_lat (pad_lon). The arguments must be non-negative.
Parameters: |
|
---|---|
Note : | pad_lon is ignored for 2-dimensional domains. |
Note : | this function can only be used if the reference system is not Cartesian |
Sets the amount of padding around the dataset in absolute length units.
The final domain size will be the length in x (in y) of the dataset plus twice the value of pad_x (pad_y). The arguments must be non-negative.
Parameters: |
|
---|---|
Note : | pad_y is ignored for 2-dimensional domains. |
Note : | this function can only be used if the reference system is Cartesian |
This method sets the target domain parameters for the vertical dimension.
Parameters: |
|
---|
Bases: esys.downunder.datasources.DataSource
Data Source for ER Mapper raster data. Note that this class only accepts a very specific type of ER Mapper data input and will raise an exception if other data is found.
returns ( (x0, y0), (nx, ny), (dx, dy) )
returns the reference coordinate system
Return type: | ReferenceSystem |
---|
Returns the subsampling factor that was set via setSubsamplingFactor (see there).
Sets the data subsampling factor (default=1).
The factor is applied in all dimensions. For example a 2D dataset with 300 x 150 data points will be reduced to 150 x 75 when a subsampling factor of 2 is used. This becomes important when adding data of varying resolution to a DomainBuilder.
Bases: object
An abstract forward model that can be plugged into a cost function. Subclasses need to implement getDefect(), getGradient(), and possibly getArguments() and ‘getCoordinateTransformation’.
Bases: esys.downunder.forwardmodels.ForwardModel
Base class for a forward model using a potential such as magnetic or gravity. It defines a cost function:
defect = 1/2 sum_s integrate( ( weight_i[s] * ( r_i - data_i[s] ) ) ** 2 )
where s runs over the survey, weight_i are weighting factors, data_i are the data, and r_i are the results produced by the forward model. It is assumed that the forward model is produced through postprocessing of the solution of a potential PDE.
returns the coordinate transformation being used
Return type: | CoordinateTransformation |
---|
Returns the domain of the forward model.
Return type: | Domain |
---|
Return the underlying PDE.
Return type: | LinearPDE |
---|
Returns the pair (data_index, weight_index), where data_i is the data of survey i, weight_i is the weighting factor for survey i. If index is None, all surveys will be returned in a pair of lists.
Bases: esys.downunder.coordinates.SpatialCoordinateTransformation
A geodetic coordinate transformation
returns the domain of the coordinate transformation.
Return type: | esys.escript.AbstractDomain |
---|
returns the reference system used to to define the coordinate transformation
Return type: | ReferenceSystem |
---|
returns the scaling factors
Return type: | esys.escript.Vector |
---|
returns the volume factor for the coordinate transformation
Return type: | esys.escript.Scalar |
---|
returns True if the scaling factors (and the volume factor) are equal to 1
Return type: | bool |
---|
test if argument other defines the same coordinate transformation
Parameters: | other (SpatialCoordinateTransformation) – a second coordinate transformation |
---|---|
Returns: | True if other defines then same coordinate transformation |
Return type: | bool |
Bases: esys.downunder.coordinates.ReferenceSystem
Identifies a Geodetic coordinate system
creates an appropriate coordinate transformation on a given domain
Parameters: | domain (esys.escript.AbstractDomain) – domain of transformation |
---|---|
Return type: | SpatialCoordinateTransformation |
returns the angular unit
returns the flattening
returns the height unit
returns the name of the reference system
returns the length of semi major axis
returns the length of semi minor axis
returns if the reference system is Cartesian
Return type: | bool |
---|
test if other defines the same reference system
Parameters: | other (ReferenceSystem) – a second reference system |
---|---|
Returns: | True if other defines then same reference system |
Return type: | bool |
Note
two GeodeticReferenceSystem are considered to be the same if the use the same semi major axis, the same flattening and the same angular unit.
Bases: esys.downunder.inversions.InversionDriver
Driver class to perform an inversion of Gravity (Bouguer) anomaly data. The class uses the standard Regularization class for a single level set function, DensityMapping mapping, and the gravity forward model GravityModel.
indicates to fix the gravity potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True gravity potential at the bottom is set to zero |
---|
indicates to fix the magnetic potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True magnetic potential at the bottom is set to zero |
---|
returns the domain of the inversion
Return type: | ‘InversionCostFunction’ |
---|
returns the domain of the inversion
Return type: | Domain |
---|
returns the level set function as solution of the optimization problem
Return type: | Data |
---|
The solver to be used in the inversion process. See the minimizers module for available solvers. By default, the L-BFGS minimizer is used.
Return type: | ‘AbstractMinimizer’. |
---|
returns True if the inversion is set up and is ready to run.
Return type: | bool |
---|
This function runs the inversion.
Returns: | physical parameters as result of the inversion |
---|---|
Return type: | list of physical parameters or a physical parameter |
sets the cost function of the inversion. This function needs to be called before the inversion iteration can be started.
Parameters: | costfunction (‘InversionCostFunction’) – domain of the inversion |
---|
set the initial guess rho for density the inversion iteration. If no rho present then an appropriate initial guess is chosen.
Parameters: | rho (Scalar) – initial value for the density anomaly. |
---|
Sets the callback function which is called after every solver iteration.
Sets the maximum number of solver iterations to run. If maxiter is reached the iteration is terminated and MinimizerMaxIterReached is thrown.
Parameters: | maxiter (positive int) – maximum number of iteration steps. |
---|
Sets the error tolerance for the solver. An acceptable solution is considered to be found once the tolerance is reached.
Parameters: |
|
---|---|
Note : | if both arguments are equal to None the default setting m_tol=1e-4, J_tol=None is used. |
Sets up the inversion parameters from a DomainBuilder.
Parameters: |
|
---|
callback function that can be used to track the solution
Parameters: |
|
---|
Bases: esys.downunder.forwardmodels.ForwardModelWithPotential
Forward Model for gravity inversion as described in the inversion cookbook.
Returns precomputed values shared by getDefect() and getGradient().
Parameters: | rho (Scalar) – a suggestion for the density distribution |
---|---|
Returns: | gravity potential and corresponding gravity field. |
Return type: | Scalar, Vector |
returns the coordinate transformation being used
Return type: | CoordinateTransformation |
---|
Returns the value of the defect
Parameters: |
|
---|---|
Return type: | float |
Returns the domain of the forward model.
Return type: | Domain |
---|
Returns the gradient of the defect with respect to density.
Parameters: |
|
---|---|
Return type: | Scalar |
Return the underlying PDE.
Return type: | LinearPDE |
---|
Calculates the gravity potential for a given density distribution.
Parameters: | rho (Scalar) – a suggestion for the density distribution |
---|---|
Returns: | gravity potential |
Return type: | Scalar |
Returns the pair (data_index, weight_index), where data_i is the data of survey i, weight_i is the weighting factor for survey i. If index is None, all surveys will be returned in a pair of lists.
rescales the weights such that
sum_s integrate( ( w_i[s] *g_i[s]) (w_j[s]*1/L_j) * L**2 * 4*pi*G*rho_scale )=scale
Parameters: |
|
---|
Bases: esys.downunder.seismic.WaveBase
Solving the HTI wave equation (along the x_0 axis)
Note : | In case of a two dimensional domain a horizontal domain is considered, i.e. the depth component is dropped. |
---|
returns the solution for the next time marker t which needs to greater than the time marker from the previous call.
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
Note
The tuple returned by this call will be passed back to this CostFunction in other calls(eg: getGradient). Its contents are not specified at this level because no code, other than the CostFunction which created it, will be interacting with it. That is, the implementor can put whatever information they find useful in it.
Parameters: | x (x-type) – location of derivative |
---|---|
Return type: | tuple |
returns the domain of the cost function
Return type: | 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
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.
Parameters: |
|
---|---|
Return type: | x-type |
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
Base class for running an inversion
indicates to fix the gravity potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True gravity potential at the bottom is set to zero |
---|
indicates to fix the magnetic potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True magnetic potential at the bottom is set to zero |
---|
returns the domain of the inversion
Return type: | ‘InversionCostFunction’ |
---|
returns the domain of the inversion
Return type: | Domain |
---|
returns the level set function as solution of the optimization problem
Return type: | Data |
---|
The solver to be used in the inversion process. See the minimizers module for available solvers. By default, the L-BFGS minimizer is used.
Return type: | ‘AbstractMinimizer’. |
---|
returns True if the inversion is set up and is ready to run.
Return type: | bool |
---|
This function runs the inversion.
Returns: | physical parameters as result of the inversion |
---|---|
Return type: | list of physical parameters or a physical parameter |
sets the cost function of the inversion. This function needs to be called before the inversion iteration can be started.
Parameters: | costfunction (‘InversionCostFunction’) – domain of the inversion |
---|
Sets the initial guess for the inversion iteration. By default zero is used.
Sets the callback function which is called after every solver iteration.
Sets the maximum number of solver iterations to run. If maxiter is reached the iteration is terminated and MinimizerMaxIterReached is thrown.
Parameters: | maxiter (positive int) – maximum number of iteration steps. |
---|
Sets the error tolerance for the solver. An acceptable solution is considered to be found once the tolerance is reached.
Parameters: |
|
---|---|
Note : | if both arguments are equal to None the default setting m_tol=1e-4, J_tol=None is used. |
returns True if the inversion is set up and ready to run.
Bases: esys.downunder.inversions.InversionDriver
Driver class to perform a joint inversion of Gravity (Bouguer) and magnetic anomaly data. The class uses the standard Regularization class for two level set functions with cross-gradient correlation, DensityMapping and SusceptibilityMapping mappings, the gravity forward model GravityModel and the linear magnetic forward model MagneticModel.
indicates to fix the gravity potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True gravity potential at the bottom is set to zero |
---|
indicates to fix the magnetic potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True magnetic potential at the bottom is set to zero |
---|
returns the domain of the inversion
Return type: | ‘InversionCostFunction’ |
---|
returns the domain of the inversion
Return type: | Domain |
---|
returns the level set function as solution of the optimization problem
Return type: | Data |
---|
The solver to be used in the inversion process. See the minimizers module for available solvers. By default, the L-BFGS minimizer is used.
Return type: | ‘AbstractMinimizer’. |
---|
returns True if the inversion is set up and is ready to run.
Return type: | bool |
---|
This function runs the inversion.
Returns: | physical parameters as result of the inversion |
---|---|
Return type: | list of physical parameters or a physical parameter |
sets the cost function of the inversion. This function needs to be called before the inversion iteration can be started.
Parameters: | costfunction (‘InversionCostFunction’) – domain of the inversion |
---|
set the initial guess rho for density and k for susceptibility for the inversion iteration.
Parameters: |
|
---|
Sets the callback function which is called after every solver iteration.
Sets the maximum number of solver iterations to run. If maxiter is reached the iteration is terminated and MinimizerMaxIterReached is thrown.
Parameters: | maxiter (positive int) – maximum number of iteration steps. |
---|
Sets the error tolerance for the solver. An acceptable solution is considered to be found once the tolerance is reached.
Parameters: |
|
---|---|
Note : | if both arguments are equal to None the default setting m_tol=1e-4, J_tol=None is used. |
Sets up the inversion from an instance domainbuilder of a DomainBuilder. Gravity and magnetic data attached to the domainbuilder are considered in the inversion. If magnetic data are given as scalar it is assumed that values are collected in direction of the background magnetic field.
Parameters: |
|
---|
callback function that can be used to track the solution
Parameters: |
|
---|
Bases: esys.downunder.mappings.Mapping
Maps a parameter by a linear transformation p = a * m + p0
returns the value for the derivative of the mapping for m
returns the value of the inverse of the mapping for s
returns a typical value for the derivative
returns the value of the mapping for m
Bases: esys.downunder.inversions.InversionDriver
Driver class to perform an inversion of magnetic anomaly data. The class uses the standard Regularization class for a single level set function, SusceptibilityMapping mapping and the linear magnetic forward model MagneticModel.
indicates to fix the gravity potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True gravity potential at the bottom is set to zero |
---|
indicates to fix the magnetic potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True magnetic potential at the bottom is set to zero |
---|
returns the domain of the inversion
Return type: | ‘InversionCostFunction’ |
---|
returns the domain of the inversion
Return type: | Domain |
---|
returns the level set function as solution of the optimization problem
Return type: | Data |
---|
The solver to be used in the inversion process. See the minimizers module for available solvers. By default, the L-BFGS minimizer is used.
Return type: | ‘AbstractMinimizer’. |
---|
returns True if the inversion is set up and is ready to run.
Return type: | bool |
---|
This function runs the inversion.
Returns: | physical parameters as result of the inversion |
---|---|
Return type: | list of physical parameters or a physical parameter |
sets the cost function of the inversion. This function needs to be called before the inversion iteration can be started.
Parameters: | costfunction (‘InversionCostFunction’) – domain of the inversion |
---|
set the initial guess k for susceptibility for the inversion iteration. If no k present then an appropriate initial guess is chosen.
Parameters: | k (Scalar) – initial value for the susceptibility anomaly. |
---|
Sets the callback function which is called after every solver iteration.
Sets the maximum number of solver iterations to run. If maxiter is reached the iteration is terminated and MinimizerMaxIterReached is thrown.
Parameters: | maxiter (positive int) – maximum number of iteration steps. |
---|
Sets the error tolerance for the solver. An acceptable solution is considered to be found once the tolerance is reached.
Parameters: |
|
---|---|
Note : | if both arguments are equal to None the default setting m_tol=1e-4, J_tol=None is used. |
Sets up the inversion from a DomainBuilder. If magnetic data are given as scalar it is assumed that values are collected in direction of the background magnetic field.
Parameters: |
|
---|
callback function that can be used to track the solution
Parameters: |
|
---|
Bases: esys.downunder.forwardmodels.ForwardModelWithPotential
Forward Model for magnetic inversion as described in the inversion cookbook.
Returns precomputed values shared by getDefect() and getGradient().
Parameters: | k (Scalar) – susceptibility |
---|---|
Returns: | scalar magnetic potential and corresponding magnetic field |
Return type: | Scalar, Vector |
returns the coordinate transformation being used
Return type: | CoordinateTransformation |
---|
Returns the value of the defect.
Parameters: |
|
---|---|
Return type: | float |
Returns the domain of the forward model.
Return type: | Domain |
---|
Returns the gradient of the defect with respect to susceptibility.
Parameters: |
|
---|---|
Return type: | Scalar |
Return the underlying PDE.
Return type: | LinearPDE |
---|
Calculates the magnetic potential for a given susceptibility.
Parameters: | k (Scalar) – susceptibility |
---|---|
Returns: | magnetic potential |
Return type: | Scalar |
Returns the pair (data_index, weight_index), where data_i is the data of survey i, weight_i is the weighting factor for survey i. If index is None, all surveys will be returned in a pair of lists.
rescales the weights such that
sum_s integrate( ( w_i[s] *B_i[s]) (w_j[s]*1/L_j) * L**2 * (background_magnetic_flux_density_j[s]*1/L_j) * k_scale )=scale
Parameters: |
|
---|
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
Note
The tuple returned by this call will be passed back to this CostFunction in other calls(eg: getGradient). Its contents are not specified at this level because no code, other than the CostFunction which created it, will be interacting with it. That is, the implementor can put whatever information they find useful in it.
Parameters: | x (x-type) – location of derivative |
---|---|
Return type: | tuple |
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
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.
Parameters: |
|
---|---|
Return type: | x-type |
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.
Bases: esys.downunder.minimizers.AbstractMinimizer
Minimizer that uses the Broyden-Fletcher-Goldfarb-Shanno method.
return the cost function to be minimized
Return type: | CostFunction |
---|
Returns the result of the minimization.
Outputs a summary of the completed minimization process to the logger.
Sets a callback function to be called after every iteration. The arguments to the function are: (k, x, Jx, g_Jxx), where k is the current iteration, x is the current estimate, Jx=f(x) and g_Jxx=grad f(x).
set the cost function to be minimized
Parameters: | J (CostFunction) – the cost function to be minimized |
---|
Sets the maximum number of iterations before the minimizer terminates.
Sets the tolerance for the stopping criterion. The minimizer stops when an appropriate norm is less than m_tol.
Bases: exceptions.Exception
This is a generic exception thrown by a minimizer.
Bases: esys.downunder.minimizers.MinimizerException
Exception thrown if the iteration scheme encountered an incurable breakdown.
Bases: esys.downunder.minimizers.AbstractMinimizer
Minimizer that uses the limited-memory Broyden-Fletcher-Goldfarb-Shanno method.
return the cost function to be minimized
Return type: | CostFunction |
---|
Returns the result of the minimization.
Outputs a summary of the completed minimization process to the logger.
Parameters: | x (Data) – Level set function representing our initial guess |
---|---|
Returns: | Level set function representing the solution |
Return type: | Data |
Sets a callback function to be called after every iteration. The arguments to the function are: (k, x, Jx, g_Jxx), where k is the current iteration, x is the current estimate, Jx=f(x) and g_Jxx=grad f(x).
set the cost function to be minimized
Parameters: | J (CostFunction) – the cost function to be minimized |
---|
Sets the maximum number of iterations before the minimizer terminates.
Sets the tolerance for the stopping criterion. The minimizer stops when an appropriate norm is less than m_tol.
Bases: esys.downunder.minimizers.MinimizerException
Exception thrown if the maximum number of iteration steps is reached.
Bases: esys.downunder.minimizers.AbstractMinimizer
Minimizer that uses the nonlinear conjugate gradient method (Fletcher-Reeves variant).
return the cost function to be minimized
Return type: | CostFunction |
---|
Returns a dictionary of minimizer-specific options.
Returns the result of the minimization.
Outputs a summary of the completed minimization process to the logger.
Sets a callback function to be called after every iteration. The arguments to the function are: (k, x, Jx, g_Jxx), where k is the current iteration, x is the current estimate, Jx=f(x) and g_Jxx=grad f(x).
set the cost function to be minimized
Parameters: | J (CostFunction) – the cost function to be minimized |
---|
Sets the maximum number of iterations before the minimizer terminates.
Sets minimizer-specific options. For a list of possible options see getOptions().
Sets the tolerance for the stopping criterion. The minimizer stops when an appropriate norm is less than m_tol.
Bases: esys.downunder.datasources.DataSource
returns the reference coordinate system
Return type: | ReferenceSystem |
---|
Returns the subsampling factor that was set via setSubsamplingFactor (see there).
returns a dummy UTM zone since this class does not use real coordinate values.
Sets the data subsampling factor (default=1).
The factor is applied in all dimensions. For example a 2D dataset with 300 x 150 data points will be reduced to 150 x 75 when a subsampling factor of 2 is used. This becomes important when adding data of varying resolution to a DomainBuilder.
Bases: object
Generic identifier for coordinate systems.
creates an appropriate coordinate transformation on a given domain
Note
needs to be overwritten by a particular reference system
Parameters: | domain (esys.escript.AbstractDomain) – domain of transformation |
---|---|
Return type: | SpatialCoordinateTransformation |
returns the name of the reference system
returns if the reference system is Cartesian
Note
needs to be overwritten by a particular reference system
Return type: | bool |
---|
test if argument other defines the same reference system
Parameters: | other (ReferenceSystem) – a second reference system |
---|---|
Returns: | True if other defines the same reference system |
Return type: | bool |
Note
needs to be overwritten by a particular reference system
Bases: esys.downunder.costfunctions.CostFunction
The regularization term for the level set function m within the cost function J for an inversion:
J(m)=1/2 * sum_k integrate( mu[k] * ( w0[k] * m_k**2 * w1[k,i] * m_{k,i}**2) + sum_l<k mu_c[l,k] wc[l,k] * | curl(m_k) x curl(m_l) |^2
where w0[k], w1[k,i] and wc[k,l] are non-negative weighting factors and mu[k] and mu_c[l,k] are trade-off factors which may be altered during the inversion. The weighting factors are normalized such that their integrals over the domain are constant:
integrate(w0[k] + inner(w1[k,:],1/L[:]**2))=scale[k] volume(domain)* integrate(wc[l,k]*1/L**4)=scale_c[k] volume(domain) *
returns the coordinate transformation being used
Return type: | CoordinateTransformation |
---|
returns the domain of the regularization term
Return type: | Domain |
---|
returns the dual product of a gradient represented by X=r[1] and Y=r[0] with a level set function m:
Y_i*m_i + X_ij*m_{i,j}
Return type: | float |
---|
returns the gradient of the cost function J with respect to m.
Note : | This implementation returns Y_k=dPsi/dm_k and X_kj=dPsi/dm_kj |
---|
returns the norm of m.
Parameters: | m (Data) – level set function |
---|---|
Return type: | float |
returns the number of level set functions
Return type: | int |
---|
returns the number of trade-off factors being used.
Return type: | int |
---|
returns the linear PDE to be solved for the Hessian Operator inverse
Return type: | LinearPDE |
---|
returns the value of the cost function J with respect to m. This equation is specified in the inversion cookbook.
Return type: | float |
---|
sets the trade-off factors for the level-set variation and the cross-gradient.
Parameters: | mu (list of float or `numpy.array`) – new values for the trade-off factors where values mu[:numLevelSets] are the trade-off factors for the level-set variation and the remaining values for the cross-gradient part with mu_c[l,k]=mu[numLevelSets+l+((k-1)*k)/2] (l<k). If no values for mu are given ones are used. Values must be positive. |
---|
sets the trade-off factors for the cross-gradient terms.
Parameters: | mu_c (float, list of float or numpy.array) – new values for the trade-off factors for the cross-gradient terms. Values must be positive. If no value is given ones are used. Only value mu_c[l,k] for l<k are used. |
---|
sets the trade-off factors for the level-set variation part.
Parameters: | mu (float, list of float or `numpy.array`) – new values for the trade-off factors. Values must be positive. |
---|
notifies the class to recalculate the Hessian operator.
Bases: esys.downunder.seismic.Wavelet
The Ricker Wavelet w=f(t)
get the acceleration f’‘(t) at time t
return value of wavelet center
returns the time scale which is the inverse of the largest freqence with a significant spectral component.
get value of wavelet at time t
Bases: object
as simple writer for 2D and 3D seimic lines in particular for synthetic data
Typical usage:
from esys.escript import unitsSI as U sw=SimpleSEGYWriter([0.,100*U.m,200*U,m,300.], source=200*U.m, sampling_interval=4*U.msec) while n < 10:
sw.addRecord([i*2., i*0.67, i**2, -i*7])sw.write(‘example.segy’)
Note : | the writer uses obspy |
---|
adds a record to the traces. a time difference of sample_interval between two records is assumed. The record mast be a list of as many values as given receivers or a float if a single receiver is used.
Parameters: | record – list of tracks to be added to the record. |
---|
returns the sampling interval in seconds.
writes to segy file
Parameters: | filename – file name |
---|---|
Note : | the function uses the obspy module. |
Bases: esys.downunder.datasources.SourceFeature
A source feature in the form of a blob (roughly gaussian).
Bases: esys.downunder.seismic.WaveBase
Solving the sonic wave equation
p_tt = (v_p**2 * p_i)_i + f(t) * delta_s where (p-) velocity v_p.
f(t) is wavelet acting at a point source term at positon s
returns the solution for the next time marker t which needs to greater than the time marker from the previous call.
Bases: object
Defines an orthogonal coordinate transformation from a domain into the Cartesian domain using a coordinate transformation.
The default implementation is the identity transformation (i.e. no changes are applied to the domain). Overwrite the appropriate methods to define other coordinate systems.
returns the domain of the coordinate transformation.
Return type: | esys.escript.AbstractDomain |
---|
returns the reference system used to to define the coordinate transformation
Return type: | ReferenceSystem |
---|
returns the scaling factors
Return type: | esys.escript.Vector |
---|
returns the volume factor for the coordinate transformation
Return type: | esys.escript.Scalar |
---|
returns True if the scaling factors (and the volume factor) are equal to 1
Return type: | bool |
---|
test if argument other defines the same coordinate transformation
Parameters: | other (SpatialCoordinateTransformation) – a second coordinate transformation |
---|---|
Returns: | True if other defines then same coordinate transformation |
Return type: | bool |
Bases: esys.downunder.inversions.InversionDriver
Driver class to perform a joint inversion of Gravity (Bouguer) and magnetic anomaly date with the assumption that there is a functional relationship between density and susceptibility.
The class uses the standard Regularization class for a single level set function,`DensityMapping` and SusceptibilityMapping mappings, the gravity forward model GravityModel and the linear magnetic forward model MagneticModel.
indicates to fix the gravity potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True gravity potential at the bottom is set to zero |
---|
indicates to fix the magnetic potential at the bottom to zero (in addition to the top)
Parameters: | status (bool) – if True magnetic potential at the bottom is set to zero |
---|
returns the domain of the inversion
Return type: | ‘InversionCostFunction’ |
---|
returns the domain of the inversion
Return type: | Domain |
---|
returns the level set function as solution of the optimization problem
Return type: | Data |
---|
The solver to be used in the inversion process. See the minimizers module for available solvers. By default, the L-BFGS minimizer is used.
Return type: | ‘AbstractMinimizer’. |
---|
returns True if the inversion is set up and is ready to run.
Return type: | bool |
---|
This function runs the inversion.
Returns: | physical parameters as result of the inversion |
---|---|
Return type: | list of physical parameters or a physical parameter |
sets the cost function of the inversion. This function needs to be called before the inversion iteration can be started.
Parameters: | costfunction (‘InversionCostFunction’) – domain of the inversion |
---|
set the initial guess rho for density and k for susceptibility for the inversion iteration.
Parameters: |
|
---|
Sets the callback function which is called after every solver iteration.
Sets the maximum number of solver iterations to run. If maxiter is reached the iteration is terminated and MinimizerMaxIterReached is thrown.
Parameters: | maxiter (positive int) – maximum number of iteration steps. |
---|
Sets the error tolerance for the solver. An acceptable solution is considered to be found once the tolerance is reached.
Parameters: |
|
---|---|
Note : | if both arguments are equal to None the default setting m_tol=1e-4, J_tol=None is used. |
Sets up the inversion from an instance domainbuilder of a DomainBuilder. Gravity and magnetic data attached to the domainbuilder are considered in the inversion. If magnetic data are given as scalar it is assumed that values are collected in direction of the background magnetic field.
Parameters: |
|
---|
callback function that can be used to track the solution
Parameters: |
|
---|
Bases: esys.downunder.mappings.LinearMapping
Susceptibility mapping with depth weighting
k = k0 + dk * ( (x_2 - z0)/l_z)^(beta/2) ) * m
returns the value for the derivative of the mapping for m
returns the value of the inverse of the mapping for s
returns a typical value for the derivative
returns the value of the mapping for m
Bases: esys.downunder.datasources.SyntheticDataBase
Defines synthetic gravity/magnetic data based on harmonic property anomaly
rho = amplitude * sin(n_depth * pi /depth * (z+depth_offset)) * sin(n_length * pi /length * (x - shift) )
for all x and z<=0. For z>0 rho = 0.
returns the lateral data extend of the data set
returns the data type
Returns the reference Data object that was used to generate the gravity/susceptibility anomaly data.
returns the reference coordinate system
Return type: | ReferenceSystem |
---|
Returns the subsampling factor that was set via setSubsamplingFactor (see there).
returns the survey data placed on a given domain.
Parameters: |
|
---|---|
Returns: | observed gravity field or magnetic flux density for each cell in the domain and for each cell an indicator 1/0 if the data are valid or not. |
Return type: | pair of Scalar |
returns a dummy UTM zone since this class does not use real coordinate values.
Sets the data subsampling factor (default=1).
The factor is applied in all dimensions. For example a 2D dataset with 300 x 150 data points will be reduced to 150 x 75 when a subsampling factor of 2 is used. This becomes important when adding data of varying resolution to a DomainBuilder.
Bases: esys.downunder.datasources.DataSource
Base class to define reference data based on a given property distribution (density or susceptibility). Data are collected from a square region of vertical extent length on a grid with number_of_elements cells in each direction.
The synthetic data are constructed by solving the appropriate forward problem. Data can be sampled with an offset from the surface at z=0 or using the entire subsurface region.
returns the lateral data extend of the data set
returns the data type
Returns the reference Data object that was used to generate the gravity/susceptibility anomaly data.
Returns: | the density or susceptibility anomaly used to create the survey data |
---|---|
Note : | it can be assumed that in the first call the domain argument is present so the actual anomaly data can be created. In subsequent calls this may not be true. |
Note : | method needs to be overwritten |
returns the reference coordinate system
Return type: | ReferenceSystem |
---|
Returns the subsampling factor that was set via setSubsamplingFactor (see there).
returns the survey data placed on a given domain.
Parameters: |
|
---|---|
Returns: | observed gravity field or magnetic flux density for each cell in the domain and for each cell an indicator 1/0 if the data are valid or not. |
Return type: | pair of Scalar |
returns a dummy UTM zone since this class does not use real coordinate values.
Sets the data subsampling factor (default=1).
The factor is applied in all dimensions. For example a 2D dataset with 300 x 150 data points will be reduced to 150 x 75 when a subsampling factor of 2 is used. This becomes important when adding data of varying resolution to a DomainBuilder.
Bases: esys.downunder.datasources.SyntheticDataBase
Uses a list of SourceFeature objects to define synthetic anomaly data.
returns the lateral data extend of the data set
returns the data type
Returns the reference Data object that was used to generate the gravity/susceptibility anomaly data.
returns the reference coordinate system
Return type: | ReferenceSystem |
---|
Returns the subsampling factor that was set via setSubsamplingFactor (see there).
returns the survey data placed on a given domain.
Parameters: |
|
---|---|
Returns: | observed gravity field or magnetic flux density for each cell in the domain and for each cell an indicator 1/0 if the data are valid or not. |
Return type: | pair of Scalar |
returns a dummy UTM zone since this class does not use real coordinate values.
Sets the data subsampling factor (default=1).
The factor is applied in all dimensions. For example a 2D dataset with 300 x 150 data points will be reduced to 150 x 75 when a subsampling factor of 2 is used. This becomes important when adding data of varying resolution to a DomainBuilder.
Bases: esys.downunder.seismic.WaveBase
Solving the VTI wave equation
Note : | In case of a two dimensional domain the second spatial dimenion is depth. |
---|
returns the solution for the next time marker t which needs to greater than the time marker from the previous call.
Bases: object
Base for wave propagation using the Verlet scheme.
u_tt = A(t,u), u(t=t0)=u0, u_t(t=t0)=v0
with a given acceleration force as function of time.
a_n=A(t_{n-1}) v_n=v_{n-1} + dt * a_n u_n=u_{n-1} + dt * v_n
returns the solution for the next time marker t which needs to greater than the time marker from the previous call.
returns the GeodeticReferenceSystem for the GRS80 Ellipsoid eg. used by Geocentric Datum of Australia GDA94
returns the GeodeticReferenceSystem of a sphere :param R: sphere radius :type R: positive double
returns the GeodeticReferenceSystem for the WGS84 Ellipsoid
returns a SpatialCoordinateTransformation for the given domain
Parameters: |
|
---|---|
Returns: | the spatial coordinate system for the given domain of the specified reference system coordinates. If coordinates is already spatial coordinate system based on the riven domain coordinates is returned. Otherwise an appropriate spatial coordinate system is created. |
Return type: |