<jupyter_start><jupyter_text>**Imports**<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy.spatial.distance import euclidean as dist
import syntheticdata_2gauss_shiftpast_20180426 as synth<jupyter_output><empty_output><jupyter_text>**Organize Synth Data**<jupyter_code>peak1_pos = pd.DataFrame(synth.x0_2_shift)
peak1_height = pd.DataFrame(synth.time_coeff_1)
peak2_pos = pd.DataFrame(synth.x0_1_shift)
peak2_height = pd.DataFrame(synth.time_coeff_2 * 0.3)
time_slice = [[[peak2_pos.loc[i][0], peak2_height.loc[i][0], 100.0, i], [peak1_pos.loc[i][0], peak1_height.loc[i][0], 50, i]] for i in range(500)]<jupyter_output><empty_output><jupyter_text>**Sample Time Slice**<jupyter_code>time_slice[327]<jupyter_output><empty_output><jupyter_text>**Classifier and Wrapper**<jupyter_code>peak1_dist = [time_slice[0][0]]
peak2_dist = [time_slice[0][1]]

def euc_dist(time1, time2, peaks):
    for i in range(peaks):
        for j in range(peaks):
            distance = dist(time1[i][:-1], time2[j][:-1])
# Need to make these if, elif statements more generic
            if ( i == 0 and distance <= 50 ):
                peak1_dist.append(time2[j])
            elif ( i == 1 and distance <= 50):
                peak2_dist.append(time2[j])
    return

def dist_all_time(full_array, time):
    for n in range(time):
        euc_dist(full_array[n], full_array[n+1], 2)
    return
dist_all_time(time_slice, 499)<jupyter_output><empty_output><jupyter_text>**Sample Clusters**<jupyter_code>peak1_dist_df = pd.DataFrame(peak1_dist, columns=['Position', 'Height', 'Width', 'Time'])
peak1_dist_df.describe()
peak2_dist_df = pd.DataFrame(peak2_dist, columns=['Position', 'Height', 'Width', 'Time'])
peak2_dist_df.describe()<jupyter_output><empty_output><jupyter_text>**Feature Decay and Shift with Time**<jupyter_code>plt.plot(peak1_dist_df['Time'], peak1_dist_df['Height'], 'o', markersize = 2, label = 'Peak 1')
plt.plot(peak2_dist_df['Time'], peak2_dist_df['Height'], 'o', markersize = 2, label = 'Peak 2')
plt.title('Decay of Identified Peaks')
plt.xlabel('Time')
plt.ylabel('Intensity')
plt.legend()
plt.show()
plt.plot(peak1_dist_df['Time'], peak1_dist_df['Position'], 'o', markersize = 2, label = 'Peak 1')
plt.plot(peak2_dist_df['Time'], peak2_dist_df['Position'], 'o', markersize = 2, label = 'Peak 2')
plt.title('Shift of Identified Peaks')
plt.xlabel('Time')
plt.ylabel('Wavelength $(nm)$')
plt.legend()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16109544905356424, 'fraction_numerical': 0.03624647603705195, 'mean_word_length': 6.327433628318584, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '368025', 'license': 'MIT', 'n_tokens_mistral': 1036, 'n_tokens_neox': 953, 'n_words': 171, 'path': 'code_dev/Peak-Analysis/peak_classifier_synth_shiftpast.ipynb', 'repo_name': 'liud16/capstone18', 'size': '2483'}