<jupyter_start><jupyter_text>Hello world: print 1 neuron trace<jupyter_code>import numpy as np
from spikeflow import BPNNModel, IzhikevichNeuronLayer
import spikeflow.drawing_utils.trace_renderers as rend<jupyter_output>/Applications/Anaconda/anaconda/envs/mlbook/lib/python3.6/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters<jupyter_text>Create a neuron layer with a single neuron, and create the model<jupyter_code>model_input_shape = (1,)

nl = IzhikevichNeuronLayer.layer_from_tuples('n1', [
    IzhikevichNeuronLayer.C(a=0.010, b=0.2, c=-65.0, d=6.0, t=30.0, v0=0.0)
])

model = BPNNModel.compiled_model(model_input_shape, [nl], [])<jupyter_output><empty_output><jupyter_text>Run the model for 2000 timesteps<jupyter_code>traces = []

def end_time_step_callback(i, graph, sess, results):
    traces.append(results)
    
data = (np.ones(1,)*(7 if i > 1200 else 0) for i in range(0, 2000))
    
model.run_time(data, end_time_step_callback)<jupyter_output><empty_output><jupyter_text>Extract the data we want (neuron 0's traces) and display<jupyter_code>neuron_layer_0_traces = np.array([r['n1'] for r in traces])

rend.render_figure([rend.IzhikevichNeuronTraceRenderer(neuron_layer_0_traces, 
                                                       'Layer 0 Neuron')], 
                   0, 2000)<jupyter_output><empty_output><jupyter_text>Often ignore first 1000 timesteps (let model settle with 0 input)<jupyter_code>rend.render_figure([rend.IzhikevichNeuronTraceRenderer(neuron_layer_0_traces, 
                                                       'Layer 0 Neuron')], 
                   1000, 2000)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10385438972162742, 'fraction_numerical': 0.03640256959314775, 'mean_word_length': 4.220670391061453, 'pattern_counts': {'":': 0, '<': 20, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '535615', 'license': 'MIT', 'n_tokens_mistral': 707, 'n_tokens_neox': 639, 'n_words': 131, 'path': 'jupyter_examples/example_0_single_neuron.ipynb', 'repo_name': 'colinator/spikeflow', 'size': '1868'}