Skip to content

Proposal for simplifying the Field Interpolator API #2287

@erikvansebille

Description

@erikvansebille

(This Issue continues on #2059, but is a bit more specific)

The current v4-dev signature for Interpolators is

def Interpolator(
    field: Field,
    ti: int,
    position: dict[_XGRID_AXES, tuple[int, float | np.ndarray]],
    tau: np.float32 | np.float64,
    t: np.float32 | np.float64,
    z: np.float32 | np.float64,
    y: np.float32 | np.float64,
    x: np.float32 | np.float64,
) -> np.float32 | np.float64:

Now, I would propose that we simplify this to:

def Interpolator(
    positions: dict[_XGRID_AXES, tuple[int, float | np.ndarray]],
    field: Field,
) -> np.float32 | np.float64:

where the (ti, tau) tuple also becomes part of positions plural, as it is vectorized (thinking spacetime-dimensions). We also don't need the physical coordinates (t, z, y, x) as input because we can always recompute these from the computational coordinates if needed.

I also swapped the order of the two remaining arguments to mirror the Kernel signature (which is Kernel(particles, fieldset)).

Any objections to this proposal?

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions