### Instantiate BCMSynapse Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/hebbian/BCMSynapse.html Demonstrates how to instantiate the BCMSynapse component within a simulation context. This example shows basic parameter setup for a synapse. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = BCMSynapse("Wab", (2, 3), 0.0004, 1, 1) print(Wab) ``` -------------------------------- ### Install ngc-learn from Source Source: https://ngc-learn.readthedocs.io/en/latest/installation.html Install the ngc-learn package after cloning the repository. Use the editable install option for development purposes. ```bash $ pip install . ``` ```bash $ pip install -e . ``` -------------------------------- ### Install NGC-Learn Package from Source Source: https://ngc-learn.readthedocs.io/en/latest/_sources/installation.md.txt Install the NGC-Learn package after cloning the repository. Use this command for a standard installation from source. ```bash $ pip install . ``` -------------------------------- ### QuadLIFCell Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/spiking/quadLIFCell.html Demonstrates how to initialize a QuadLIFCell within a simulation context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = QuadLIFCell("X", 9, 0.0004, 3) print(X) ``` -------------------------------- ### ExpSTDPSynapse Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/hebbian/expSTDPSynapse.html Demonstrates how to instantiate an ExpSTDPSynapse object with specified parameters within a ngcsimlib Context. This is a basic usage example. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = ExpSTDPSynapse("Wab", (2, 3), 1, 1, 1, 0.0004, 1) print(Wab) ``` -------------------------------- ### sLIFCell Example Initialization Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/spiking/sLIFCell.html Demonstrates how to initialize an sLIFCell with specified parameters within a simulation context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = SLIFCell("X", 9, 0.0004, 3, 0.3) print(X) ``` -------------------------------- ### Install CPU Version of NGC-Learn Source: https://ngc-learn.readthedocs.io/en/latest/_sources/installation.md.txt Use this command to install the CPU-only version of NGC-Learn. This is the default if no JAX is pre-installed or only the CPU version of JAX is installed. ```bash $ pip install ngclearn ``` -------------------------------- ### LIFCell Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/spiking/LIFCell.html Demonstrates how to initialize a LIFCell with specified parameters and print its representation. Requires the ngcsimlib.context module. ```python from ngcsimlib.context import Context with Context("Bar") as bar: X = LIFCell("X", 9, 0.0004, 3) print(X) ``` -------------------------------- ### AdExCell Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/spiking/adExCell.html Demonstrates how to initialize an AdExCell component within a Context. This example shows the creation of an AdExCell instance with specified parameters. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = AdExCell("X", 9) print(X) ``` -------------------------------- ### Example Logging Configuration (Write to File) Source: https://ngc-learn.readthedocs.io/en/latest/_sources/tutorials/model_basics/configuration.md.txt An example configuration that directs all logging messages to a specified file and hides console output. It also sets the logging level to INFO. ```json { "logging": { "logging_file": "path/to/log/file.txt", "logging_level": "INFO", "hide_console": true } } ``` -------------------------------- ### ART2ASynapse Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/competitive/ART2ASynapse.html Demonstrates how to initialize an ART2ASynapse object. This requires setting up a context and providing parameters for the synapse. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = ART2ASynapse("Wab", (2, 3), 4, 4, 1.) print(Wab) ``` -------------------------------- ### REINFORCE Synapse Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/modulated/REINFORCESynapse.html Demonstrates how to initialize and use the REINFORCE Synapse component within the NGC Learn framework. This example shows setting up the synapse with a specified shape and accessing its weights. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: syn = REINFORCESynapse( name="reinforce_syn", shape=(3, 2) ) # Wab = syn.weights.get() print(syn) ``` -------------------------------- ### Adam Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/utils/optim/adam.html Demonstrates the usage of Adam initialization and step update with sample weights and updates. ```python import numpy as np from jax import jit, numpy as jnp, random, nn, lax from functools import partial [docs] def step_update(param, update, g1, g2, eta, beta1, beta2, time_step, eps): """ Runs one step of Adam over a set of parameters given updates. The dynamics for any set of parameters is as follows: | g1 = beta1 * g1 + (1 - beta1) * update | g2 = beta2 * g2 + (1 - beta2) * (update)^2 | g1_unbiased = g1 / (1 - beta1**time) | g2_unbiased = g2 / (1 - beta2**time) | param = param - lr * g1_unbiased / (sqrt(g2_unbiased) + epsilon) Args: param: parameter tensor to change/adjust update: update tensor to be applied to parameter tensor (must be same shape as "param") g1: first moment factor/correction factor to use in parameter update (must be same shape as "update") g2: second moment factor/correction factor to use in parameter update (must be same shape as "update") eta: global step size value to be applied to updates to parameters beta1: 1st moment control factor beta2: 2nd moment control factor time_step: current time t or iteration step/call to this Adam update eps: numberical stability coefficient (for calculating final update) Returns: adjusted parameter tensor (same shape as "param"), adjusted g1, adjusted g2 """ _g1 = beta1 * g1 + (1. - beta1) * update _g2 = beta2 * g2 + (1. - beta2) * jnp.square(update) g1_unb = _g1 / (1. - jnp.power(beta1, time_step)) g2_unb = _g2 / (1. - jnp.power(beta2, time_step)) _param = param - eta * g1_unb/(jnp.sqrt(g2_unb) + eps) return _param, _g1, _g2 [docs] @jit def adam_step(opt_params, theta, updates, eta=0.001, beta1=0.9, beta2=0.999, eps=1e-8): ## apply adjustment to theta """Implements the adaptive moment estimation (Adam) algorithm as a decoupled update rule given adjustments produced by a credit assignment algorithm/process. Args: opt_params: (ArrayLike) parameters of the optimization algorithm theta: (ArrayLike) the weights of neural network updates: (ArrayLike) the updates of neural network eta: (float, optional) step size coefficient for Adam update (Default: 0.001) beta1: (float, optional) 1st moment control factor. (Default: 0.9) beta2: (float, optional) 2nd moment control factor. (Default: 0.999) eps: (float, optional) numberical stability coefficient (for calculating final update). (Default: 1e-8) Returns: ArrayLike: opt_params. New opt params, ArrayLike: theta. The updated weights """ g1, g2, time_step = opt_params time_step = time_step + 1 new_theta = [] new_g1 = [] new_g2 = [] for i in range(len(theta)): px_i, g1_i, g2_i = step_update(theta[i], updates[i], g1[i], g2[i], eta, beta1, beta2, time_step, eps) new_theta.append(px_i) new_g1.append(g1_i) new_g2.append(g2_i) return (new_g1, new_g2, time_step), new_theta [docs] @jit def adam_init(theta): time_step = jnp.asarray(0.0) g1 = [jnp.zeros(theta[i].shape) for i in range(len(theta))] g2 = [jnp.zeros(theta[i].shape) for i in range(len(theta))] return g1, g2, time_step if __name__ == '__main__': weights = [jnp.asarray([3.0, 3.0]), jnp.asarray([3.0, 3.0])] updates = [jnp.asarray([3.0, 3.0]), jnp.asarray([3.0, 3.0])] opt_params = adam_init(weights) opt_params, theta = adam_step(opt_params, weights, updates) print(f"opt_params: {opt_params}, theta: {theta}") ``` -------------------------------- ### MPS Synapse Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/mpsSynapse.html Example of initializing an MPSSynapse component within a ngcsimlib Context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("MPS_Test") as ctx: Wab = MPSSynapse("Wab", (10, 5), bond_dim=4) print(Wab) ``` -------------------------------- ### EventSTDPSynapse Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/hebbian/eventSTDPSynapse.html Demonstrates how to instantiate an EventSTDPSynapse component with a specified name, shape, and initial weight bound. This example is useful for setting up a new synapse in a simulation context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = EventSTDPSynapse("Wab", (2, 3), 1.) print(Wab) ``` -------------------------------- ### Install NGC-Learn as Editable Install Source: https://ngc-learn.readthedocs.io/en/latest/_sources/installation.md.txt Install the NGC-Learn package in editable mode from source. This is useful for development purposes, allowing changes to be reflected immediately. ```bash $ pip install -e . ``` -------------------------------- ### ExpKernel Class Definition and Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/other/expKernel.html Shows the definition of the ExpKernel class and a basic example of its instantiation and usage within a Context manager. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = ExpKernel("X", 1, 1.) print(X) ``` -------------------------------- ### DenseSynapse Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/denseSynapse.html Demonstrates how to instantiate a DenseSynapse component with specified dimensions and context. This is useful for setting up dense synaptic layers in a simulation. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = DenseSynapse("Wab", (2, 3)) print(Wab) ``` -------------------------------- ### Verify NGC-Learn Installation Source: https://ngc-learn.readthedocs.io/en/latest/_sources/installation.md.txt Verify that NGC-Learn has been installed successfully by importing it in a Python interpreter and checking its version. A successful import and version display indicate a correct installation. ```python Python 3.11.4 (main, MONTH DAY YEAR, TIME) [GCC XX.X.X] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ngclearn >>> ngclearn.__version__ '3.0.1' ``` -------------------------------- ### PatchedSynapse Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/patched/patchedSynapse.html Demonstrates the instantiation and basic usage of the PatchedSynapse component, including visualization of its weights. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = PatchedSynapse("Wab", (9, 30), 3) print(Wab) plt.imshow(Wab.weights.get(), cmap='gray') plt.show() ``` -------------------------------- ### NAG Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/utils/optim/nag.html Demonstrates the usage of the `nag_init` and `nag_step` functions with sample weights and updates. It shows how the parameters evolve over two steps of the NAG algorithm. ```python if __name__ == '__main__': weights = [jnp.asarray([3.0, 3.0]), jnp.asarray([3.0, 3.0])] updates = [jnp.asarray([3.0, 3.0]), jnp.asarray([3.0, 3.0])] opt_params = nag_init(weights) opt_params, theta = nag_step(opt_params, weights, updates) print(f"opt_params: {opt_params}, theta: {theta}") weights = theta print("##################") opt_params, theta = nag_step(opt_params, weights, updates) print(f"opt_params: {opt_params}, theta: {theta}") ``` -------------------------------- ### SGD Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/utils/optim/sgd.html Demonstrates the usage of the sgd_step function with sample parameters, weights, updates, and step size. ```python if __name__ == '__main__': opt_params, theta = sgd_step((2.0), [1.0, 1.0], [3.0, 4.0], 3e-2) print(f"opt_params: {opt_params}, theta: {theta}") ``` -------------------------------- ### Clone NGC-Learn Repository Source: https://ngc-learn.readthedocs.io/en/latest/_sources/installation.md.txt Clone the NGC-Learn repository from GitHub and navigate into the project directory. This is the first step for installing from source. ```bash $ git clone https://github.com/NACLab/ngc-learn.git $ cd ngc-learn ``` -------------------------------- ### BernoulliCell Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/input_encoders/bernoulliCell.html Demonstrates basic usage of the BernoulliCell by creating an instance and setting its batch size within a Context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = BernoulliCell("X", 9) X.batch_size.set(10) ``` -------------------------------- ### TraceSTDPSynapse Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/hebbian/traceSTDPSynapse.html Demonstrates how to instantiate and print a TraceSTDPSynapse component within a ngcsimlib Context. This shows basic usage and initialization. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = TraceSTDPSynapse("Wab", (2, 3), 1, 1, 0.0004) print(Wab) ``` -------------------------------- ### Hodgkin-Huxley Cell Initialization Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/spiking/hodgkinHuxleyCell.html This snippet demonstrates how to instantiate and initialize a HodgkinHuxleyCell component within the NGC Learn simulation context. It shows the basic setup for creating a cell layer. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = HodgkinHuxleyCell("X", 1, 1.) print(X) ``` -------------------------------- ### LeakyNoiseCell Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/graded/leakyNoiseCell.html Demonstrates a basic example of how to instantiate and use the LeakyNoiseCell within an ngcsimlib Context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = LeakyNoiseCell("X", 9, 0.03) print(X) ``` -------------------------------- ### IFCell Compartment Setup Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/spiking/IFCell.html Initializes the compartments for the IFCell, including current, voltage, spikes, refractory period, and time-of-last-spike. This setup is crucial before the cell can be simulated. ```python ## Compartment setup restVals = jnp.zeros((self.batch_size, self.n_units)) self.j = Compartment(restVals, display_name="Current", units="mA") self.v = Compartment(restVals + self.v_rest, display_name="Voltage", units="mV") self.s = Compartment(restVals, display_name="Spikes") self.rfr = Compartment(restVals + self.refract_T, display_name="Refractory Time Period", units="ms") self.tols = Compartment(restVals, display_name="Time-of-Last-Spike", units="ms") ## time-of-last-spike #self.surrogate = Compartment(restVals + 1., display_name="Surrogate State Value") ``` -------------------------------- ### Import Dynamic Synapse Models and Setup Source: https://ngc-learn.readthedocs.io/en/latest/_sources/tutorials/neurocog/dynamic_synapses.md.txt Imports necessary components from ngc-learn and JAX for dynamic synapse modeling. Sets up meta-parameters for simulation duration and time constant. ```python from jax import numpy as jnp, random, jit from ngclearn import Context, MethodProcess from ngclearn.components import ExponentialSynapse, AlphaSynapse, DoubleExpSynapse from ngclearn.utils.distribution_generator import DistributionGenerator dkey = random.PRNGKey(1234) ## creating seeding keys for synapses dkey, *subkeys = random.split(dkey, 6) dt = 0.1 # ms ## integration time constant T = 8. # ms ## total duration time ``` -------------------------------- ### Initialize and Print SOMSynapse Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/competitive/SOMSynapse.html Demonstrates how to initialize a SOMSynapse object and print its representation. Requires ngcsimlib.context.Context for proper initialization. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = SOMSynapse("Wab", (2, 3), 4, 4, 1.) print(Wab) ``` -------------------------------- ### KNNProbe Initialization and Usage Example Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/utils/analysis/knn_probe.html Demonstrates how to initialize a KNNProbe, update it with data, and process inputs to observe the output. This is useful for verifying the probe's functionality and understanding its behavior with sample data. ```python seed = 42 D = 7 C = 5 dkey = random.PRNGKey(seed) dkey, *subkeys = random.split(dkey, 3) knn = KNNProbe( subkeys[0], 1, input_dim=D, out_dim=C, K=1, dist_function="euclidean" ) X = random.uniform(subkeys[1], shape=(10, D)) Y = jnp.concat( [ jnp.ones((2, C)) * jnp.array([[1., 0., 0., 0., 0.]]), jnp.ones((2, C)) * jnp.array([[0., 1., 0., 0., 0.]]), jnp.ones((2, C)) * jnp.array([[0., 0., 1., 0., 0.]]), jnp.ones((2, C)) * jnp.array([[0., 0., 0., 1., 0.]]), jnp.ones((2, C)) * jnp.array([[0., 0., 0., 0., 1.]]) ], axis=0 ) knn.update(X, Y) ## fit KNN to data print(knn.process(X)) ## should construct the (smeared) identity matrix, exactly same as Y ``` -------------------------------- ### RetinalGanglionCell Example Usage Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/input_encoders/ganglionCell.html Demonstrates how to instantiate and use the RetinalGanglionCell component within a simulation context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = RetinalGanglionCell( "RGC", filter_type="gaussian", sigma=2.3, area_shape=(16, 26), n_cells = 3, patch_shape=(16, 16), step_shape=(0, 5) ) print(X) ``` -------------------------------- ### Setting up a Trace-Based STDP Model Source: https://ngc-learn.readthedocs.io/en/latest/_sources/tutorials/neurocog/stdp.md.txt This code initializes a system with two VarTrace components and a TraceSTDPSynapse. It demonstrates how to wire these components and define methods for evolving the synapse and advancing the state of the traces. ```python from jax import numpy as jnp, random, jit from ngclearn import Context, MethodProcess ## import model-specific mechanisms from ngclearn.components.other.varTrace import VarTrace from ngclearn.components.synapses.hebbian.traceSTDPSynapse import TraceSTDPSynapse from ngclearn.utils.distribution_generator import DistributionGenerator ## create seeding keys (JAX-style) dkey = random.PRNGKey(231) dkey, *subkeys = random.split(dkey, 2) dt = 1. # ms # integration time constant T_max = 100 ## number time steps to simulate with Context("Model") as model: tr0 = VarTrace("tr0", n_units=1, tau_tr=8., a_delta=1.) tr1 = VarTrace("tr1", n_units=1, tau_tr=8., a_delta=1.) W = TraceSTDPSynapse( "W1", shape=(1, 1), eta=0., A_plus=1., A_minus=0.8, weight_init=DistributionGenerator.uniform(low=0.0, high=0.3), key=subkeys[0] ) # wire only relevant compartments to synaptic cable W for demo purposes tr0.trace >> W.preTrace # self.z0.outputs >> self.W1.preSpike ## we disable this as we will manually ## insert a binary value (for a spike) in this tutorial tr1.trace >> W.postTrace # self.z1e.s >> self.W1.postSpike ## we disable this as we will manually ## insert a binary value (for a spike) in this tutorial evolve_synapse = (MethodProcess("evolve") >> W.evolve) advance_traces = (MethodProcess("advance") >> tr0.advance_state >> tr1.advance_state >> W.advance_state) reset = (MethodProcess("reset") >> tr0.reset >> tr1.reset >> W.reset) ## set up some utility functions for the model context def clamp_synapse(pre_spk, post_spk): W.preSpike.set(pre_spk) W.postSpike.set(post_spk) def clamp_traces(pre_spk, post_spk): tr0.inputs.set(pre_spk) tr1.inputs.set(post_spk) ``` -------------------------------- ### Example Usage (Fitzhugh-Nagumo Cell) Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/spiking/fitzhughNagumoCell.html Demonstrates how to instantiate and use the FitzhughNagumoCell component within a ngcsimlib Context. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = FitzhughNagumoCell("X", 9) print(X) ``` -------------------------------- ### RewardErrorCell Initialization and Print Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/neurons/graded/rewardErrorCell.html Demonstrates how to initialize a RewardErrorCell and print its representation. This is useful for verifying component setup. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: X = RewardErrorCell("X", 9, 0.03) print(X) ``` -------------------------------- ### Initialize and Print VectorQuantizeSynapse Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/competitive/vectorQuantizeSynapse.html Demonstrates how to initialize a VectorQuantizeSynapse and print its representation. This is useful for verifying the synapse's creation and initial state. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = VectorQuantizeSynapse("Wab", (2, 3), 4, 4, 1.) print(Wab) ``` -------------------------------- ### Make Video Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/utils/viz/synapse_plot.html Placeholder function for creating a video from a start and end frame. The implementation is not provided in the source. ```python def make_video( f_start, f_end, path, prefix, ``` -------------------------------- ### Instantiate HopfieldSynapse Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/components/synapses/competitive/hopfieldSynapse.html Demonstrates how to instantiate the HopfieldSynapse class within a context. Requires importing Context and HopfieldSynapse. ```python if __name__ == '__main__': from ngcsimlib.context import Context with Context("Bar") as bar: Wab = HopfieldSynapse("Wab", (2, 3), 4, 4, 1.) print(Wab) ``` -------------------------------- ### PatchGenerator Iterator Implementation Source: https://ngc-learn.readthedocs.io/en/latest/_modules/ngclearn/utils/patch.html Implements the iterator protocol for PatchGenerator. It checks if an image has been provided before starting the iteration. ```python def __iter__(self): if self._current_img is None: error("Attempting to generate patches but no image has been provided") self._current_idx = 0 return self ``` -------------------------------- ### Instantiate FitzhughNagumoCell Source: https://ngc-learn.readthedocs.io/en/latest/_sources/tutorials/neurocog/fitzhugh_nagumo_cell.md.txt Sets up the controller and constructs a single Fitzhugh-Nagumo cell component with specified hyperparameters. Includes compilation of core simulation commands. ```python from jax import numpy as jnp, random, jit import numpy as np from ngclearn import Context, MethodProcess ## import model-specific mechanisms from ngclearn.components.neurons.spiking.fitzhughNagumoCell import FitzhughNagumoCell ## create seeding keys (JAX-style) dkey = random.PRNGKey(1234) dkey, *subkeys = random.split(dkey, 6) ## F-N cell hyperparameters alpha = 0.3 ## recovery variable shift factor beta = 1.4 ## recovery variable scale factor gamma = 1. ## membrane potential power term denominator tau_w = 20. ## recovery variable time constant v0 = -0.63605838 ## initial membrane potential (for reset condition) w0 = -0.16983366 ## initial recovery value (for reset condition) ## create simple system with only one F-N cell with Context("Model") as model: cell = FitzhughNagumoCell( "z0", n_units=1, tau_w=tau_w, alpha=alpha, beta=beta, gamma=gamma, v0=v0, w0=w0, integration_type="euler" ) ## create and compile core simulation commands advance_process = (MethodProcess("advance") >> cell.advance_state) reset_process = (MethodProcess("reset") >> cell.reset) ## set up non-compiled utility commands def clamp(x): cell.j.set(x) ``` -------------------------------- ### ngclearn.utils.io_utils.makedir Source: https://ngc-learn.readthedocs.io/en/latest/source/ngclearn.utils.html Creates a folder/directory on disk. ```APIDOC ## ngclearn.utils.io_utils.makedir ### Description Creates a folder/directory on disk. ### Parameters * **directory** (string) - string name of directory/folder to create on disk ```