Skip to content
Oakfield Operator Calculus Function Reference Site

Measurement Operators

sim_add_phase_feature_operator(ctx, src, dst, opts)

Extract phase-aligned magnitude features.

  • threshold (≥0, default 0): magnitude gate.
  • exponent (≥0, default 0): power applied before normalization.
  • accumulate (bool, default false): add instead of overwrite.
  • scale_by_dt (bool, default true): scale when accumulating.

Examples:

sim.sim_add_phase_feature_operator(ctx, signal, feature, {
threshold = 0.1
})
sim.sim_add_phase_feature_operator(ctx, signal, feature, {
exponent = 2.0,
accumulate = true
})

sim_add_minimal_convolution_operator(ctx, src, dst, opts)

Odd-length 1D convolution.

  • kernel_taps (enum 3|5|7|9, default 3).
  • kernel (float array/string): coefficients matching tap count.
  • stride (1..16, default 1).
  • wrap (bool, default true) or boundary (enum periodic|neumann|dirichlet|reflective).
  • accumulate (bool): add instead of overwrite.
  • scale_by_dt (bool): scale when accumulating.

Examples:

sim.sim_add_minimal_convolution_operator(ctx, u, v, {
kernel_taps = 5,
kernel = "-1,0,0,0,1"
})
sim.sim_add_minimal_convolution_operator(ctx, u, v, {
kernel = {0.25, 0.5, 0.25},
boundary = "neumann"
})

Inspect/update minimal convolution at runtime

Section titled “Inspect/update minimal convolution at runtime”
  • sim_minimal_convolution_config(ctx, op_index) -> table returns { kernel_taps, stride, accumulate, wrap, boundary, kernel }.
  • sim_minimal_convolution_update(ctx, op_index, opts) -> true updates any subset. Provide kernel_taps (3/5/7/9) with a matching kernel array/string; boundary accepts the same enum as sim_add_minimal_convolution_operator.
local cfg = sim.sim_minimal_convolution_config(ctx, op_index)
sim.log("conv taps=%d stride=%d boundary=%s", cfg.kernel_taps, cfg.stride, cfg.boundary)
-- Swap in a 5-tap smoothing kernel and stride 2
sim.sim_minimal_convolution_update(ctx, op_index, {
kernel_taps = 5,
kernel = {1, 4, 6, 4, 1},
stride = 2,
wrap = false,
boundary = "reflective",
})

sim_add_sieve_operator(ctx, src, dst, opts)

Gaussian low/high-pass filter.

  • mode (enum): low_pass or high_pass.
  • sigma (>0): Gaussian standard deviation (samples).
  • taps (int): kernel length (odd).
  • accumulate (bool) and scale_by_dt (bool).

Examples:

sim.sim_add_sieve_operator(ctx, src, dst, {
mode = "low_pass",
sigma = 1.2,
taps = 7
})
sim.sim_add_sieve_operator(ctx, src, dst, {
mode = "high_pass",
sigma = 2.0,
accumulate = true
})