<jupyter_start><jupyter_text>Example 1: Post-synaptic response of a single synapse This is an example of **``LFPy``** running in an **``Jupyter notebook``**. To run through this example code and produce output, press **````** in each code block below.First step is to `import LFPy` and other packages for analysis and plotting:<jupyter_code>import LFPy<jupyter_output><empty_output><jupyter_text>Then, create the cell object using the `LFPy.Cell` class, specifying the morphology file.The passive mechanismsare not switched on by default.<jupyter_code>cell = LFPy.Cell(morphology='morphologies/L5_Mainen96_LFPy.hoc', passive=True)<jupyter_output><empty_output><jupyter_text>One can now use `LFPy.Synapse` class to insert a single synapse onto the soma compartment, and set the spike time(s) using `LFPy.Synapse.set_spike_times()` method:<jupyter_code>synapse = LFPy.Synapse(cell, 
                       idx=cell.get_idx("soma[0]"),
                       syntype='Exp2Syn', 
                       weight=0.005, 
                       e=0, 
                       tau1=0.5,
                       tau2=2,
                       record_current=True)
synapse.set_spike_times(array([20., 40]))<jupyter_output><empty_output><jupyter_text>We now have what we need in order to calculate the postsynaptic response,using a built in method `LFPy.Cell.simulate()` to run the simulation.<jupyter_code>cell.simulate()<jupyter_output><empty_output><jupyter_text>Then plot the model geometry, synaptic current and somatic potential:<jupyter_code>figure(figsize=(12, 9))
subplot(222)
plot(cell.tvec, synapse.i, 'r'), title('synaptic current (pA)')
subplot(224)
plot(cell.tvec, cell.somav, 'k'), title('somatic voltage (mV)')
subplot(121)
plot(cell.x.T, cell.z.T, 'k')
plot(synapse.x, synapse.z,
     color='r', marker='o', markersize=10)
axis([-500, 500, -400, 1200])

# savefig('LFPy-example-01.pdf', dpi=200)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12558380902957966, 'fraction_numerical': 0.026984950700570835, 'mean_word_length': 4.182795698924731, 'pattern_counts': {'":': 0, '<': 21, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '102609', 'license': 'MIT', 'n_tokens_mistral': 704, 'n_tokens_neox': 636, 'n_words': 160, 'path': 'LFPy-example-01.ipynb', 'repo_name': 'LFPy/LFPy_EBRAINS_showcase', 'size': '1927'}