<jupyter_start><jupyter_text>Load query and sequence<jupyter_code>dict_ecg = tssearch.load_ecg_example()

tq, query = dict_ecg['tq'], dict_ecg['query']
ts, sequence = dict_ecg['ts'], dict_ecg['sequence']<jupyter_output><empty_output><jupyter_text>Time series visualization<jupyter_code>fig, axs = plt.subplots(1, 2, gridspec_kw={'width_ratios': [6, 1]}, sharey=True, figsize=(15,4))
axs[0].set_ylabel('Amplitude')
axs[0].set_xlabel('Time / s')
axs[0].set_title('Sequence')
axs[0].plot(ts, sequence , color='gray')
axs[1].set_title('Query')
axs[1].plot(tq, query)
axs[1].set_xlabel('Time / s');<jupyter_output><empty_output><jupyter_text>Define distance configuration file<jupyter_code>dict_distances = {
    "elastic": {
        "Dynamic Time Warping": {
            "function": "dtw",
            "parameters": {"dtw_type": "sub-dtw", "alpha": 0.5},
        }
    },
    "lockstep": {
        "Euclidean Distance": {
            "function": "euclidean_distance",
            "parameters": "",
      }   
    }
}

# dict_distances = tssearch.get_distances_by_type("elastic")
# dict_distances = tssearch.get_distance_dict(["Dynamic Time Warping", "Euclidean Distance"])
# dict_distances['elastic']['Time Warp Edit Distance'] = tssearch.get_distances_by_type("elastic")['elastic']['Time Warp Edit Distance']
# dict_distances['elastic']['Longest Common Subsequence'] = tssearch.get_distances_by_type("elastic")['elastic']['Longest Common Subsequence']
# dict_distances['elastic']['Longest Common Subsequence']['parameters']['eps'] = 10

dict_distances<jupyter_output><empty_output><jupyter_text>Query search<jupyter_code>result = tssearch.time_series_search(dict_distances, query, sequence, tq, ts, output=("number", 5))

tssearch.plot_search_distance_result(result, sequence, ts);<jupyter_output><empty_output><jupyter_text>Query search with weights<jupyter_code>sequence_copy = dict_ecg['sequence_noise'] 
weight = dict_ecg['weight']
fig, axs = plt.subplots(1, 2, gridspec_kw={'width_ratios': [6, 1]}, sharey=True, figsize=(15,4))

axs[0].set_ylabel('Amplitude')
axs[0].set_title('Sequence')
axs[0].plot(ts, sequence_copy, color='gray')
axs[0].set_xlabel('Time / s')
axs[1].set_title('Query')
axs[1].set_xlabel('Time / s')
#axs[1].plot(tq, query, 'lightgray', alpha=0.5)
tssearch.plot_weight_query(tq, query, weight, axs=axs[1], cmap='cividis', fig=fig)
result = tssearch.time_series_search(dict_distances, query, sequence_copy, tq, ts, output=("number", 13))

tssearch.plot_search_distance_result(result, sequence_copy, ts, cmap_name='Greens')
result = tssearch.time_series_search(dict_distances, query, sequence_copy, tq, ts, weight, output=("number", 13))

tssearch.plot_search_distance_result(result, sequence_copy, ts);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16781692698873957, 'fraction_numerical': 0.01452960406828914, 'mean_word_length': 7.37082066869301, 'pattern_counts': {'":': 10, '<': 21, '<?xml version=': 0, '>': 21, '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}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '396902', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1003, 'n_words': 152, 'path': 'notebooks/Query_search_unidimensional.ipynb', 'repo_name': 'mluacnunes/tssearch', 'size': '2753'}