Esempio n. 1
0
def CreateSimilarPatternsResponse(array, start_time, duration, seen_events,
                                  sampling_freq):
    """Searches similar patterns in an array of data.

  Args:
    array: Numpy array with shape (n_channels, n_data).
    start_time: seconds to start the window.
    duration: duration of the window.
    seen_events: Array of TimeSpan protos, representing previously seen events.
      The algorithm will avoid results that are already seen.
    sampling_freq: Sampling frequency used in the data, in hz.
  Returns:
    SimilarPatternsResponse with the results found.
  """

    response = similarity_pb2.SimilarPatternsResponse()

    similar_patterns = SearchSimilarPatterns(array,
                                             start_time,
                                             duration,
                                             seen_events,
                                             sampling_freq=sampling_freq)
    response.similar_patterns.extend(similar_patterns)

    return response
Esempio n. 2
0
def CreateSimilarPatternsResponse(array, start_time, duration, sampling_freq):
  """Searches similar patterns in an array of data.

  Args:
    array: Numpy array with shape (n_channels, n_data).
    start_time: seconds to start the window.
    duration: duration of the window.
    sampling_freq: Sampling frequency used in the data, in hz.
  Returns:
    SimilarPatternsResponse with the results found.
  """

  response = similarity_pb2.SimilarPatternsResponse()

  similar_patterns = SearchSimilarPatterns(
      array,
      start_time,
      duration,
      sampling_freq=sampling_freq)
  response.similar_patterns.extend(similar_patterns)

  return response