<jupyter_start><jupyter_text>Roadmap$$ \text{Raster}\xleftarrow{\text{1ms bin}} \text{Relative Response: } T \times (N * B)$$$$\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\downarrow{\frac{\Sigma{\text{ (columns: T)}}} {\text{T in E}}} $$$$ PSTH $$$$\text{T = trials | N = neurons | B = bins | E = events}$$  Goal* Find neurons' relative response to each trial* Create the relative response matrix: Trials×(Neurons*Total Bins)  * Create raster plot if bin size = 1ms  * Sum columns and create PSTH    * Plot PSTHS    * Receptive field analysis if bin size = 5ms $$\pagebreak$$  JSON Example```json{    "events": {        "event_1": [104.615425, 111.9553, 183.5854, 214.3664, 228.426425],        "event_4": [73.058, 81.14745, 91.436575, 97.80635, 101.70715]    },    "neurons": {        "sig001a": [36.036825, 36.077825, 36.11535, 36.1392, 36.14845],        "sig007c": [0.08645, 0.11895, 0.15845, 0.166475, 0.2861]    }}```  Matlab: Reading JSON```m% Read in JSON file via file path and filenamefile = fullfile(file_path, filename);fid = fopen(file);raw_data = fread(fid,inf);str_data = char(raw_data');fclose(fid);example_data = jsondecode(str_data);example_data = jsondecode(str_data);% Gives you the keys within the neurons keyneuron_names = fieldnames(example_data.neurons)for neuron_i = 1:length(neuron_names)    % Get current neuron fieldname    neuron = neuron_names{neuron_i};    % Get timestamps stored in struct    neuron_ts = example_data.neurons.(neuron);end```<jupyter_code># Python: Reading JSON
import json

# Example assumes python code is in same directory as example json
with open('hw1_example.json') as f:
    example_data = json.load(f)

for k, v in example_data['neurons'].items():
    print(f'Neuron name: {k}\nFirst 5 spikes: {v[0:5]}')<jupyter_output>Neuron name: sig001a
First 5 spikes: [36.036825, 36.077825, 36.11535, 36.1392, 36.14845]
Neuron name: sig007c
First 5 spikes: [0.08645, 0.11895, 0.15845, 0.166475, 0.2861]
{'fraction_non_alphanumeric': 0.17662072485962227, 'fraction_numerical': 0.11740684022460439, 'mean_word_length': 4.297297297297297, 'pattern_counts': {'":': 6, '<': 4, '<?xml version=': 0, '>': 4, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '468670', 'license': 'MIT', 'n_tokens_mistral': 883, 'n_tokens_neox': 695, 'n_words': 185, 'path': 'hw1_discussion.ipynb', 'repo_name': 'moxon-lab-codebase/BIM289-discussion', 'size': '1959'}