<commit_before># -*- coding: utf-8 -*-
import numpy as np


def similarity(traces, duration, dt=1, step_out=1, lag=0):
    """
    Compute similarity for each point of a seismic section using
    a variance method between traces.

    For each point, a kernel of n_samples length is extracted from a
    trace. The similarity is calculated as a normalized variance
    between two adjacent trace sections, where a value of 1 is
    obtained by identical if the traces are identical. The step out
    will decide how many adjacent traces will be used for each kernel,
    and should be increased for poor quality data. The lag determines
    how much neighbouring traces can be shifted when calculating
    similiarity, which should be increased for dipping data.
<commit_msg>added copyright and introductory line<commit_after># -*- coding: utf-8 -*-
"""
A variance method to compute similarity. 

:copyright: 2015 Agile Geoscience
:license: Apache 2.0
"""
import numpy as np


def similarity(traces, duration, dt=1, step_out=1, lag=0):
    """
    Compute similarity for each point of a seismic section using
    a variance method between traces.

    For each point, a kernel of n_samples length is extracted from a
    trace. The similarity is calculated as a normalized variance
    between two adjacent trace sections, where a value of 1 is
    obtained by identical if the traces are identical. The step out
    will decide how many adjacent traces will be used for each kernel,
    and should be increased for poor quality data. The lag determines
    how much neighbouring traces can be shifted when calculating
    similiarity, which should be increased for dipping data.

{'fraction_non_alphanumeric': 0.047619047619047616, 'fraction_numerical': 0.009523809523809525, 'mean_word_length': 3.592896174863388, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2204889', 'n_tokens_mistral': 430, 'n_tokens_neox': 401, 'n_words': 239}