ansys.dpf.core.operators.math.correlation#
- class ansys.dpf.core.operators.math.correlation(fieldA=None, fieldB=None, weights=None, absoluteValue=None, config=None, server=None, ponderation=None)#
Bases:
ansys.dpf.core.dpf_operator.Operator
Takes two fields and a weighting and computes their correlation: aMb/(||aMa||.||bMb||). If several b fields are provided (via a fields container), correlation is computed for each of them.
- Parameters:
fieldA (Field or float) – Field a. The reference field.
fieldB (Field or FieldsContainer) – Field b. If a fields container is provided, correlation is computed for each field.
weights (Field or FieldsContainer) – Field M, optional weighting for correlation computation.
absoluteValue (bool) – If true, correlation factor is ||aMb||/(||aMa||.||bMb||)
- Returns:
field (Field) – Correlation factor for each input field b.
index (int) – If several b are provided, this output contains the index of the highest correlation factor.
Examples
>>> from ansys.dpf import core as dpf
>>> # Instantiate operator >>> op = dpf.operators.math.correlation()
>>> # Make input connections >>> my_fieldA = dpf.Field() >>> op.inputs.fieldA.connect(my_fieldA) >>> my_fieldB = dpf.Field() >>> op.inputs.fieldB.connect(my_fieldB) >>> my_weights = dpf.Field() >>> op.inputs.weights.connect(my_weights) >>> my_absoluteValue = bool() >>> op.inputs.absoluteValue.connect(my_absoluteValue)
>>> # Instantiate operator and connect inputs in one line >>> op = dpf.operators.math.correlation( ... fieldA=my_fieldA, ... fieldB=my_fieldB, ... weights=my_weights, ... absoluteValue=my_absoluteValue, ... )
>>> # Get output data >>> result_field = op.outputs.field() >>> result_index = op.outputs.index()
- _inputs#
- _outputs#
- static _spec() ansys.dpf.core.operators.specification.Specification #
- static default_config(server: ansys.dpf.core.server_types.AnyServerType = None) ansys.dpf.core.config.Config #
Returns the default config of the operator.
This config can then be changed to the user needs and be used to instantiate the operator. The Configuration allows to customize how the operation will be processed by the operator.
- Parameters:
server – Server with channel connected to the remote or local instance. When
None
, attempts to use the global server.- Returns:
A new Config instance equivalent to the default config for this operator.
- Return type:
config
- property inputs: InputsCorrelation#
Enables to connect inputs to the operator
- Returns:
An instance of InputsCorrelation.
- Return type:
inputs
- property outputs: OutputsCorrelation#
Enables to get outputs of the operator by evaluating it
- Returns:
An instance of OutputsCorrelation.
- Return type:
outputs