<jupyter_start><jupyter_text>Data ExplorationsThis notebook explores example data files.These data have already been 'pre-processed', including:- Parsing the logfile into a task object- Spike sorting, and saving out the spike results<jupyter_code>%config Completer.use_jedi = False
from pathlib import Path

import numpy as np
import matplotlib.pyplot as plt
# Import local code module
import sys
sys.path.append('..')
from conv.io import get_files, load_task_object<jupyter_output><empty_output><jupyter_text>Settings<jupyter_code># Define subject information
subj = 'example'
session = 'session_0'
# Define the data folder
data_folder = Path('...')

# Define the full subject & session path
full_path = data_folder / subj / session<jupyter_output><empty_output><jupyter_text>Task InformationTiming notes:- XXThings in the task object:- XX- XX<jupyter_code># Load the behavioural data
task = load_task_object('example_task_obj', folder='example_files')
# Check the task data
task
# Check the meta data for the task information object
task.meta
# Check the list of column labels
print([el for el in dir(task) if el[0] != '_'])<jupyter_output><empty_output><jupyter_text>Check Trial Information<jupyter_code># Check the number of trials
print('Number of trial numbers: \t{}'.format(len(set(task.trial['trial']))))
# Check position data
task.position
...<jupyter_output><empty_output><jupyter_text>Check Synchronization<jupyter_code># Plot the sync pulse alignment
task.plot_sync_allignment()<jupyter_output><empty_output><jupyter_text>SpiketimesSpiking data is stored in XX files.<jupyter_code># Get a list of the available spike files
spike_files = get_files(full_path / 'spikes')
# Check the number of available spike files
print('Number of spike files: {}'.format(len(spike_files)))
# Load example spike file
h5file = h5py.File(full_path / 'split_files' / spike_files[3], 'r')

# Extract sorted spike time data
spike_data = h5file['spike_data_sorted']
# Check the available data keys
print(spike_data.keys())
# Calculate and plot the average waveform
avg = np.mean(waveforms, 0)
plt.plot(avg)<jupyter_output><empty_output><jupyter_text>LFP Files...<jupyter_code># Get a list of the available LFP files
lfp_files = get_files(full_path / 'micro_lfp')
# Check the number of avaialble LFP files
print('Number of LFP files: {}'.format(len(lfp_files)))
# Load an example LFP file
f_ind = 0
with open(full_path /  'micro_lfp' / lfp_files[f_ind], 'rb') as pfile:
    temp = load(...)
# Plot an example segment of LFP data
plt.plot(temp)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.104296875, 'fraction_numerical': 0.003125, 'mean_word_length': 6.33810888252149, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '640500', 'license': 'MIT', 'n_tokens_mistral': 856, 'n_tokens_neox': 830, 'n_words': 255, 'path': 'notebooks/A1-ExploreData.ipynb', 'repo_name': 'TomDonoghue/ConvertTEMPLATE', 'size': '2560'}