esys.downunder.forwardmodels.dcresistivity Package¶
Forward model for DC Resistivity
Classes¶
-
class
esys.downunder.forwardmodels.dcresistivity.
Data
¶ Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.
-
__init__
((object)arg1) → None¶ __init__( (object)arg1, (object)value [, (object)p2 [, (object)p3 [, (object)p4]]]) -> None
-
copy
((Data)arg1, (Data)other) → None :¶ 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.
- copy( (Data)arg1) -> Data :
- note
In the no argument form, a new object will be returned which is an independent copy of this object.
-
copyWithMask
((Data)arg1, (Data)other, (Data)mask) → None :¶ Selectively copy values from
other
Data
.Datapoints which correspond to positive values inmask
will be copied fromother
-
delay
((Data)arg1) → Data :¶ Convert this object into lazy representation
-
dump
((Data)arg1, (str)fileName) → None :¶ Save the data as a netCDF file
- Parameters
fileName (
string
) –
-
expand
((Data)arg1) → None :¶ Convert the data to expanded representation if it is not expanded already.
-
getDomain
((Data)arg1) → Domain :¶ - Return type
Domain
-
getFunctionSpace
((Data)arg1) → FunctionSpace :¶ - Return type
FunctionSpace
-
getNumberOfDataPoints
((Data)arg1) → int :¶ - Return type
int
- Returns
Number of datapoints in the object
-
getRank
((Data)arg1) → int :¶ - Returns
the number of indices required to address a component of a datapoint
- Return type
positive
int
-
getShape
((Data)arg1) → tuple :¶ Returns the shape of the datapoints in this object as a python tuple. Scalar data has the shape
()
- Return type
tuple
-
getTagNumber
((Data)arg1, (object)dpno) → int :¶ Return tag number for the specified datapoint
- Return type
int
- Parameters
dpno (int) – datapoint number
-
getTupleForDataPoint
((Data)arg1, (object)dataPointNo) → object :¶ - Returns
Value of the specified datapoint
- Return type
tuple
- Parameters
dataPointNo (
int
) – datapoint to access
-
getTupleForGlobalDataPoint
((Data)arg1, (object)procNo, (object)dataPointNo) → object :¶ Get a specific datapoint from a specific process
- Return type
tuple
- Parameters
procNo (positive
int
) – MPI rank of the processdataPointNo (int) – datapoint to access
-
hasInf
((Data)arg1) → bool :¶ Returns return true if data contains +-Inf. [Note that for complex values, hasNaN and hasInf are not mutually exclusive.]
-
hasNaN
((Data)arg1) → bool :¶ Returns return true if data contains NaN. [Note that for complex values, hasNaN and hasInf are not mutually exclusive.]
-
internal_maxGlobalDataPoint
((Data)arg1) → tuple :¶ Please consider using getSupLocator() from pdetools instead.
-
internal_minGlobalDataPoint
((Data)arg1) → tuple :¶ Please consider using getInfLocator() from pdetools instead.
-
interpolate
((Data)arg1, (FunctionSpace)functionspace) → Data :¶ Interpolate this object’s values into a new functionspace.
-
interpolateTable
((Data)arg1, (object)table, (object)Amin, (object)Astep, (Data)B, (object)Bmin, (object)Bstep[, (object)undef=1e+50[, (object)check_boundaries=False]]) → Data :¶ - 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
- 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
interpolateTable( (Data)arg1, (object)table, (object)Amin, (object)Astep [, (object)undef=1e+50 [, (object)check_boundaries=False]]) -> Data
-
isComplex
((Data)arg1) → bool :¶ - Return type
bool
- Returns
True if this
Data
stores complex values.
-
isConstant
((Data)arg1) → bool :¶ - Return type
bool
- Returns
True if this
Data
is an instance ofDataConstant
- Note
This does not mean the data is immutable.
-
isEmpty
((Data)arg1) → bool :¶ Is this object an instance of
DataEmpty
- Return type
bool
- Note
This is not the same thing as asking if the object contains datapoints.
-
isExpanded
((Data)arg1) → bool :¶ - Return type
bool
- Returns
True if this
Data
is expanded.
-
isLazy
((Data)arg1) → bool :¶ - Return type
bool
- Returns
True if this
Data
is lazy.
-
isProtected
((Data)arg1) → bool :¶ Can this instance be modified. :rtype:
bool
-
isReady
((Data)arg1) → bool :¶ - Return type
bool
- Returns
True if this
Data
is not lazy.
-
isTagged
((Data)arg1) → bool :¶ - Return type
bool
- Returns
True if this
Data
is expanded.
-
nonuniformInterpolate
((Data)arg1, (object)in, (object)out, (object)check_boundaries) → Data :¶ 1D interpolation with non equally spaced points
-
nonuniformSlope
((Data)arg1, (object)in, (object)out, (object)check_boundaries) → Data :¶ 1D interpolation of slope with non equally spaced points
-
promote
((Data)arg1) → None¶
-
replaceInf
((Data)arg1, (object)value) → None :¶ Replaces +-Inf values with value. [Note, for complex Data, both real and imaginary components are replaced even if only one part is Inf].
-
replaceNaN
((Data)arg1, (object)value) → None :¶ Replaces NaN values with value. [Note, for complex Data, both real and imaginary components are replaced even if only one part is NaN].
-
resolve
((Data)arg1) → None :¶ Convert the data to non-lazy representation.
-
setProtection
((Data)arg1) → None :¶ Disallow modifications to this data object
- Note
This method does not allow you to undo protection.
-
setTaggedValue
((Data)arg1, (object)tagKey, (object)value) → None :¶ Set the value of tagged Data.
- param tagKey
tag to update
- type tagKey
int
- setTaggedValue( (Data)arg1, (str)name, (object)value) -> None :
- 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
orlist
-
setToZero
((Data)arg1) → None :¶ After this call the object will store values of the same shape as before but all components will be zero.
-
setValueOfDataPoint
((Data)arg1, (object)dataPointNo, (object)value) → None¶ setValueOfDataPoint( (Data)arg1, (object)arg2, (object)arg3) -> None
setValueOfDataPoint( (Data)arg1, (object)arg2, (object)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
orlist
- warning
Use of this operation is discouraged. It prevents some optimisations from operating.
-
tag
((Data)arg1) → None :¶ Convert data to tagged representation if it is not already tagged or expanded
-
toListOfTuples
((Data)arg1[, (object)scalarastuple=False]) → object :¶ 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]
-
-
class
esys.downunder.forwardmodels.dcresistivity.
DcRes
(domain, locator, delphiIn, sampleTags, phiPrimary, sigmaPrimary, w=1.0, coordinates=None, tol=1e-08, saveMemory=True, b=None)¶ Forward Model for DC resistivity, with a given source pair. The cost function is defined as:
- Math
defect = 1/2 (sum_s sum_pq w_pqs * ((phi_sp-phi_sq)-v_pqs)**2
-
__init__
(domain, locator, delphiIn, sampleTags, phiPrimary, sigmaPrimary, w=1.0, coordinates=None, tol=1e-08, saveMemory=True, b=None)¶ setup new forward model
- Parameters
domain – the domain of the model
locator – contains locator to the measurement pairs
sampleTags (list of tuples) – tags of measurement points from which potential differences will be calculated.
phiPrimary (
Scalar
) – primary potential.
- Type
escript domain
- Type
list
ofLocator
- Param
delphiIn: this is v_pq, the potential difference for the current source and a set of measurement pairs. A list of measured potential differences is expected. Note this should be the secondary potential only.
-
getArguments
(sigma)¶ Returns precomputed values shared by
getDefect()
andgetGradient()
.- Parameters
sigma (
Data
of shape (1,)) – conductivity- Returns
phi
- Return type
Data
of shape (1,)
-
getCoordinateTransformation
()¶ returns the coordinate transformation being used
- Return type
CoordinateTransformation
-
getDefect
(sigma, phi, loc_phi)¶ Returns the defect value.
- Parameters
sigma (
Data
of shape (1,)) – a suggestion for conductivityphi (
Data
of shape (1,)) – potential field
- Return type
float
-
getDomain
()¶ Returns the domain of the forward model.
- Return type
Domain
-
getGradient
(sigma, phi, loc_phi)¶ Returns the gradient of the defect with respect to density.
- Parameters
sigma (
Data
of shape (1,)) – a suggestison for conductivityphi (
Data
of shape (1,)) – potential field
-
class
esys.downunder.forwardmodels.dcresistivity.
FileWriter
(fn, append=False, createLocalFiles=False)¶ Interface to write data to a file. In essence this class wrappes the standard
file
object to write data that are global in MPI to a file. In fact, data are writen on the processor with MPI rank 0 only. It is recommended to useFileWriter
rather thanopen
in order to write code that is running with as well as with MPI. It is safe to useopen
onder MPI to read data which are global under MPI.- Variables
name – name of file
mode – access mode (=’w’ or =’a’)
closed – True to indicate closed file
newlines – line seperator
-
__init__
(fn, append=False, createLocalFiles=False)¶ Opens a file of name
fn
for writing. If running under MPI only the first processor with rank==0 will open the file and write to it. IfcreateLocalFiles
each individual processor will create a file where for any processor with rank>0 the file name is extended by its rank. This option is normally only used for debug purposes.- Parameters
fn (
str
) – filename.append (
bool
) – switches on the creation of local files.createLocalFiles (
bool
) – switches on the creation of local files.
-
close
()¶ Closes the file
-
flush
()¶ Flush the internal I/O buffer.
-
write
(txt)¶ Write string
txt
to file.- Parameters
txt (
str
) – stringtxt
to be written to file
-
writelines
(txts)¶ Write the list
txt
of strings to the file.- Parameters
txts (any iterable object producing strings) – sequense of strings to be written to file
- Note
Note that newlines are not added. This method is equivalent to call write() for each string.
-
class
esys.downunder.forwardmodels.dcresistivity.
ForwardModel
¶ An abstract forward model that can be plugged into a cost function. Subclasses need to implement
getDefect()
,getGradient()
, and possiblygetArguments()
and ‘getCoordinateTransformation’.-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
getArguments
(x)¶
-
getCoordinateTransformation
()¶
-
getDefect
(x, *args)¶
-
getGradient
(x, *args)¶
-
-
class
esys.downunder.forwardmodels.dcresistivity.
LinearPDE
(domain, numEquations=None, numSolutions=None, isComplex=False, debug=False)¶ This class is used to define a general linear, steady, second order PDE for an unknown function u on a given domain defined through a
Domain
object.For a single PDE having a solution with a single component the linear PDE is defined in the following form:
-(grad(A[j,l]+A_reduced[j,l])*grad(u)[l]+(B[j]+B_reduced[j])u)[j]+(C[l]+C_reduced[l])*grad(u)[l]+(D+D_reduced)=-grad(X+X_reduced)[j,j]+(Y+Y_reduced)
where grad(F) denotes the spatial derivative of F. Einstein’s summation convention, ie. summation over indexes appearing twice in a term of a sum performed, is used. The coefficients A, B, C, D, X and Y have to be specified through
Data
objects inFunction
and the coefficients A_reduced, B_reduced, C_reduced, D_reduced, X_reduced and Y_reduced have to be specified throughData
objects inReducedFunction
. It is also allowed to use objects that can be converted into suchData
objects. A and A_reduced are rank two, B, C, X, B_reduced, C_reduced and X_reduced are rank one and D, D_reduced, Y and Y_reduced are scalar.The following natural boundary conditions are considered:
n[j]*((A[i,j]+A_reduced[i,j])*grad(u)[l]+(B+B_reduced)[j]*u)+(d+d_reduced)*u=n[j]*(X[j]+X_reduced[j])+y
where n is the outer normal field. Notice that the coefficients A, A_reduced, B, B_reduced, X and X_reduced are defined in the PDE. The coefficients d and y are each a scalar in
FunctionOnBoundary
and the coefficients d_reduced and y_reduced are each a scalar inReducedFunctionOnBoundary
.Constraints for the solution prescribe the value of the solution at certain locations in the domain. They have the form
u=r where q>0
r and q are each scalar where q is the characteristic function defining where the constraint is applied. The constraints override any other condition set by the PDE or the boundary condition.
The PDE is symmetrical if
A[i,j]=A[j,i] and B[j]=C[j] and A_reduced[i,j]=A_reduced[j,i] and B_reduced[j]=C_reduced[j]
For a system of PDEs and a solution with several components the PDE has the form
-grad((A[i,j,k,l]+A_reduced[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k])[j]+(C[i,k,l]+C_reduced[i,k,l])*grad(u[k])[l]+(D[i,k]+D_reduced[i,k]*u[k] =-grad(X[i,j]+X_reduced[i,j])[j]+Y[i]+Y_reduced[i]
A and A_reduced are of rank four, B, B_reduced, C and C_reduced are each of rank three, D, D_reduced, X_reduced and X are each of rank two and Y and Y_reduced are of rank one. The natural boundary conditions take the form:
n[j]*((A[i,j,k,l]+A_reduced[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k])+(d[i,k]+d_reduced[i,k])*u[k]=n[j]*(X[i,j]+X_reduced[i,j])+y[i]+y_reduced[i]
The coefficient d is of rank two and y is of rank one both in
FunctionOnBoundary
. The coefficients d_reduced is of rank two and y_reduced is of rank one both inReducedFunctionOnBoundary
.Constraints take the form
u[i]=r[i] where q[i]>0
r and q are each rank one. Notice that at some locations not necessarily all components must have a constraint.
The system of PDEs is symmetrical if
A[i,j,k,l]=A[k,l,i,j]
A_reduced[i,j,k,l]=A_reduced[k,l,i,j]
B[i,j,k]=C[k,i,j]
B_reduced[i,j,k]=C_reduced[k,i,j]
D[i,k]=D[i,k]
D_reduced[i,k]=D_reduced[i,k]
d[i,k]=d[k,i]
d_reduced[i,k]=d_reduced[k,i]
LinearPDE
also supports solution discontinuities over a contact region in the domain. To specify the conditions across the discontinuity we are using the generalised flux J which, in the case of a system of PDEs and several components of the solution, is defined asJ[i,j]=(A[i,j,k,l]+A_reduced[[i,j,k,l])*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])*u[k]-X[i,j]-X_reduced[i,j]
For the case of single solution component and single PDE J is defined as
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[j]+(B[i]+B_reduced[i])*u-X[i]-X_reduced[i]
In the context of discontinuities n denotes the normal on the discontinuity pointing from side 0 towards side 1 calculated from
FunctionSpace.getNormal
ofFunctionOnContactZero
. For a system of PDEs the contact condition takes the formn[j]*J0[i,j]=n[j]*J1[i,j]=(y_contact[i]+y_contact_reduced[i])- (d_contact[i,k]+d_contact_reduced[i,k])*jump(u)[k]
where J0 and J1 are the fluxes on side 0 and side 1 of the discontinuity, respectively. jump(u), which is the difference of the solution at side 1 and at side 0, denotes the jump of u across discontinuity along the normal calculated by
jump
. The coefficient d_contact is of rank two and y_contact is of rank one both inFunctionOnContactZero
orFunctionOnContactOne
. The coefficient d_contact_reduced is of rank two and y_contact_reduced is of rank one both inReducedFunctionOnContactZero
orReducedFunctionOnContactOne
. In case of a single PDE and a single component solution the contact condition takes the formn[j]*J0_{j}=n[j]*J1_{j}=(y_contact+y_contact_reduced)-(d_contact+y_contact_reduced)*jump(u)
In this case the coefficient d_contact and y_contact are each scalar both in
FunctionOnContactZero
orFunctionOnContactOne
and the coefficient d_contact_reduced and y_contact_reduced are each scalar both inReducedFunctionOnContactZero
orReducedFunctionOnContactOne
.Typical usage:
p = LinearPDE(dom) p.setValue(A=kronecker(dom), D=1, Y=0.5) u = p.getSolution()
-
__init__
(domain, numEquations=None, numSolutions=None, isComplex=False, debug=False)¶ Initializes a new linear PDE.
- Parameters
domain (
Domain
) – domain of the PDEnumEquations – number of equations. If
None
the number of equations is extracted from the PDE coefficients.numSolutions – number of solution components. If
None
the number of solution components is extracted from the PDE coefficients.debug – if True debug information is printed
-
checkSymmetry
(verbose=True)¶ Tests the PDE for symmetry.
- Parameters
verbose (
bool
) – if set to True or not present a report on coefficients which break the symmetry is printed.- Returns
True if the PDE is symmetric
- Return type
bool
- Note
This is a very expensive operation. It should be used for degugging only! The symmetry flag is not altered.
-
createOperator
()¶ Returns an instance of a new operator.
-
getFlux
(u=None)¶ Returns the flux J for a given u.
J[i,j]=(A[i,j,k,l]+A_reduced[A[i,j,k,l]]*grad(u[k])[l]+(B[i,j,k]+B_reduced[i,j,k])u[k]-X[i,j]-X_reduced[i,j]
or
J[j]=(A[i,j]+A_reduced[i,j])*grad(u)[l]+(B[j]+B_reduced[j])u-X[j]-X_reduced[j]
-
getRequiredOperatorType
()¶ Returns the system type which needs to be used by the current set up.
-
getResidual
(u=None)¶ Returns the residual of u or the current solution if u is not present.
-
getSystem
()¶ Returns the operator and right hand side of the PDE.
- Returns
the discrete version of the PDE
- Return type
tuple
ofOperator
andData
-
insertConstraint
(rhs_only=False)¶ Applies the constraints defined by q and r to the PDE.
- Parameters
rhs_only (
bool
) – if True only the right hand side is altered by the constraint
-
setValue
(**coefficients)¶ Sets new values to coefficients.
- Parameters
coefficients – new values assigned to coefficients
A (any type that can be cast to a
Data
object onFunction
) – value for coefficientA
A_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientA_reduced
B (any type that can be cast to a
Data
object onFunction
) – value for coefficientB
B_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientB_reduced
C (any type that can be cast to a
Data
object onFunction
) – value for coefficientC
C_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientC_reduced
D (any type that can be cast to a
Data
object onFunction
) – value for coefficientD
D_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientD_reduced
X (any type that can be cast to a
Data
object onFunction
) – value for coefficientX
X_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientX_reduced
Y (any type that can be cast to a
Data
object onFunction
) – value for coefficientY
Y_reduced (any type that can be cast to a
Data
object onReducedFunction
) – value for coefficientY_reduced
d (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficientd
d_reduced (any type that can be cast to a
Data
object onReducedFunctionOnBoundary
) – value for coefficientd_reduced
y (any type that can be cast to a
Data
object onFunctionOnBoundary
) – value for coefficienty
d_contact (any type that can be cast to a
Data
object onFunctionOnContactOne
orFunctionOnContactZero
) – value for coefficientd_contact
d_contact_reduced (any type that can be cast to a
Data
object onReducedFunctionOnContactOne
orReducedFunctionOnContactZero
) – value for coefficientd_contact_reduced
y_contact (any type that can be cast to a
Data
object onFunctionOnContactOne
orFunctionOnContactZero
) – value for coefficienty_contact
y_contact_reduced (any type that can be cast to a
Data
object onReducedFunctionOnContactOne
orReducedFunctionOnContactZero
) – value for coefficienty_contact_reduced
d_dirac (any type that can be cast to a
Data
object onDiracDeltaFunctions
) – value for coefficientd_dirac
y_dirac (any type that can be cast to a
Data
object onDiracDeltaFunctions
) – value for coefficienty_dirac
r (any type that can be cast to a
Data
object onSolution
orReducedSolution
depending on whether reduced order is used for the solution) – values prescribed to the solution at the locations of constraintsq (any type that can be cast to a
Data
object onSolution
orReducedSolution
depending on whether reduced order is used for the representation of the equation) – mask for location of constraints
- Raises
IllegalCoefficient – if an unknown coefficient keyword is used
-
class
esys.downunder.forwardmodels.dcresistivity.
Locator
(where, x=array([0., 0., 0.]))¶ Locator provides access to the values of data objects at a given spatial coordinate x.
In fact, a Locator object finds the sample in the set of samples of a given function space or domain which is closest to the given point x.
-
__init__
(where, x=array([0., 0., 0.]))¶ Initializes a Locator to access values in Data objects on the Doamin or FunctionSpace for the sample point which is closest to the given point x.
- Parameters
where (
escript.FunctionSpace
) – function spacex (
numpy.ndarray
orlist
ofnumpy.ndarray
) – location(s) of the Locator
-
getFunctionSpace
()¶ Returns the function space of the Locator.
-
getId
(item=None)¶ Returns the identifier of the location.
-
getValue
(data)¶ Returns the value of
data
at the Locator ifdata
is aData
object otherwise the object is returned.
-
getX
()¶ Returns the exact coordinates of the Locator.
-
setValue
(data, v)¶ Sets the value of the
data
at the Locator.
-
Functions¶
-
esys.downunder.forwardmodels.dcresistivity.
Abs
(arg)¶ Returns the absolute value of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
.) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
C_GeneralTensorProduct
((Data)arg0, (Data)arg1[, (object)axis_offset=0[, (object)transpose=0]]) → Data :¶ Compute a tensor product of two Data objects.
- Return type
- Parameters
arg0 –
arg1 –
axis_offset (
int
) –transpose (int) – 0: transpose neither, 1: transpose arg0, 2: transpose arg1
-
esys.downunder.forwardmodels.dcresistivity.
DiracDeltaFunctions
((Domain)domain) → FunctionSpace :¶ - Return type
FunctionSpace
-
esys.downunder.forwardmodels.dcresistivity.
L2
(arg)¶ Returns the L2 norm of
arg
atwhere
.- Parameters
arg (
escript.Data
orSymbol
) – function of which the L2 norm is to be calculated- Returns
L2 norm of
arg
- Return type
float
orSymbol
- Note
L2(arg) is equivalent to
sqrt(integrate(inner(arg,arg)))
-
esys.downunder.forwardmodels.dcresistivity.
Lsup
(arg)¶ Returns the Lsup-norm of argument
arg
. This is the maximum absolute value over all data points. This function is equivalent tosup(abs(arg))
.- Parameters
arg (
float
,int
,escript.Data
,numpy.ndarray
) – argument- Returns
maximum value of the absolute value of
arg
over all components and all data points- Return type
float
- Raises
TypeError – if type of
arg
cannot be processed
-
esys.downunder.forwardmodels.dcresistivity.
NumpyToData
(array, isComplex, functionspace)¶ Uses a numpy ndarray to create a
Data
objectExample usage: NewDataObject = NumpyToData(ndarray, isComplex, FunctionSpace)
-
esys.downunder.forwardmodels.dcresistivity.
Scalar
([(object)value=0.0[, (FunctionSpace)what=<esys.escriptcore.escriptcpp.FunctionSpace object at 0x7f0ed0b95e40>[, (object)expanded=False]]]) → Data :¶ Construct a Data object containing scalar data-points.
- Parameters
value (float) – scalar value for all points
what (
FunctionSpace
) – FunctionSpace for Dataexpanded (
bool
) – If True, a value is stored for each point. If False, more efficient representations may be used
- Return type
-
esys.downunder.forwardmodels.dcresistivity.
acos
(arg)¶ Returns the inverse cosine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
acosh
(arg)¶ Returns the inverse hyperbolic cosine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
antihermitian
(arg)¶ Returns the anti-hermitian part of the square matrix
arg
. That is, (arg-adjoint(arg))/2.- Parameters
arg (
numpy.ndarray
,escript.Data
,Symbol
) – input matrix. Must have rank 2 or 4 and be square.- Returns
anti-hermitian part of
arg
- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
antisymmetric
(arg)¶ Returns the anti-symmetric part of the square matrix
arg
. That is, (arg-transpose(arg))/2.- Parameters
arg (
numpy.ndarray
,escript.Data
,Symbol
) – input matrix. Must have rank 2 or 4 and be square.- Returns
anti-symmetric part of
arg
- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
asin
(arg)¶ Returns the inverse sine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
asinh
(arg)¶ Returns the inverse hyperbolic sine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
atan
(arg)¶ Returns inverse tangent of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
atan2
(arg0, arg1)¶ Returns inverse tangent of argument
arg0
overarg1
-
esys.downunder.forwardmodels.dcresistivity.
atanh
(arg)¶ Returns the inverse hyperbolic tangent of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
boundingBox
(domain)¶ Returns the bounding box of a domain
- Parameters
domain (
escript.Domain
) – a domain- Returns
bounding box of the domain
- Return type
list
of pairs offloat
-
esys.downunder.forwardmodels.dcresistivity.
boundingBoxEdgeLengths
(domain)¶ Returns the edge lengths of the bounding box of a domain
- Parameters
domain (
escript.Domain
) – a domain- Return type
list
offloat
-
esys.downunder.forwardmodels.dcresistivity.
clip
(arg, minval=None, maxval=None)¶ Cuts the values of
arg
betweenminval
andmaxval
.- Parameters
arg (
numpy.ndarray
,escript.Data
,Symbol
,int
orfloat
) – argumentminval (
float
orNone
) – lower range. If None no lower range is appliedmaxval (
float
orNone
) – upper range. If None no upper range is applied
- Returns
an object that contains all values from
arg
betweenminval
andmaxval
- Return type
numpy.ndarray
,escript.Data
,Symbol
,int
orfloat
depending on the input- Raises
ValueError – if
minval>maxval
-
esys.downunder.forwardmodels.dcresistivity.
commonDim
(*args)¶ Identifies, if possible, the spatial dimension across a set of objects which may or may not have a spatial dimension.
- Parameters
args – given objects
- Returns
the spatial dimension of the objects with identifiable dimension (see
pokeDim
). If none of the objects has a spatial dimensionNone
is returned.- Return type
int
orNone
- Raises
ValueError – if the objects with identifiable dimension don’t have the same spatial dimension.
-
esys.downunder.forwardmodels.dcresistivity.
commonShape
(arg0, arg1)¶ Returns a shape to which
arg0
can be extended from the right andarg1
can be extended from the left.
-
esys.downunder.forwardmodels.dcresistivity.
condEval
(f, tval, fval)¶ Wrapper to allow non-data objects to be used.
-
esys.downunder.forwardmodels.dcresistivity.
convertToNumpy
(data)¶ Writes
Data
objects to a numpy array.The keyword args are Data objects to save. If a scalar
Data
object is passed with the namemask
, then only samples which correspond to positive values inmask
will be output.Example usage:
s=Scalar(..) v=Vector(..) t=Tensor(..) f=float() array = getNumpy(a=s, b=v, c=t, d=f)
-
esys.downunder.forwardmodels.dcresistivity.
cos
(arg)¶ Returns cosine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
cosh
(arg)¶ Returns the hyperbolic cosine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
delay
(arg)¶ Returns a lazy version of arg
-
esys.downunder.forwardmodels.dcresistivity.
deviatoric
(arg)¶ Returns the deviatoric version of
arg
.
-
esys.downunder.forwardmodels.dcresistivity.
diameter
(domain)¶ Returns the diameter of a domain.
- Parameters
domain (
escript.Domain
) – a domain- Return type
float
-
esys.downunder.forwardmodels.dcresistivity.
div
(arg, where=None)¶ Returns the divergence of
arg
atwhere
.- Parameters
arg (
escript.Data
orSymbol
) – function of which the divergence is to be calculated. Its shape has to be (d,) where d is the spatial dimension.where (
None
orescript.FunctionSpace
) –FunctionSpace
in which the divergence will be calculated. If not present orNone
an appropriate default is used.
- Returns
divergence of
arg
- Return type
escript.Data
orSymbol
-
esys.downunder.forwardmodels.dcresistivity.
eigenvalues
(arg)¶ Returns the eigenvalues of the square matrix
arg
.- Parameters
arg (
numpy.ndarray
,escript.Data
,Symbol
) – square matrix. Must have rank 2 and the first and second dimension must be equal. It must also be symmetric, ie.transpose(arg)==arg
(this is not checked).- Returns
the eigenvalues in increasing order
- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input- Note
for
escript.Data
andSymbol
objects the dimension is restricted to 3.
-
esys.downunder.forwardmodels.dcresistivity.
eigenvalues_and_eigenvectors
(arg)¶ Returns the eigenvalues and eigenvectors of the square matrix
arg
.- Parameters
arg (
escript.Data
) – square matrix. Must have rank 2 and the first and second dimension must be equal. It must also be symmetric, ie.transpose(arg)==arg
(this is not checked).- Returns
the eigenvalues and eigenvectors. The eigenvalues are ordered by increasing value. The eigenvectors are orthogonal and normalized. If V are the eigenvectors then V[:,i] is the eigenvector corresponding to the i-th eigenvalue.
- Return type
tuple
ofescript.Data
- Note
The dimension is restricted to 3.
-
esys.downunder.forwardmodels.dcresistivity.
erf
(arg)¶ Returns the error function erf of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
.) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
escript_generalTensorProduct
(arg0, arg1, axis_offset, transpose=0)¶ arg0 and arg1 are both Data objects but not necessarily on the same function space. They could be identical!!!
-
esys.downunder.forwardmodels.dcresistivity.
escript_generalTensorTransposedProduct
(arg0, arg1, axis_offset)¶ arg0 and arg1 are both Data objects but not necessarily on the same function space. They could be identical!!!
-
esys.downunder.forwardmodels.dcresistivity.
escript_generalTransposedTensorProduct
(arg0, arg1, axis_offset)¶ arg0 and arg1 are both Data objects but not necessarily on the same function space. They could be identical!!!
-
esys.downunder.forwardmodels.dcresistivity.
escript_inverse
(arg)¶ arg is a Data object!
-
esys.downunder.forwardmodels.dcresistivity.
exp
(arg)¶ Returns e to the power of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
.) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type of arg- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
generalTensorProduct
(arg0, arg1, axis_offset=0)¶ Generalized tensor product.
out[s,t]=Sigma_r arg0[s,r]*arg1[r,t]
- where
s runs through
arg0.Shape[:arg0.ndim-axis_offset]
r runs through
arg1.Shape[:axis_offset]
t runs through
arg1.Shape[axis_offset:]
- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – first argumentarg1 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – second argument
- Returns
the general tensor product of
arg0
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
generalTensorTransposedProduct
(arg0, arg1, axis_offset=0)¶ Generalized tensor product of
arg0
and transpose ofarg1
.out[s,t]=Sigma_r arg0[s,r]*arg1[t,r]
- where
s runs through
arg0.Shape[:arg0.ndim-axis_offset]
r runs through
arg0.Shape[arg1.ndim-axis_offset:]
t runs through
arg1.Shape[arg1.ndim-axis_offset:]
The function call
generalTensorTransposedProduct(arg0,arg1,axis_offset)
is equivalent togeneralTensorProduct(arg0,transpose(arg1,arg1.ndim-axis_offset),axis_offset)
.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – first argumentarg1 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – second argument
- Returns
the general tensor product of
arg0
andtranspose(arg1)
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
generalTransposedTensorProduct
(arg0, arg1, axis_offset=0)¶ Generalized tensor product of transposed of
arg0
andarg1
.out[s,t]=Sigma_r arg0[r,s]*arg1[r,t]
- where
s runs through
arg0.Shape[axis_offset:]
r runs through
arg0.Shape[:axis_offset]
t runs through
arg1.Shape[axis_offset:]
The function call
generalTransposedTensorProduct(arg0,arg1,axis_offset)
is equivalent togeneralTensorProduct(transpose(arg0,arg0.ndim-axis_offset),arg1,axis_offset)
.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – first argumentarg1 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – second argument
- Returns
the general tensor product of
transpose(arg0)
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
getClosestValue
(arg, origin=0)¶ Returns the value in
arg
which is closest to origin.- Parameters
arg (
escript.Data
) – functionorigin (
float
orescript.Data
) – reference value
- Returns
value in
arg
closest to origin- Return type
numpy.ndarray
-
esys.downunder.forwardmodels.dcresistivity.
getEpsilon
()¶
-
esys.downunder.forwardmodels.dcresistivity.
getMPIRankWorld
() → int :¶ Return the rank of this process in the MPI World.
-
esys.downunder.forwardmodels.dcresistivity.
getMPIWorldMax
((object)arg1) → int :¶ Each MPI process calls this function with a value for arg1. The maximum value is computed and returned.
- Return type
int
-
esys.downunder.forwardmodels.dcresistivity.
getMaxFloat
()¶
-
esys.downunder.forwardmodels.dcresistivity.
getNumpy
(**data)¶ Writes
Data
objects to a numpy array.The keyword args are Data objects to save. If a scalar
Data
object is passed with the namemask
, then only samples which correspond to positive values inmask
will be output.Example usage:
s=Scalar(..) v=Vector(..) t=Tensor(..) f=float() array = getNumpy(a=s, b=v, c=t, d=f)
-
esys.downunder.forwardmodels.dcresistivity.
getRank
(arg)¶ Identifies the rank of the argument.
- Parameters
arg (
numpy.ndarray
,escript.Data
,float
,int
,Symbol
) – an object whose rank is to be returned- Returns
the rank of the argument
- Return type
int
- Raises
TypeError – if type of
arg
cannot be processed
-
esys.downunder.forwardmodels.dcresistivity.
getShape
(arg)¶ Identifies the shape of the argument.
- Parameters
arg (
numpy.ndarray
,escript.Data
,float
,int
,Symbol
) – an object whose shape is to be returned- Returns
the shape of the argument
- Return type
tuple
ofint
- Raises
TypeError – if type of
arg
cannot be processed
-
esys.downunder.forwardmodels.dcresistivity.
getTagNames
(domain)¶ Returns a list of tag names used by the domain.
- Parameters
domain (
escript.Domain
) – a domain object- Returns
a list of tag names used by the domain
- Return type
list
ofstr
-
esys.downunder.forwardmodels.dcresistivity.
getVersion
() → int :¶ This method will only report accurate version numbers for clean checkouts.
-
esys.downunder.forwardmodels.dcresistivity.
gmshGeo2Msh
(geoFile, mshFile, numDim, order=1, verbosity=0)¶ Runs gmsh to mesh input
geoFile
. Returns 0 on success.
-
esys.downunder.forwardmodels.dcresistivity.
grad
(arg, where=None)¶ Returns the spatial gradient of
arg
atwhere
.If
g
is the returned object, thenif
arg
is rank 0g[s]
is the derivative ofarg
with respect to thes
-th spatial dimensionif
arg
is rank 1g[i,s]
is the derivative ofarg[i]
with respect to thes
-th spatial dimensionif
arg
is rank 2g[i,j,s]
is the derivative ofarg[i,j]
with respect to thes
-th spatial dimensionif
arg
is rank 3g[i,j,k,s]
is the derivative ofarg[i,j,k]
with respect to thes
-th spatial dimension.
- Parameters
arg (
escript.Data
orSymbol
) – function of which the gradient is to be calculated. Its rank has to be less than 3.where (
None
orescript.FunctionSpace
) – FunctionSpace in which the gradient is calculated. If not present orNone
an appropriate default is used.
- Returns
gradient of
arg
- Return type
escript.Data
orSymbol
-
esys.downunder.forwardmodels.dcresistivity.
grad_n
(arg, n, where=None)¶
-
esys.downunder.forwardmodels.dcresistivity.
hasFeature
((str)name) → bool :¶ Check if escript was compiled with a certain feature
- Parameters
name (
string
) – feature to lookup
-
esys.downunder.forwardmodels.dcresistivity.
hermitian
(arg)¶ Returns the hermitian part of the square matrix
arg
. That is, (arg+adjoint(arg))/2.- Parameters
arg (
numpy.ndarray
,escript.Data
,Symbol
) – input matrix. Must have rank 2 or 4 and be square.- Returns
hermitian part of
arg
- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
identity
(shape=())¶ Returns the
shape
xshape
identity tensor.- Parameters
shape (
tuple
ofint
) – input shape for the identity tensor- Returns
array whose shape is shape x shape where u[i,k]=1 for i=k and u[i,k]=0 otherwise for len(shape)=1. If len(shape)=2: u[i,j,k,l]=1 for i=k and j=l and u[i,j,k,l]=0 otherwise.
- Return type
numpy.ndarray
of rank 1, rank 2 or rank 4- Raises
ValueError – if len(shape)>2
-
esys.downunder.forwardmodels.dcresistivity.
identityTensor
(d=3)¶ Returns the
d
xd
identity matrix.- Parameters
d (
int
,escript.Domain
orescript.FunctionSpace
) – dimension or an object that has thegetDim
method defining the dimension- Returns
the object u of rank 2 with u[i,j]=1 for i=j and u[i,j]=0 otherwise
- Return type
numpy.ndarray
orescript.Data
of rank 2
-
esys.downunder.forwardmodels.dcresistivity.
identityTensor4
(d=3)¶ Returns the
d
xd
xd
xd
identity tensor.- Parameters
d (
int
or any object with agetDim
method) – dimension or an object that has thegetDim
method defining the dimension- Returns
the object u of rank 4 with u[i,j,k,l]=1 for i=k and j=l and u[i,j,k,l]=0 otherwise
- Return type
numpy.ndarray
orescript.Data
of rank 4
-
esys.downunder.forwardmodels.dcresistivity.
inf
(arg)¶ Returns the minimum value over all data points.
- Parameters
arg (
float
,int
,escript.Data
,numpy.ndarray
) – argument- Returns
minimum value of
arg
over all components and all data points- Return type
float
- Raises
TypeError – if type of
arg
cannot be processed
-
esys.downunder.forwardmodels.dcresistivity.
inner
(arg0, arg1)¶ Inner product of the two arguments. The inner product is defined as:
out=Sigma_s arg0[s]*arg1[s]
where s runs through
arg0.Shape
.arg0
andarg1
must have the same shape.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – first argumentarg1 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – second argument
- Returns
the inner product of
arg0
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
,float
depending on the input- Raises
ValueError – if the shapes of the arguments are not identical
-
esys.downunder.forwardmodels.dcresistivity.
insertTagNames
(domain, **kwargs)¶ Inserts tag names into the domain.
- Parameters
domain (
escript.Domain
) – a domain object<tag_name> (
int
) – tag key assigned to <tag_name>
-
esys.downunder.forwardmodels.dcresistivity.
insertTaggedValues
(target, **kwargs)¶ Inserts tagged values into the target using tag names.
- Parameters
target (
escript.Data
) – data to be filled by tagged values<tag_name> (
float
ornumpy.ndarray
) – value to be used for <tag_name>
- Returns
target
- Return type
escript.Data
-
esys.downunder.forwardmodels.dcresistivity.
integrate
(arg, where=None)¶ Returns the integral of the function
arg
over its domain. Ifwhere
is presentarg
is interpolated towhere
before integration.- Parameters
arg (
escript.Data
orSymbol
) – the function which is integratedwhere (
None
orescript.FunctionSpace
) – FunctionSpace in which the integral is calculated. If not present orNone
an appropriate default is used.
- Returns
integral of
arg
- Return type
float
,numpy.ndarray
orSymbol
-
esys.downunder.forwardmodels.dcresistivity.
interpolate
(arg, where)¶ Interpolates the function into the
FunctionSpace
where
. If the argumentarg
has the requested function spacewhere
no interpolation is performed andarg
is returned.- Parameters
arg (
escript.Data
orSymbol
) – interpolantwhere (
escript.FunctionSpace
) –FunctionSpace
to be interpolated to
- Returns
interpolated argument
- Return type
escript.Data
orSymbol
-
esys.downunder.forwardmodels.dcresistivity.
interpolateTable
(tab, dat, start, step, undef=1e+50, check_boundaries=False)¶
-
esys.downunder.forwardmodels.dcresistivity.
inverse
(arg)¶ Returns the inverse of the square matrix
arg
.- Parameters
arg (
numpy.ndarray
,escript.Data
,Symbol
) – square matrix. Must have rank 2 and the first and second dimension must be equal.- Returns
inverse of the argument.
matrix_mult(inverse(arg),arg)
will be almost equal tokronecker(arg.getShape()[0])
- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input- Note
for
escript.Data
objects the dimension is restricted to 3.
-
esys.downunder.forwardmodels.dcresistivity.
jump
(arg, domain=None)¶ Returns the jump of
arg
across the continuity of the domain.- Parameters
arg (
escript.Data
orSymbol
) – argumentdomain (
None
orescript.Domain
) – the domain where the discontinuity is located. If domain is not present or equal toNone
the domain ofarg
is used.
- Returns
jump of
arg
- Return type
escript.Data
orSymbol
-
esys.downunder.forwardmodels.dcresistivity.
kronecker
(d=3)¶ Returns the kronecker delta-symbol.
- Parameters
d (
int
,escript.Domain
orescript.FunctionSpace
) – dimension or an object that has thegetDim
method defining the dimension- Returns
the object u of rank 2 with u[i,j]=1 for i=j and u[i,j]=0 otherwise
- Return type
numpy.ndarray
orescript.Data
of rank 2
-
esys.downunder.forwardmodels.dcresistivity.
length
(arg)¶ Returns the length (Euclidean norm) of argument
arg
at each data point.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
depending on the type ofarg
-
esys.downunder.forwardmodels.dcresistivity.
listEscriptParams
() → list :¶ - Returns
A list of tuples (p,v,d) where p is the name of a parameter for escript, v is its current value, and d is a description.
-
esys.downunder.forwardmodels.dcresistivity.
log
(arg)¶ Returns the natural logarithm of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
.) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
log10
(arg)¶ Returns base-10 logarithm of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
longestEdge
(domain)¶ Returns the length of the longest edge of the domain
- Parameters
domain (
escript.Domain
) – a domain- Returns
longest edge of the domain parallel to the Cartesian axis
- Return type
float
-
esys.downunder.forwardmodels.dcresistivity.
makeTagMap
(fs)¶ Produce an expanded Data over the function space where the value is the tag associated with the sample
-
esys.downunder.forwardmodels.dcresistivity.
makeTransformation
(domain, coordinates=None)¶ returns a
SpatialCoordinateTransformation
for the given domain- Parameters
domain (
esys.escript.AbstractDomain
) – domain in the domain of the coordinate transformationcoordinates (
ReferenceSystem
orSpatialCoordinateTransformation
) – the reference system or spatial coordinate system.
- Returns
the spatial coordinate system for the given domain of the specified reference system
coordinates
. Ifcoordinates
is already spatial coordinate system based on the riven domaincoordinates
is returned. Otherwise an appropriate spatial coordinate system is created.- Return type
SpatialCoordinateTransformation
-
esys.downunder.forwardmodels.dcresistivity.
matchShape
(arg0, arg1)¶ Returns a representation of
arg0
andarg1
which have the same shape.- Parameters
arg0 (
numpy.ndarray
,`escript.Data`,``float``,int
,Symbol
) – first argumentarg1 (
numpy.ndarray
,`escript.Data`,``float``,int
,Symbol
) – second argument
- Returns
arg0
andarg1
where copies are returned when the shape has to be changed- Return type
tuple
-
esys.downunder.forwardmodels.dcresistivity.
matchType
(arg0=0.0, arg1=0.0)¶ Converts
arg0
andarg1
both to the same typenumpy.ndarray
orescript.Data
- Parameters
arg0 (
numpy.ndarray
,`escript.Data`,``float``,int
,Symbol
) – first argumentarg1 (
numpy.ndarray
,`escript.Data`,``float``,int
,Symbol
) – second argument
- Returns
a tuple representing
arg0
andarg1
with the same type or with at least one of them being aSymbol
- Return type
tuple
of twonumpy.ndarray
or twoescript.Data
- Raises
TypeError – if type of
arg0
orarg1
cannot be processed
-
esys.downunder.forwardmodels.dcresistivity.
matrix_mult
(arg0, arg1)¶ matrix-matrix or matrix-vector product of the two arguments.
out[s0]=Sigma_{r0} arg0[s0,r0]*arg1[r0]
or
out[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[r0,s1]
The second dimension of
arg0
and the first dimension ofarg1
must match.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
) – first argument of rank 2arg1 (
numpy.ndarray
,escript.Data
,Symbol
) – second argument of at least rank 1
- Returns
the matrix-matrix or matrix-vector product of
arg0
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input- Raises
ValueError – if the shapes of the arguments are not appropriate
-
esys.downunder.forwardmodels.dcresistivity.
matrix_transposed_mult
(arg0, arg1)¶ matrix-transposed(matrix) product of the two arguments.
out[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[s1,r0]
The function call
matrix_transposed_mult(arg0,arg1)
is equivalent tomatrix_mult(arg0,transpose(arg1))
.The last dimensions of
arg0
andarg1
must match.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
) – first argument of rank 2arg1 (
numpy.ndarray
,escript.Data
,Symbol
) – second argument of rank 1 or 2
- Returns
the product of
arg0
and the transposed ofarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input- Raises
ValueError – if the shapes of the arguments are not appropriate
-
esys.downunder.forwardmodels.dcresistivity.
matrixmult
(arg0, arg1)¶ See
matrix_mult
.
-
esys.downunder.forwardmodels.dcresistivity.
maximum
(*args)¶ The maximum over arguments
args
.- Parameters
args (
numpy.ndarray
,escript.Data
,Symbol
,int
orfloat
) – arguments- Returns
an object which in each entry gives the maximum of the corresponding values in
args
- Return type
numpy.ndarray
,escript.Data
,Symbol
,int
orfloat
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
maxval
(arg)¶ Returns the maximum value over all components of
arg
at each data point.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
meanValue
(arg)¶ return the mean value of the argument over its domain
- Parameters
arg (
escript.Data
) – function- Returns
mean value
- Return type
float
ornumpy.ndarray
-
esys.downunder.forwardmodels.dcresistivity.
minimum
(*args)¶ The minimum over arguments
args
.- Parameters
args (
numpy.ndarray
,escript.Data
,Symbol
,int
orfloat
) – arguments- Returns
an object which gives in each entry the minimum of the corresponding values in
args
- Return type
numpy.ndarray
,escript.Data
,Symbol
,int
orfloat
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
minval
(arg)¶ Returns the minimum value over all components of
arg
at each data point.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
mkDir
(*pathname)¶ creates a directory of name
pathname
if the directory does not exist.- Parameters
pathname (
str
orsequence of strings
) – valid path name- Note
The method is MPI safe.
-
esys.downunder.forwardmodels.dcresistivity.
mult
(arg0, arg1)¶ Product of
arg0
andarg1
.- Parameters
arg0 (
Symbol
,float
,int
,escript.Data
ornumpy.ndarray
) – first termarg1 (
Symbol
,float
,int
,escript.Data
ornumpy.ndarray
) – second term
- Returns
the product of
arg0
andarg1
- Return type
Symbol
,float
,int
,escript.Data
ornumpy.ndarray
- Note
The shape of both arguments is matched according to the rules used in
matchShape
.
-
esys.downunder.forwardmodels.dcresistivity.
negative
(arg)¶ returns the negative part of arg
-
esys.downunder.forwardmodels.dcresistivity.
nonsymmetric
(arg)¶ Deprecated alias for antisymmetric
-
esys.downunder.forwardmodels.dcresistivity.
normalize
(arg, zerolength=0)¶ Returns the normalized version of
arg
(=``arg/length(arg)``).- Parameters
arg (
escript.Data
orSymbol
) – functionzerolength (
float
) – relative tolerance for arg == 0
- Returns
normalized
arg
wherearg
is non-zero, and zero elsewhere- Return type
escript.Data
orSymbol
-
esys.downunder.forwardmodels.dcresistivity.
outer
(arg0, arg1)¶ The outer product of the two arguments. The outer product is defined as:
out[t,s]=arg0[t]*arg1[s]
- where
s runs through
arg0.Shape
t runs through
arg1.Shape
- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – first argumentarg1 (
numpy.ndarray
,escript.Data
,Symbol
,float
,int
) – second argument
- Returns
the outer product of
arg0
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
phase
(arg)¶ return the “phase”/”arg”/”angle” of a number
-
esys.downunder.forwardmodels.dcresistivity.
pokeDim
(arg)¶ Identifies the spatial dimension of the argument.
- Parameters
arg (any) – an object whose spatial dimension is to be returned
- Returns
the spatial dimension of the argument, if available, or
None
- Return type
int
orNone
-
esys.downunder.forwardmodels.dcresistivity.
polarToCart
(r, phase)¶ conversion from cartesian to polar coordinates
- Parameters
r (any float type object) – length
phase (any float type object) – the phase angle in rad
- Returns
cartesian representation as complex number
- Return type
appropriate complex
-
esys.downunder.forwardmodels.dcresistivity.
positive
(arg)¶ returns the positive part of arg
-
esys.downunder.forwardmodels.dcresistivity.
printParallelThreadCounts
() → None¶
-
esys.downunder.forwardmodels.dcresistivity.
reorderComponents
(arg, index)¶ Resorts the components of
arg
according to index.
-
esys.downunder.forwardmodels.dcresistivity.
resolve
(arg)¶ Returns the value of arg resolved.
-
esys.downunder.forwardmodels.dcresistivity.
safeDiv
(arg0, arg1, rtol=None)¶ returns arg0/arg1 but return 0 where arg1 is (almost) zero
-
esys.downunder.forwardmodels.dcresistivity.
saveDataCSV
(filename, append=False, refid=False, sep=', ', csep='_', **data)¶ Writes
Data
objects to a CSV file. These objects must have compatible FunctionSpaces, i.e. it must be possible to interpolate all data to oneFunctionSpace
. Note, that with more than one MPI rank this function will fail for some function spaces on some domains.- Parameters
filename (
string
) – file to save data to.append (
bool
) – IfTrue
, then open file at end rather than beginningrefid (
bool
) – IfTrue
, then a list of reference ids will be printed in the first columnsep (
string
) – separator between fieldscsep – separator for components of rank 2 and above (e.g. ‘_’ -> c0_1)
The keyword args are Data objects to save. If a scalar
Data
object is passed with the namemask
, then only samples which correspond to positive values inmask
will be output. Example:s=Scalar(..) v=Vector(..) t=Tensor(..) f=float() saveDataCSV("f.csv", a=s, b=v, c=t, d=f)
Will result in a file
a, b0, b1, c0_0, c0_1, .., c1_1, d 1.0, 1.5, 2.7, 3.1, 3.4, .., 0.89, 0.0 0.9, 8.7, 1.9, 3.4, 7.8, .., 1.21, 0.0
The first line is a header, the remaining lines give the values.
-
esys.downunder.forwardmodels.dcresistivity.
saveESD
(datasetName, dataDir='.', domain=None, timeStep=0, deltaT=1, dynamicMesh=0, timeStepFormat='%04d', **data)¶ Saves
Data
objects to files and creates anescript dataset
(ESD) file for convenient processing/visualisation.Single timestep example:
tmp = Scalar(..) v = Vector(..) saveESD("solution", "data", temperature=tmp, velocity=v)
Time series example:
while t < t_end: tmp = Scalar(..) v = Vector(..) # save every 10 timesteps if t % 10 == 0: saveESD("solution", "data", timeStep=t, deltaT=10, temperature=tmp, velocity=v) t = t + 1
tmp, v and the domain are saved in native format in the “data” directory and the file “solution.esd” is created that refers to tmp by the name “temperature” and to v by the name “velocity”.
- Parameters
datasetName (
str
) – name of the dataset, used to name the ESD filedataDir (
str
) – optional directory where the data files should be saveddomain (
escript.Domain
) – domain of theData
object(s). If not specified, the domain of the givenData
objects is used.timeStep (
int
) – current timestep or sequence number - first one must be 0deltaT (
int
) – timestep or sequence increment, see example abovedynamicMesh (
int
) – by default the mesh is assumed to be static and thus only saved once at timestep 0 to save disk space. Setting this to 1 changes the behaviour and the mesh is saved at each timestep.timeStepFormat (
str
) – timestep format string (defaults to “%04d”)<name> (
Data
object) – writes the assigned value to the file using <name> as identifier
- Note
The ESD concept is experimental and the file format likely to change so use this function with caution.
- Note
The data objects have to be defined on the same domain (but not necessarily on the same
FunctionSpace
).- Note
When saving a time series the first timestep must be 0 and it is assumed that data from all timesteps share the domain. The dataset file is updated in each iteration.
-
esys.downunder.forwardmodels.dcresistivity.
showEscriptParams
()¶ Displays the parameters escript recognises with an explanation and their current value.
-
esys.downunder.forwardmodels.dcresistivity.
sign
(arg)¶ Returns the sign of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
sin
(arg)¶ Returns sine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
.) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
sinh
(arg)¶ Returns the hyperbolic sine of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
sqrt
(arg)¶ Returns the square root of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
sup
(arg)¶ Returns the maximum value over all data points.
- Parameters
arg (
float
,int
,escript.Data
,numpy.ndarray
) – argument- Returns
maximum value of
arg
over all components and all data points- Return type
float
- Raises
TypeError – if type of
arg
cannot be processed
-
esys.downunder.forwardmodels.dcresistivity.
swap_axes
(arg, axis0=0, axis1=1)¶ Returns the swap of
arg
by swapping the componentsaxis0
andaxis1
.- Parameters
arg (
escript.Data
,Symbol
,numpy.ndarray
) – argumentaxis0 (
int
) – first axis.axis0
must be non-negative and less than the rank ofarg
.axis1 (
int
) – second axis.axis1
must be non-negative and less than the rank ofarg
.
- Returns
arg
with swapped components- Return type
escript.Data
,Symbol
ornumpy.ndarray
depending on the type ofarg
-
esys.downunder.forwardmodels.dcresistivity.
symmetric
(arg)¶ Returns the symmetric part of the square matrix
arg
. That is, (arg+transpose(arg))/2.- Parameters
arg (
numpy.ndarray
,escript.Data
,Symbol
) – input matrix. Must have rank 2 or 4 and be square.- Returns
symmetric part of
arg
- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
tan
(arg)¶ Returns tangent of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
tanh
(arg)¶ Returns the hyperbolic tangent of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
tensor_mult
(arg0, arg1)¶ The tensor product of the two arguments.
For
arg0
of rank 2 this isout[s0]=Sigma_{r0} arg0[s0,r0]*arg1[r0]
or
out[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[r0,s1]
and for
arg0
of rank 4 this isout[s0,s1,s2,s3]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2,s3]
or
out[s0,s1,s2]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2]
or
out[s0,s1]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1]
In the first case the second dimension of
arg0
and the last dimension ofarg1
must match and in the second case the two last dimensions ofarg0
must match the two first dimensions ofarg1
.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
) – first argument of rank 2 or 4arg1 (
numpy.ndarray
,escript.Data
,Symbol
) – second argument of shape greater than 1 or 2 depending on the rank ofarg0
- Returns
the tensor product of
arg0
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
tensor_transposed_mult
(arg0, arg1)¶ The tensor product of the first and the transpose of the second argument.
For
arg0
of rank 2 this isout[s0,s1]=Sigma_{r0} arg0[s0,r0]*arg1[s1,r0]
and for
arg0
of rank 4 this isout[s0,s1,s2,s3]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[s2,s3,r0,r1]
or
out[s0,s1,s2]=Sigma_{r0,r1} arg0[s0,s1,r0,r1]*arg1[s2,r0,r1]
In the first case the second dimension of
arg0
andarg1
must match and in the second case the two last dimensions ofarg0
must match the two last dimensions ofarg1
.The function call
tensor_transpose_mult(arg0,arg1)
is equivalent totensor_mult(arg0,transpose(arg1))
.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
) – first argument of rank 2 or 4arg1 (
numpy.ndarray
,escript.Data
,Symbol
) – second argument of shape greater of 1 or 2 depending on rank ofarg0
- Returns
the tensor product of the transposed of
arg0
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
tensormult
(arg0, arg1)¶ See
tensor_mult
.
-
esys.downunder.forwardmodels.dcresistivity.
testForZero
(arg)¶ Tests if the argument is identical to zero.
- Parameters
arg (typically
numpy.ndarray
,escript.Data
,float
,int
) – the object to test for zero- Returns
True if the argument is identical to zero, False otherwise
- Return type
bool
-
esys.downunder.forwardmodels.dcresistivity.
trace
(arg, axis_offset=0)¶ Returns the trace of
arg
which is the sum ofarg[k,k]
over k.- Parameters
arg (
escript.Data
,Symbol
,numpy.ndarray
) – argumentaxis_offset (
int
) –axis_offset
to components to sum over.axis_offset
must be non-negative and less than the rank ofarg
+1. The dimensions of componentaxis_offset
and axis_offset+1 must be equal.
- Returns
trace of arg. The rank of the returned object is rank of
arg
minus 2.- Return type
escript.Data
,Symbol
ornumpy.ndarray
depending on the type ofarg
-
esys.downunder.forwardmodels.dcresistivity.
transpose
(arg, axis_offset=None)¶ Returns the transpose of
arg
by swapping the firstaxis_offset
and the lastrank-axis_offset
components.- Parameters
arg (
escript.Data
,Symbol
,numpy.ndarray
,float
,int
) – argumentaxis_offset (
int
) – the firstaxis_offset
components are swapped with the rest.axis_offset
must be non-negative and less or equal to the rank ofarg
. Ifaxis_offset
is not presentint(r/2)
where r is the rank ofarg
is used.
- Returns
transpose of
arg
- Return type
escript.Data
,Symbol
,numpy.ndarray
,float
,int
depending on the type ofarg
-
esys.downunder.forwardmodels.dcresistivity.
transposed_matrix_mult
(arg0, arg1)¶ transposed(matrix)-matrix or transposed(matrix)-vector product of the two arguments.
out[s0]=Sigma_{r0} arg0[r0,s0]*arg1[r0]
or
out[s0,s1]=Sigma_{r0} arg0[r0,s0]*arg1[r0,s1]
The function call
transposed_matrix_mult(arg0,arg1)
is equivalent tomatrix_mult(transpose(arg0),arg1)
.The first dimension of
arg0
andarg1
must match.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
) – first argument of rank 2arg1 (
numpy.ndarray
,escript.Data
,Symbol
) – second argument of at least rank 1
- Returns
the product of the transpose of
arg0
andarg1
at each data point- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input- Raises
ValueError – if the shapes of the arguments are not appropriate
-
esys.downunder.forwardmodels.dcresistivity.
transposed_tensor_mult
(arg0, arg1)¶ The tensor product of the transpose of the first and the second argument.
For
arg0
of rank 2 this isout[s0]=Sigma_{r0} arg0[r0,s0]*arg1[r0]
or
out[s0,s1]=Sigma_{r0} arg0[r0,s0]*arg1[r0,s1]
and for
arg0
of rank 4 this isout[s0,s1,s2,s3]=Sigma_{r0,r1} arg0[r0,r1,s0,s1]*arg1[r0,r1,s2,s3]
or
out[s0,s1,s2]=Sigma_{r0,r1} arg0[r0,r1,s0,s1]*arg1[r0,r1,s2]
or
out[s0,s1]=Sigma_{r0,r1} arg0[r0,r1,s0,s1]*arg1[r0,r1]
In the first case the first dimension of
arg0
and the first dimension ofarg1
must match and in the second case the two first dimensions ofarg0
must match the two first dimensions ofarg1
.The function call
transposed_tensor_mult(arg0,arg1)
is equivalent totensor_mult(transpose(arg0),arg1)
.- Parameters
arg0 (
numpy.ndarray
,escript.Data
,Symbol
) – first argument of rank 2 or 4arg1 (
numpy.ndarray
,escript.Data
,Symbol
) – second argument of shape greater of 1 or 2 depending on the rank ofarg0
- Returns
the tensor product of transpose of arg0 and arg1 at each data point
- Return type
numpy.ndarray
,escript.Data
,Symbol
depending on the input
-
esys.downunder.forwardmodels.dcresistivity.
unitVector
(i=0, d=3)¶ Returns a unit vector u of dimension d whose non-zero element is at index i.
- Parameters
i (
int
) – index for non-zero elementd (
int
,escript.Domain
orescript.FunctionSpace
) – dimension or an object that has thegetDim
method defining the dimension
- Returns
the object u of rank 1 with u[j]=1 for j=index and u[j]=0 otherwise
- Return type
numpy.ndarray
orescript.Data
of rank 1
-
esys.downunder.forwardmodels.dcresistivity.
vol
(arg)¶ Returns the volume or area of the oject
arg
- Parameters
arg (
escript.FunctionSpace
orescript.Domain
) – a geometrical object- Return type
float
-
esys.downunder.forwardmodels.dcresistivity.
whereNegative
(arg)¶ Returns mask of negative values of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
whereNonNegative
(arg)¶ Returns mask of non-negative values of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
whereNonPositive
(arg)¶ Returns mask of non-positive values of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
whereNonZero
(arg, tol=0.0)¶ Returns mask of values different from zero of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argumenttol (
float
) – absolute tolerance. Values with absolute value less than tol are accepted as zero. Iftol
is not presentrtol``*```Lsup` (arg)
is used.
- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
ValueError – if
rtol
is non-negative.TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
wherePositive
(arg)¶ Returns mask of positive values of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
.) – argument- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
whereZero
(arg, tol=None, rtol=1.4901161193847656e-08)¶ Returns mask of zero entries of argument
arg
.- Parameters
arg (
float
,escript.Data
,Symbol
,numpy.ndarray
) – argumenttol (
float
) – absolute tolerance. Values with absolute value less than tol are accepted as zero. Iftol
is not presentrtol``*```Lsup` (arg)
is used.rtol (non-negative
float
) – relative tolerance used to define the absolute tolerance iftol
is not present.
- Return type
float
,escript.Data
,Symbol
,numpy.ndarray
depending on the type ofarg
- Raises
ValueError – if
rtol
is non-negative.TypeError – if the type of the argument is not expected
-
esys.downunder.forwardmodels.dcresistivity.
zeros
(shape=())¶ Returns the
shape
zero tensor.- Parameters
shape (
tuple
ofint
) – input shape for the identity tensor- Returns
array of shape filled with zeros
- Return type
numpy.ndarray
Others¶
DBLE_MAX
EPSILON