class_docstr: Area under per region overlap (AUPRO) Metric.
class_docstr_tok: ["Area","under","per","region","overlap","(","AUPRO",")","Metric","."]
docstr: Function to interpolate a 1D signal linearly to new sampling points.
  
  Args:
      old_x (Tensor): original 1-D x values (same size as y)
      old_y (Tensor): original 1-D y values (same size as x)
      new_x (Tensor): x-values where y should be interpolated at
  
  Returns:
      Tensor: y-values at corresponding new_x values.
docstr_tok: ["Function","to","interpolate","a","1D","signal","linearly","to","new","sampling","points",".","Args",":","old_x","(","Tensor",")",":","original","1-D","x","values","(","same","size","as","y",")","old_y","(","Tensor",")",":","original","1-D","y","values","(","same","size","as","x",")","new_x","(","Tensor",")",":","x-values","where","y","should","be","interpolated","at","Returns",":","Tensor",":","y-values","at","corresponding","new_x","values","."]
code: def interp1d(old_x: Tensor, old_y: Tensor, new_x: Tensor) -> Tensor:
      """Function to interpolate a 1D signal linearly to new sampling points.
  
      Args:
          old_x (Tensor): original 1-D x values (same size as y)
          old_y (Tensor): original 1-D y values (same size as x)
          new_x (Tensor): x-values where y should be interpolated at
  
      Returns:
          Tensor: y-values at corresponding new_x values.
      """
  
      # Compute slope
      eps = torch.finfo(old_y.dtype).eps
      slope = (old_y[1:] - old_y[:-1]) / (
          eps + (old_x[1:] - old_x[:-1])
      )
  
      # Prepare idx for linear interpolation
      idx = torch.searchsorted(old_x, new_x)
  
      # searchsorted looks for the index where the values must be inserted
      # to preserve order, but we actually want the preceeding index.
      idx -= 1
      # we clamp the index, because the number of intervals = old_x.size(0) -1,
      # and the left neighbour should hence be at most number of intervals -1, i.e. old_x.size(0) - 2
      idx = torch.clamp(idx, 0, old_x.size(0) - 2)
  
      # perform actual linear interpolation
      y_new = old_y[idx] + slope[idx] * (new_x - old_x[idx])
  
      return y_new
  
imports: from __future__ import annotations
  from typing import Any, Callable
  import torch
  from matplotlib.figure import Figure
  from torch import Tensor
  from torchmetrics import Metric
  from torchmetrics.functional import auc
  from torchmetrics.functional.classification import binary_roc
  from torchmetrics.utilities.data import dim_zero_cat
  from anomalib.utils.metrics.pro import connected_components_cpu, connected_components_gpu
  from .binning import thresholds_between_0_and_1, thresholds_between_min_and_max
  from .plotting_utils import plot_figure
label_desc: Use image node_id 8 for calling the AUPRO obj's underlying member method code with example usage: obj.interp1d(old_x, old_y, new_x) and returns: y_new