interpolate#

PySeismoSoil.helper_generic.interpolate(x_query_min: float, x_query_max: float, n_pts: int, x_ref: ndarray, y_ref: ndarray, log_scale: bool = True, **kwargs_to_interp: dict[Any, Any]) tuple[numpy.ndarray, numpy.ndarray][source]#

Interpolate data (x_ref and y_ref) at x query points defined by x_query_min, x_query_max, and n_pts.

Parameters:
  • x_query_min (float) – Minimum x value at which you want to query (inclusive).

  • x_query_max (float) – Maximum x value at which you want to query (inclusive).

  • n_pts (int) – An array of x values are constructed between x_query_min and x_query_max, at which we query the y values. n_pts controls the length of this array.

  • x_ref (np.ndarray) – Reference x values for interpolation. Must be a 1D numpy array.

  • y_ref (np.ndarray) – Reference y values for interpolation. Must be a 1D numpy array.

  • log_scale (bool) – Whether to construct the query array in log or linear scale.

  • **kwargs_to_interp (dict[Any, Any]) – Extra keyword arguments to be passed to numpy.interp().

Returns:

  • x_query_array (np.ndarray) – A 1D numpy array constructed from x_query_min, x_query_max, and n_pts.

  • y_query_array (np.ndarray) – The interpolation result. Same shape as x_query_array.