This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brian2 import * | |
# import brian2cuda | |
set_device('cpp_standalone', directory='layers_openmp') | |
prefs.devices.cpp_standalone.openmp_threads = 4 | |
group1 = NeuronGroup(100, 'dv/dt = 100*Hz : 1', threshold='v>1', reset='v=0') | |
group1.v = 'rand()' | |
group2 = NeuronGroup(100, '''dv/dt = -v/tau : 1 | |
tau : second ''', threshold='v>1', reset='v=0') | |
group2.tau = 10*ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import re | |
import requests | |
doi_link = r'(doi: \[.*\]\(https://doi.org/([a-zA-Z0-9/._\-()]+)\))' | |
unpaywall_api = 'https://api.unpaywall.org/v2/' | |
email = 'email@example.com' # ← EMAIL | |
def gather_doi_info(fname): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brian2 import * | |
set_device('cpp_standalone') | |
# Each "input" is one combination of rates across the 5 neurons | |
n_stimuli = 10 | |
rates = TimedArray(np.random.rand(n_stimuli, 5)*100*Hz, dt=100*ms) | |
stimulus_length = 100*ms | |
max_repetitions = 5 | |
input_spikes = NeuronGroup(5, ''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ?> | |
<Lems xmlns="http://www.neuroml.org/lems/0.7.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/lems/0.7.3 https://raw.githubusercontent.com/LEMS/LEMS/development/Schemas/LEMS/LEMS_v0.7.3.xsd"> | |
<Include file="LEMSUnitsConstants.xml"/> | |
<Include file="Simulation.xml"/> | |
<Include file="NeuroML2CoreTypes.xml"/> | |
<ComponentType extends="baseCell" name="neurongroup"> | |
<Property dimension="voltage" name="v0"/> | |
<EventPort direction="out" name="spike"/> | |
<Exposure dimension="voltage" name="v"/> | |
<Dynamics> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brian2 import * | |
# The following example is very contrived, but writing to a variable that is linked with repeating indices | |
# might come up in some contexts. It's clearly a cornercase, but one that we should handle. | |
set_device('cpp_standalone') | |
prefs.devices.cpp_standalone.openmp_threads = 8 # number of threads | |
group1 = NeuronGroup(2, 'x : integer') | |
group2 = NeuronGroup(1000, 'y : integer (linked)') | |
group2.y = linked_var(group1, 'x', index=np.arange(2).repeat(500)) | |
obj = group2.run_regularly('y += 1') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
scenarios = [('constant', [1., 2., 3., 4., 5., 6., 7., 8., 9., 10.], # elapsed time | |
[.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.]), # fraction of simulation completed | |
('varying', [1., 2., 3., 4., 5., 6., 7., 8., 9., 10.], | |
[.1, .175, .3, .375, .5, .575, .7, .775, .9, 1.]), | |
('slow start', [1., 2., 3., 4., 5., 6., 7., 8., 9., 10.], | |
[.05, 0.1, 0.15, 0.2, 0.25, 0.4, 0.55, 0.7, 0.85, 1.0]), | |
('slow end', [1., 2., 3., 4., 5., 6., 7., 8., 9., 10.], |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder