From 5872c508e60a07e401035032d2fa2456c1da6d92 Mon Sep 17 00:00:00 2001 From: Han Lu <11597940+ErbB4@users.noreply.github.com> Date: Wed, 31 Jul 2024 09:46:35 +0200 Subject: [PATCH 1/6] fixed typos etc --- doc/python/simulation.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/python/simulation.rst b/doc/python/simulation.rst index 7228081fb2..afff7b9120 100644 --- a/doc/python/simulation.rst +++ b/doc/python/simulation.rst @@ -6,14 +6,14 @@ Simulations From recipe to simulation ------------------------- -To build a simulation the following concepts are needed: +To build a simulation, the following concepts are needed: * an :py:class:`arbor.recipe` that describes the cells and connections in the model; * an :py:class:`arbor.context` used to execute the simulation. The workflow to build a simulation is to first generate an :class:`arbor.domain_decomposition` based on the :py:class:`arbor.recipe` and :py:class:`arbor.context` describing the distribution of the model -over the local and distributed hardware resources (see :ref:`pydomdec`). Then, the simulation is build using this :py:class:`arbor.domain_decomposition`. +over the local and distributed hardware resources (see :ref:`pydomdec`). Then, the simulation is built using this :py:class:`arbor.domain_decomposition`. .. container:: example-code @@ -24,7 +24,7 @@ over the local and distributed hardware resources (see :ref:`pydomdec`). Then, t # Get a communication context (with 4 threads, no GPU) context = arbor.context(threads=4, gpu_id=None) - # Initialise a recipe of user defined type my_recipe with 100 cells. + # Initialise a recipe of user-defined type my_recipe with 100 cells. n_cells = 100 recipe = my_recipe(n_cells) @@ -34,7 +34,7 @@ over the local and distributed hardware resources (see :ref:`pydomdec`). Then, t # Instantiate the simulation. sim = arbor.simulation(recipe, decomp, context) - # Run the simulation for 2000 ms with time stepping of 0.025 ms + # Run the simulation for 2000 ms with a time step of 0.025 ms tSim = 2000 dt = 0.025 sim.run(tSim, dt) @@ -53,7 +53,7 @@ over the local and distributed hardware resources (see :ref:`pydomdec`). Then, t * an :py:class:`arbor.recipe` that describes the model; * an :py:class:`arbor.domain_decomposition` that describes how the cells in the model are assigned to hardware resources; * an :py:class:`arbor.context` which is used to execute the simulation. - * a non-negative :py:class:`int` in order to seed the pseudo pandom number generator (optional) + * a non-negative :py:class:`int` in order to seed the pseudo random number generator (optional) Simulations provide an interface for executing and interacting with the model: @@ -94,7 +94,7 @@ over the local and distributed hardware resources (see :ref:`pydomdec`). Then, t .. function:: run(tfinal, dt) - Run the simulation from current simulation time to ``tfinal``, + Run the simulation from the current simulation time to ``tfinal``, with maximum time step size ``dt``. :param tfinal: The final simulation time [ms]. @@ -105,7 +105,7 @@ over the local and distributed hardware resources (see :ref:`pydomdec`). Then, t .. function:: record(policy) - Disable or enable recorder of rank-local or global spikes, as determined by the ``policy``. + Disable or enable the recorder of rank-local or global spikes, as determined by the ``policy``. :param policy: Recording policy of type :py:class:`spike_recording`. @@ -230,16 +230,16 @@ Spikes recorded during a simulation are returned as a NumPy structured datatype sim = arbor.simulation(recipe, decomp, context) # Direct the simulation to record all spikes, which will record all spikes - # across multiple MPI ranks in distrubuted simulation. + # across multiple MPI ranks in distributed simulation. # To only record spikes from the local MPI rank, use arbor.spike_recording.local sim.record(arbor.spike_recording.all) - # Run the simulation for 2000 ms with time stepping of 0.025 ms + # Run the simulation for 2000 ms with a time step of 0.025 ms tSim = 2000 dt = 0.025 sim.run(tSim, dt) - # Print the spikes and according spike time + # Print the spikes and accordingly the spike time for s in sim.spikes(): print(s) @@ -288,10 +288,10 @@ There are three parts to the process of recording cell data over a simulation. The contents of ``data`` will depend upon the specifics of the probe, but note: - i. The object type and structure of ``data`` is fully determined by the metadata. + i. The object type and structure of ``data`` are fully determined by the metadata. ii. All currently implemented probes return data that is a NumPy array, with one - row per sample, first column being sample time, and the remaining columns containing + row per sample, the first column being sample time, and the remaining columns containing the corresponding data. Example From fa234c02cf38e026c508b8c1ad8c23a7d198576d Mon Sep 17 00:00:00 2001 From: Han Lu <11597940+ErbB4@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:28:53 +0200 Subject: [PATCH 2/6] Update doc/python/simulation.rst Co-authored-by: Thorsten Hater <24411438+thorstenhater@users.noreply.github.com> --- doc/python/simulation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python/simulation.rst b/doc/python/simulation.rst index afff7b9120..c1ed0cfb42 100644 --- a/doc/python/simulation.rst +++ b/doc/python/simulation.rst @@ -239,7 +239,7 @@ Spikes recorded during a simulation are returned as a NumPy structured datatype dt = 0.025 sim.run(tSim, dt) - # Print the spikes and accordingly the spike time + # Print the spikes: time and source for s in sim.spikes(): print(s) From 4b6fb4e414e85d038e55c36ab93925d01809945c Mon Sep 17 00:00:00 2001 From: Han Lu <11597940+ErbB4@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:31:28 +0200 Subject: [PATCH 3/6] fixed units :-) --- doc/python/simulation.rst | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/python/simulation.rst b/doc/python/simulation.rst index c1ed0cfb42..d153779dc1 100644 --- a/doc/python/simulation.rst +++ b/doc/python/simulation.rst @@ -19,24 +19,24 @@ over the local and distributed hardware resources (see :ref:`pydomdec`). Then, t .. code-block:: python - import arbor + import arbor as A # Get a communication context (with 4 threads, no GPU) - context = arbor.context(threads=4, gpu_id=None) + context = A.context(threads=4, gpu_id=None) # Initialise a recipe of user-defined type my_recipe with 100 cells. n_cells = 100 recipe = my_recipe(n_cells) # Get a description of the partition of the model over the cores. - decomp = arbor.partition_load_balance(recipe, context) + decomp = A.partition_load_balance(recipe, context) # Instantiate the simulation. - sim = arbor.simulation(recipe, decomp, context) + sim = A.simulation(recipe, decomp, context) # Run the simulation for 2000 ms with a time step of 0.025 ms - tSim = 2000 - dt = 0.025 + tSim = 2000 * U.ms + dt = 0.025 * U.ms sim.run(tSim, dt) .. currentmodule:: arbor @@ -224,19 +224,19 @@ Spikes recorded during a simulation are returned as a NumPy structured datatype .. code-block:: python - import arbor + import arbor as A # Instantiate the simulation. - sim = arbor.simulation(recipe, decomp, context) + sim = A.simulation(recipe, decomp, context) # Direct the simulation to record all spikes, which will record all spikes # across multiple MPI ranks in distributed simulation. - # To only record spikes from the local MPI rank, use arbor.spike_recording.local - sim.record(arbor.spike_recording.all) + # To only record spikes from the local MPI rank, use A.spike_recording.local + sim.record(A.spike_recording.all) # Run the simulation for 2000 ms with a time step of 0.025 ms - tSim = 2000 - dt = 0.025 + tSim = 2000 * U.ms + dt = 0.025 * U.ms sim.run(tSim, dt) # Print the spikes: time and source @@ -299,16 +299,16 @@ Example .. code-block:: python - import arbor + import arbor as A # [... define recipe, decomposition, context ... ] # Initialize simulation: - sim = arbor.simulation(recipe, decomp, context) + sim = A.simulation(recipe, decomp, context) # Sample probeset id (0, 0) (first probeset id on cell 0) every 0.1 ms - handle = sim.sample((0, 0), arbor.regular_schedule(0.1)) + handle = sim.sample((0, 0), A.regular_schedule(0.1)) # Run simulation and retrieve sample data from the first probe associated with the handle. From 176afe0030cd4b0180f92541617733859b84a304 Mon Sep 17 00:00:00 2001 From: Han Lu <11597940+ErbB4@users.noreply.github.com> Date: Thu, 1 Aug 2024 09:29:29 +0200 Subject: [PATCH 4/6] Update simulation.rst --- doc/python/simulation.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/python/simulation.rst b/doc/python/simulation.rst index d153779dc1..b59b33fb31 100644 --- a/doc/python/simulation.rst +++ b/doc/python/simulation.rst @@ -300,6 +300,7 @@ Example .. code-block:: python import arbor as A + from arbor import units as U # [... define recipe, decomposition, context ... ] # Initialize simulation: @@ -312,7 +313,7 @@ Example # Run simulation and retrieve sample data from the first probe associated with the handle. - sim.run(tfinal=3, dt=0.1) + sim.run(tfinal=3 * U.ms, dt=0.1 * U.ms) data, meta = sim.samples(handle)[0] print(data) From 0b31737e7e76df0c8b0fc84cf3f5590bad278cde Mon Sep 17 00:00:00 2001 From: Han Lu <11597940+ErbB4@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:04:41 +0200 Subject: [PATCH 5/6] Update doc/python/simulation.rst Co-authored-by: Thorsten Hater <24411438+thorstenhater@users.noreply.github.com> --- doc/python/simulation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python/simulation.rst b/doc/python/simulation.rst index b59b33fb31..5a78e9b185 100644 --- a/doc/python/simulation.rst +++ b/doc/python/simulation.rst @@ -309,7 +309,7 @@ Example # Sample probeset id (0, 0) (first probeset id on cell 0) every 0.1 ms - handle = sim.sample((0, 0), A.regular_schedule(0.1)) + handle = sim.sample((0, 0), A.regular_schedule(0.1*U.ms)) # Run simulation and retrieve sample data from the first probe associated with the handle. From 7a1b1c7bbe5a659bb4711359952c42710ab401fa Mon Sep 17 00:00:00 2001 From: Han Lu <11597940+ErbB4@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:04:57 +0200 Subject: [PATCH 6/6] Update doc/python/simulation.rst Co-authored-by: Thorsten Hater <24411438+thorstenhater@users.noreply.github.com> --- doc/python/simulation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/python/simulation.rst b/doc/python/simulation.rst index 5a78e9b185..09b497509b 100644 --- a/doc/python/simulation.rst +++ b/doc/python/simulation.rst @@ -235,7 +235,7 @@ Spikes recorded during a simulation are returned as a NumPy structured datatype sim.record(A.spike_recording.all) # Run the simulation for 2000 ms with a time step of 0.025 ms - tSim = 2000 * U.ms + tSim = 2 * U.s dt = 0.025 * U.ms sim.run(tSim, dt)