1313
1414class correlation (Operator ):
1515 """Takes two fields and a weighting and computes their correlation:
16- aMb/(||aMa||.||bMb||).
16+ aMb/(||aMa||.||bMb||). If several b fields are provided (via a
17+ fields container), correlation is computed for each of them.
1718
1819 Parameters
1920 ----------
2021 fieldA : Field or float
22+ Field a. the reference field.
2123 fieldB : Field or FieldsContainer
22- ponderation : Field
24+ Field b. if a fields container is provided,
25+ correlation is computed for each
26+ field.
27+ ponderation : Field or FieldsContainer
28+ Field m, optional weighting for correclation
29+ computation.
2330
2431
2532 Examples
@@ -65,41 +72,48 @@ def __init__(
6572 @staticmethod
6673 def _spec ():
6774 description = """Takes two fields and a weighting and computes their correlation:
68- aMb/(||aMa||.||bMb||)."""
75+ aMb/(||aMa||.||bMb||). If several b fields are provided
76+ (via a fields container), correlation is computed for each
77+ of them."""
6978 spec = Specification (
7079 description = description ,
7180 map_input_pin_spec = {
7281 0 : PinSpecification (
7382 name = "fieldA" ,
7483 type_names = ["field" , "double" , "vector<double>" ],
7584 optional = False ,
76- document = """""" ,
85+ document = """Field a. the reference field. """ ,
7786 ),
7887 1 : PinSpecification (
7988 name = "fieldB" ,
8089 type_names = ["field" , "fields_container" ],
8190 optional = False ,
82- document = """""" ,
91+ document = """Field b. if a fields container is provided,
92+ correlation is computed for each
93+ field.""" ,
8394 ),
8495 2 : PinSpecification (
8596 name = "ponderation" ,
86- type_names = ["field" ],
97+ type_names = ["field" , "fields_container" ],
8798 optional = False ,
88- document = """""" ,
99+ document = """Field m, optional weighting for correclation
100+ computation.""" ,
89101 ),
90102 },
91103 map_output_pin_spec = {
92104 0 : PinSpecification (
93105 name = "field" ,
94106 type_names = ["field" ],
95107 optional = False ,
96- document = """""" ,
108+ document = """Correlation factor for each input field b. """ ,
97109 ),
98110 1 : PinSpecification (
99111 name = "index" ,
100112 type_names = ["int32" ],
101113 optional = False ,
102- document = """""" ,
114+ document = """If several b are provided, this output
115+ contains the index of the highest
116+ correlation factor.""" ,
103117 ),
104118 },
105119 )
@@ -171,6 +185,8 @@ def __init__(self, op: Operator):
171185 def fieldA (self ):
172186 """Allows to connect fieldA input to the operator.
173187
188+ Field a. the reference field.
189+
174190 Parameters
175191 ----------
176192 my_fieldA : Field or float
@@ -189,6 +205,10 @@ def fieldA(self):
189205 def fieldB (self ):
190206 """Allows to connect fieldB input to the operator.
191207
208+ Field b. if a fields container is provided,
209+ correlation is computed for each
210+ field.
211+
192212 Parameters
193213 ----------
194214 my_fieldB : Field or FieldsContainer
@@ -207,9 +227,12 @@ def fieldB(self):
207227 def ponderation (self ):
208228 """Allows to connect ponderation input to the operator.
209229
230+ Field m, optional weighting for correclation
231+ computation.
232+
210233 Parameters
211234 ----------
212- my_ponderation : Field
235+ my_ponderation : Field or FieldsContainer
213236
214237 Examples
215238 --------
0 commit comments