result

DtwResult

class logio.dynamic_time_warping.DtwResult(cumsum_matrix, path, window, pattern)[source]

Result of Dynamic time warping.

cumsum_matrix

Alignment matrix

Type

2d array

path
Alignment path.
  • First column: query path array

  • Second column: reference path array

Type

float

window

window constraints

Type

2d array

pattern

Alignment pattern

Type

2d array

get_warping_path(target="query"):

Get warping path.

plot_window():

visualize window

plot_cumsum_matrix():

plot heatmap of cumsum_matrix

plot_path(with_="cum"):

plot alignment path; warp function/curve

plot_pattern():

Plot alignment pattern

dtw_plot(query=None,reference=None, type=None,**kwargs):

Plot dynamic time warp results using specific type plot.

plot_aligned_logs(query=None,reference=None):

plot optimal aligment of both logs.

__init__(cumsum_matrix, path, window, pattern)[source]

Constructs all the necessary attributes for the DtwResult object.

Parameters
  • cumsum_matrix (2d array) – Alignment matrix

  • path (float) –

    Alignment path.
    • First column: query path array

    • Second column: reference path array

  • window (2d array) – window constraints

  • pattern (2d array) – Alignment pattern

dtw_plot(query=None, reference=None, type=None, **kwargs)[source]

Plot dynamic time warp results by displaying alignment contained in DtwResult object.

Details Various plotting styles are available, passing strings to the type argument (may be abbreviated):

  • alignment plots the warping curve in alignment_vector;

  • threeway vis-a-vis inspection of the timeseries and their warping curve;

    see [dtwPlot.ThreeWayPlot()]

Additional parameters are passed to the plotting functions: use with care.

Parameters
  • query – log from another well, which we intend to correlate or align with the reference log

  • reference – reference log (log of considerable interest)

  • xlab (str) – label for the query axis

  • ylab (str) – label for the reference axis

  • type (str) – general style for the plot, see below

  • ... – additional arguments, passed to plotting functions

get_warping_path(target='query')[source]

Get warping path.

Parameters

target (string, "query" or "reference") – Specify the target to be warped.

Returns

warping_index – Warping index.

Return type

1D array

plot_aligned_logs(query=None, reference=None)[source]

Plot query log such that it is locally stretched and/or compressed in order to achieve the best possible match to the reference.

Parameters
  • query (array, DataFrame or Series) – log from another well, which we intend to correlate or align with the reference log.

  • reference (array, DataFrame or Series) – well log used as reference point for correlation.

plot_cumsum_matrix()[source]

Plot heatmap of cumsum matrix

plot_path(with_='cum')[source]

Plot alignment path.

Parameters

with (string, "win" or "cum" or None) – If given, following will be plotted with alignment path: * “win” : window matrix * “cum” : cumsum matrix

plot_pattern()[source]

plot step_pattern

plot_window()[source]

Visualize window constraint