DTW

dtw

logio.dynamic_time_warping.dtw(x, y, dist='euclidean', window_type='none', window_size=None, step_pattern='symmetric2', dist_only=False, open_begin=False, open_end=False)[source]

Perform dynamic time warping (dtw).

A Dynamic Programming algorithm to correlate well logs and to find the minimum-cost or “best” match.

Parameters
  • x (1D or 2D array (sample * feature)) – Query log.

  • y (1D or 2D array (sample * feature)) – Reference log.

  • dist (string or callable) – Define how to calclulate pair-wise distance between x and y. If a string given, it will be interpreted as metric argument of scipy.spatial.distance. If callable that defines metric between two samples, it will be used to compute distance matrix.

  • window_type (string) – Window type to use. If “sakoechiba” given, Sakoechiba window will be used. If “itakura” given, Itakura window will be used.

  • window_size (int) – Window size to use for Sakoechiba window.

  • step_pattern (string) – Step pattern to use.

  • dist_only (bool) – Whether or not to obtain warping path. If true, only alignment distance will be calculated.

  • open_begin (bool) – Whether or not perform open-ended alignment at the starting point of query log. If true, partial alignment will be performed.

  • open_end (bool) – Whether or not perform open-ended alignment at the end point of query log. If true, partial alignment will be performed.

Returns

Result obj.

Return type

result.DtwResult

dtw_from_distance_matrix

logio.dynamic_time_warping.dtw_from_distance_matrix(X, window_type='none', window_size=None, step_pattern='symmetric2', dist_only=False, open_begin=False, open_end=False)[source]

Perform dtw based correlation using pre-computed pair-wise distance matrix.

Parameters
  • X (2D array) – Pre-computed pair-wise distance matrix.

  • others – see dtw() function.

Returns

Result obj.

Return type

result.DtwResult

dtw_low

logio.dynamic_time_warping.dtw_low(X, window, pattern, dist_only=False, open_begin=False, open_end=False)[source]

Low-level dtw interface.

Parameters
  • X (2D array) – Pair-wise distance matrix.

  • window (window.BaseWindow object) – window object.

  • pattern (step_pattern.BasePattern object) – step pattern object.

  • others – see dtw() function.

Returns

Result obj.

Return type

result.DtwResult