Skip to content

interpolate() also extrapolates with no bounds checking #122

@adrian-bodenmann

Description

@adrian-bodenmann

The function interpolate()

def interpolate(x_query, x_lower, x_upper, y_lower, y_upper):

does not check bounds for the query parameter, and so it also extrapolates.

While extrapolating can be useful and intended in some cases, the current implementation makes it hard to spot mistakes, as there are cases where one only wants to interpolate (e.g. cyclic signals, such as tide correction). A bug resulting in querying outside the bounds would go unnoticed with the current implementation, leading to wrong results

Suggestion: add a parameter allow_extrapolation with a default False and set it to true in the function calls that need extrapolation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions