Commit 7334440b authored by Gordian Edenhofer's avatar Gordian Edenhofer
Browse files

correlated_field.py: Implement offset in finalize

Allow for specifying either a Field/MultiField or a float as an offset
for the correlated field during `finalize`.
parent f61cb6b2
Pipeline #64953 passed with stages
in 9 minutes and 49 seconds
......@@ -32,6 +32,8 @@ from ..operators.operator import Operator
from ..operators.simple_linear_operators import VdotOperator, ducktape
from ..probing import StatCalculator
from ..sugar import from_global_data, full, makeDomain
from ..field import Field
from ..multi_field import MultiField
def _reshaper(x, N):
......@@ -467,11 +469,16 @@ class CorrelatedFieldMaker:
"""
offset vs zeromode: volume factor
"""
op = self._finalize_from_op()
if offset is not None:
raise NotImplementedError
offset = float(offset)
# Deviations from this offset must not be considered here as they
# are learned by the zeromode
if isinstance(offset, (Field, MultiField)):
op = Adder(offset) @ op
else:
offset = float(offset)
op = Adder(full(op.target, offset)) @ op
op = self._finalize_from_op()
if prior_info > 0:
from ..sugar import from_random
samps = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment