<jupyter_start><jupyter_text>Plot output from OSGIn the [demo to run python on the open science grid (OSG)](https://github.com/srcole/demo_OSG_python), we generated compressed numpy files that contain our results.In this notebook, we extract these results and plot them on our data to confirm that our program ran correctly.  1. iterate through tar files and unzip them<jupyter_code>import tarfile

fname_base = '/gh/data/example/lfp_set_PsTs/out.29419325.'
Nfiles = 10
for n in range(Nfiles):
    fname = fname_base + str(n) + '.tar.gz'
    tar = tarfile.open(fname, "r:gz")
    tar.extractall('/gh/data/example/lfp_set_PsTs/' + str(n) + '/')
    tar.close()<jupyter_output><empty_output><jupyter_text>2. Load each array of Ps and Ts<jupyter_code>import numpy as np

Ps = np.zeros(Nfiles, dtype=np.ndarray)
Ts = np.zeros(Nfiles, dtype=np.ndarray)
for n in range(Nfiles):
    Ps[n] = np.load('/gh/data/example/lfp_set_PsTs/' + str(n) + '/out/Ps_data.npy')
    Ts[n] = np.load('/gh/data/example/lfp_set_PsTs/' + str(n) + '/out/Ts_data.npy')<jupyter_output><empty_output><jupyter_text>3. Load signals<jupyter_code>lfps = np.zeros(Nfiles, dtype=np.ndarray)
for n in range(Nfiles):
    if n == 0:
        lfps[n] = np.load('/gh/data/example/lfp_set/' + str(10) + '.npy')
    else:
        lfps[n] = np.load('/gh/data/example/lfp_set/' + str(n) + '.npy')<jupyter_output><empty_output><jupyter_text>4. Plot peaks and troughs on top of signals<jupyter_code>import matplotlib.pyplot as plt
%matplotlib inline

plt.figure(figsize=(10,10))
for n in range(Nfiles):
    plt.subplot(Nfiles, 1, n+1)
    plt.plot(lfps[n], 'k')
#     plt.plot(Ps[n], lfps[n][Ps[n]], 'bo')
#     plt.plot(Ts[n], lfps[n][Ts[n]], 'ro')
    if n == Nfiles-1:
        plt.xlabel('Time (ms)')
    else:
        plt.xticks([])
    plt.ylim((-3000,3000))
    plt.yticks([-3000,0,3000])
    if n == 0:
        plt.ylabel('Voltage (uV)')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16623376623376623, 'fraction_numerical': 0.02181818181818182, 'mean_word_length': 4.028720626631854, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '358515', 'license': 'MIT', 'n_tokens_mistral': 816, 'n_tokens_neox': 771, 'n_words': 161, 'path': 'demo_OSG_python/demo_osg_python - plot input.ipynb', 'repo_name': 'srcole/qwm', 'size': '1925'}