Bases: Boost.Python.instance
Represents a collection of datapoints. It is used to store the values of a function. For more details please consult the c++ class documentation.
Make this object a copy of other
note: The two objects will act independently from now on. That is, changing other after this call will not change this object and vice versa.
note: | In the no argument form, a new object will be returned which is an independent copy of this object. |
---|
Selectively copy values from other Data.Datapoints which correspond to positive values in mask will be copied from other
Parameters: |
---|
Convert this object into lazy representation
Save the data as a netCDF file
Parameters: | fileName (string) – |
---|
Convert the data to expanded representation if it is not expanded already.
Return type: | Domain |
---|
Return type: | FunctionSpace |
---|
Return type: | int |
---|---|
Returns: | Number of datapoints in the object |
Returns: | the number of indices required to address a component of a datapoint |
---|---|
Return type: | positive int |
Returns the shape of the datapoints in this object as a python tuple. Scalar data has the shape ()
Return type: | tuple |
---|
Return tag number for the specified datapoint
Return type: | int |
---|---|
Parameters: | dpno (int) – datapoint number |
Returns: | Value of the specified datapoint |
---|---|
Return type: | tuple |
Parameters: | dataPointNo (int) – datapoint to access |
Get a specific datapoint from a specific process
Return type: | tuple |
---|---|
Parameters: |
|
Interpolate this object’s values into a new functionspace.
Creates a new Data object by interpolating using the source data (which are looked up in table) A must be the outer dimension on the table
param table: two dimensional collection of values param Amin: The base of locations in table type Amin: float param Astep: size of gap between each item in the table type Astep: float param undef: upper bound on interpolated values type undef: float param B: Scalar representing the second coordinate to be mapped into the table type B: Data param Bmin: The base of locations in table for 2nd dimension type Bmin: float param Bstep: size of gap between each item in the table for 2nd dimension type Bstep: float param check_boundaries: if true, then values outside the boundaries will be rejected. If false, then boundary values will be used. raise RuntimeError(DataException): if the coordinates do not map into the table or if the interpolated value is above undef rtype: Data
interpolateTable( (Data)arg1, (object)table, (float)Amin, (float)Astep [, (float)undef=1e+50 [, (bool)check_boundaries=False]]) -> Data
Return type: | bool |
---|---|
Returns: | True if this Data is an instance of DataConstant |
Note : | This does not mean the data is immutable. |
Is this object an instance of DataEmpty
Return type: | bool |
---|---|
Note : | This is not the same thing as asking if the object contains datapoints. |
Return type: | bool |
---|---|
Returns: | True if this Data is expanded. |
Return type: | bool |
---|---|
Returns: | True if this Data is lazy. |
Can this instance be modified. :rtype: bool
Return type: | bool |
---|---|
Returns: | True if this Data is not lazy. |
Return type: | bool |
---|---|
Returns: | True if this Data is expanded. |
Please consider using getSupLocator() from pdetools instead.
Please consider using getInfLocator() from pdetools instead.
1D interpolation with non equally spaced points
1D interpolation of slope with non equally spaced points
Convert the data to non-lazy representation.
Disallow modifications to this data object
Note : | This method does not allow you to undo protection. |
---|
Set the value of tagged Data.
param tagKey: tag to update type tagKey: int
param name: | tag to update |
---|---|
type name: | string |
param value: | value to set tagged data to |
type value: | object which acts like an array, tuple or list |
After this call the object will store values of the same shape as before but all components will be zero.
setValueOfDataPoint( (Data)arg1, (int)arg2, (object)arg3) -> None
setValueOfDataPoint( (Data)arg1, (int)arg2, (float)arg3) -> None :
Modify the value of a single datapoint.
param dataPointNo: type dataPointNo: int param value: type value: float or an object which acts like an array, tuple or list warning: Use of this operation is discouraged. It prevents some optimisations from operating.
Convert data to tagged representation if it is not already tagged or expanded
Return the datapoints of this object in a list. Each datapoint is stored as a tuple.
Parameters: | scalarastuple – if True, scalar data will be wrapped as a tuple. True => [(0), (1), (2)]; False => [0, 1, 2] |
---|
Bases: Boost.Python.instance
A FunctionSpace describes which points from the Domain to use to represent functions.
Returns: | the approximation order referring to the maximum degree of a polynomial which can be represented exactly in interpolation and/or integration. |
---|---|
Return type: | int |
Returns: | the spatial dimension of the underlying domain. |
---|---|
Return type: | int |
Returns: | the underlying Domain for this FunctionSpace. |
---|---|
Return type: | Domain |
Returns: | a list of the tags used in this function space |
---|---|
Return type: | list |
Returns: | the reference number associated with dataPointNo |
---|---|
Return type: | int |
Returns: | the tag associated with the given sample number. |
---|---|
Return type: | int |
Returns: | a function whose values are its input coordinates. ie an identity function. |
---|---|
Return type: | Data |
Set tags according to a mask
param newtag: tag number to set type newtag: string, non-zero int param mask: Samples which correspond to positive values in the mask will be set to newtag. type mask: scalar Data
setTags( (FunctionSpace)arg1, (str)newtag, (Data)mask) -> None
Bases: object
Symbol objects are placeholders for a single mathematical symbol, such as ‘x’, or for arbitrarily complex mathematical expressions such as ‘c*x**4+alpha*exp(x)-2*sin(beta*x)’, where ‘alpha’, ‘beta’, ‘c’, and ‘x’ are also Symbols (the symbolic ‘atoms’ of the expression).
With the help of the ‘Evaluator’ class these symbols and expressions can be resolved by substituting numeric values and/or escript Data objects for the atoms. To facilitate the use of Data objects a Symbol has a shape (and thus a rank) as well as a dimension (see constructor). Symbols are useful to perform mathematical simplifications, compute derivatives and as coefficients for nonlinear PDEs which can be solved by the NonlinearPDE class.
Applies the function f to all elements (if on_type is None) or to all elements of type on_type.
Returns the atoms that form the current Symbol.
By default, only objects that are truly atomic and cannot be divided into smaller pieces are returned: symbols, numbers, and number symbols like I and pi. It is possible to request atoms of any type, however.
Note that if this symbol contains components such as [x]_i_j then only their main symbol ‘x’ is returned.
Parameters: | types – types to restrict result to |
---|---|
Returns: | list of atoms of specified type |
Return type: | set |
Returns the coefficient of the term “x” or 0 if there is no “x”.
If “x” is a scalar symbol then “x” is searched in all components of this symbol. Otherwise the shapes must match and the coefficients are checked component by component.
Example:
x=Symbol('x', (2,2))
y=3*x
print y.coeff(x)
print y.coeff(x[1,1])
will print:
[[3 3]
[3 3]]
[[0 0]
[0 3]]
Parameters: | x (Symbol, numpy.ndarray, list) – the term whose coefficients are to be found |
---|---|
Returns: | the coefficient(s) of the term |
Return type: | Symbol |
Applies the sympy.expand operation on all elements in this symbol
Returns a dictionary of symbol names and the escript Data objects they represent within this Symbol.
Returns: | the dictionary of substituted Data objects |
---|---|
Return type: | dict |
Returns the spatial dimensionality of this symbol.
Returns: | the symbol’s spatial dimensionality, or -1 if undefined |
---|---|
Return type: | int |
Returns the rank of this symbol.
Returns: | the symbol’s rank which is equal to the length of the shape. |
---|---|
Return type: | int |
Returns the shape of this symbol.
Returns: | the symbol’s shape |
---|---|
Return type: | tuple of int |
Returns a symbol which represents the gradient of this symbol. :type where: Symbol, FunctionSpace
Returns an element of this symbol. This method behaves like the item() method of numpy.ndarray. If this is a scalar Symbol, no arguments are allowed and the only element in this Symbol is returned. Otherwise, ‘args’ specifies a flat or nd-index and the element at that index is returned.
Parameters: | args – index of item to be returned |
---|---|
Returns: | the requested element |
Return type: | sympy.Symbol, int, or float |
Applies the sympy.simplify operation on all elements in this symbol
Substitutes an expression.
Returns the trace of this Symbol.
Returns the transpose of this Symbol.