Skip to content

Commit 1565b6e

Browse files
authored
Update user_documentation.rst - sections 2,3,4,5
1 parent 4881823 commit 1565b6e

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

doc/source/user_documentation.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,29 +2866,29 @@ Though the relevant methods can be called without raising an exception, they onl
28662866
^^^^^^^^^^^
28672867
Examples of NetPyNE batchtools usage can be found in the ``examples`` directory `on the NetPyNE github <https://github.com/suny-downstate-medical-center/netpyne/tree/batch/netpyne/batchtools/examples>`_.
28682868
2869-
Examples of the underlying batchtk package can be in the ``examples`` directory `on the batchtk github <https://github.com/jchen6727/batchtk/tree/release/examples>`_.
2869+
Examples of the underlying batchtk package can be in the ``examples`` directory `on the batchtk github <https://github.com/suny-downstate-medical-center/batchtk/tree/release/examples>`_.
28702870
28712871
3. Retrieving batch configuration values through the ``specs`` object
28722872
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2873-
Each simulation is able to retrieve relevant configurations through the ``specs`` object, and communicate with
2874-
the dispatcher through the ``send`` function within ``netpyne.sim``.
2873+
Each simulation is able to retrieve relevant batch configurations through the ``specs`` object, and communicate with
2874+
the batch dispatcher through the ``send`` function within ``netpyne.sim``.
28752875
2876-
importing the relevant objects
2876+
First, import the relevant objects:
28772877
28782878
.. code-block:: python
28792879
28802880
from netpyne import specs, sim
28812881
cfg = specs.SimConfig() # create a SimConfig object, can be provided with a dictionary on initial call to set initial values
28822882
netParams = specs.NetParams() # create a netParams object
28832883
2884-
if the ``batchtk`` module is properly installed, then it automatically replaces the original ``specs.SimConfig`` object with the developmental ``batchtools`` version which can be queried through ``help()`` or ``type()``:
2884+
If the ``batchtk`` module is properly installed, then it automatically replaces the original ``specs.SimConfig`` object with the developmental ``batchtools`` version which can be queried through ``help()`` or ``type()``:
28852885
28862886
.. code-block:: python
28872887
28882888
cfg = specs.SimConfig()
28892889
help(cfg)
28902890
2891-
Truncated output of the above code block...:
2891+
Truncated output of the above code block:
28922892
28932893
.. code-block:: python
28942894
@@ -2897,19 +2897,17 @@ Truncated output of the above code block...:
28972897
28982898
class Runner_SimConfig(batchtk.runtk.runners.Runner, netpyne.specs.simConfig.SimConfig)
28992899
2900-
* This updated ``cfg`` instance automatically captures relevant configuration mappings created upon initialization
2900+
This updated ``cfg`` instance automatically captures relevant configuration mappings created upon initialization for this particular batch job. These mappings can be retrieved via ``cfg.get_mappings()``.
29012901
2902-
* these mappings can be retrieved via ``cfg.get_mappings()``
2903-
2904-
* then, upon calling ``cfg.update()``, it will update its values with the relevant mappings through the ``update()`` method.
2902+
The next step is to update the cfg values with the relevant mappings for this batch job by calling ``cfg.update()``:
29052903
29062904
.. code-block:: python
29072905
29082906
from netpyne import specs # import the custom batch specs
29092907
cfg = specs.SimConfig() # create a SimConfig object
29102908
cfg.update() # update the cfg object with any relevant mappings for this particular batch job
29112909
2912-
The ``update`` method will update the ``SimConfig`` object ``first`` with values supplied in the argument call, and ``then`` with the configuration mappings (i.e. retrieved by ``cfg.get_mappings()``)
2910+
The ``update`` method will update the ``SimConfig`` object *first* with values supplied in the argument call, and *then* with the configuration mappings for the batch job (i.e. retrieved by ``cfg.get_mappings()``), as illustrated below:
29132911
29142912
.. code-block:: python
29152913
@@ -2923,12 +2921,12 @@ The ``update`` method will update the ``SimConfig`` object ``first`` with values
29232921
assert cfg.bar == 1 # cfg.bar remains unchanged
29242922
assert cfg.baz == 2 # cfg.baz remains unchanged
29252923
2926-
This REPLACES the previous NetPyNE code idiom for updating the SimConfig object with mappings from the batched job submission
2924+
This REPLACES the previous NetPyNE code for updating the SimConfig object with mappings from the batch job submission.
29272925
29282926
4. Additional functionality within the simConfig object
29292927
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29302928
2931-
``cfg.update()`` also supports the optional argument ``force_match``, which forces values in the update dictionary to match existing attributes within the ``SimConfig`` object. This setting is recommended to be set to ``True`` during debugging to check for accidental creation of new attributes within the ``SimConfig`` object at runtime ...
2929+
The method ``cfg.update()`` also supports the optional argument ``force_match``, which forces values in the update dictionary to match existing attributes within the ``SimConfig`` object. This setting is recommended to be set to ``True`` during debugging to check for accidental creation of new attributes within the ``SimConfig`` object at runtime:
29322930
29332931
.. code-block:: python
29342932
@@ -2943,7 +2941,7 @@ This REPLACES the previous NetPyNE code idiom for updating the SimConfig object
29432941
assert cfg.type == 0 # cfg.type remains unchanged due to a typo in the attribute name 'type' -> 'typo'
29442942
assert cfg.typo == 1 # instead, cfg.typo is created and set to the value 1
29452943
2946-
Both the initialization of the ``cfg`` object with ``specs.SimConfig()`` and the subsequent call to ``cfg.update()`` handle both dot notation and nested containers...
2944+
Both the initialization of the ``cfg`` object with ``specs.SimConfig()`` and the subsequent call to ``cfg.update()`` handle both dot notation and nested containers:
29472945
29482946
.. code-block:: python
29492947
@@ -2964,13 +2962,11 @@ updating the ``cfg`` object with the supplied dictionary will occur before updat
29642962
5. Communicating results to the search algorithm through the ``sim.send`` function
29652963
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29662964
2967-
Prior batched simulations relied on ``.pkl`` files to communicate data. In order to facilitate collation, specific data values can be sent at the end of the simulation via: ``netpyne.sim.send(...)``
2968-
2969-
In terms of the simulation, the following functions are available to the user:
2965+
Prior batch simulations relied on ``.pkl`` files to communicate data. In order to facilitate collation, specific data values can be sent directly via runtime memory at the end of the simulation via:
29702966
2971-
* **sim.send(<data>)**: sends ``<data>`` to the batch ``dispatcher``, esp.
2967+
* **sim.send(<data>)**: sends ``<data>`` to the batch ``dispatcher``
29722968
2973-
* for ``search`` jobs, it is important to match the data sent with the metric specified in the search function. For instance, if the search call specifies a metric "loss", then ``sim.send`` should specify a key: value pair: ``{'loss': <value>}``
2969+
For ``search`` jobs, it is important to match the data sent with the metric specified in the search function. For instance, if the search call specifies a metric "loss", then ``sim.send`` should specify a key: value pair: ``{'loss': <value>}``.
29742970
29752971
6. Specifying a batch job
29762972
^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)