File: projectmanagement.rst

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (307 lines) | stat: -rwxr-xr-x 9,425 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
.. _project:


.. warning::

    The commands and methods here are outdated and have thus never been updated
    to work with Python; consider directly using a modern version control system
    (e.g. ``git`` or ``hg``) instead. You will likely want to store the version
    identifier with each figure or datafile so you can recreate the data.

Project Management
------------------

RCS control of simulation projects in a single directory. The idea is to 
be able to reproduce a simulation given its version number. 
The version number was printed along with all the neuron windows on the screen 
when the simulation was archived. 
See :ref:`ArchiveAndHardcopy` 

To manage parameter sets instead, use:

.. toctree:: :maxdepth: 1

    mechstan.rst
 
Effective use of this management system requires that the user conform to 
a policy in which no simulation variables are changed except by changing them 
in managed files (listed in the nrnversion file). ie. during a session 
only change variables by editing a hoc file and saving it, or only change 
variables in field editors that actually appear on the screen when a simulation 
is archived. Variable values will be lost if you change them 
by direct command to the interpreter (the command does not appear in any file) 
or if you dismiss a panel after changing one of its field editors (when 
the simulation is archived, only values of field editors actually displayed 
on the screen are saved). User judgment is required to determine if these 
missing variable values will later prevent reproduction of the simulation. 
If this is the case, then when the hardcopy is printed, the user should 
manually enter this information when the log message is requested or 
else make hand written notes on the hardcopy itself. 
 
A policy that seems to work pretty well is to always start a simulation via 

.. code-block::
    none

    	special init.hoc -	# if the simulation uses mod file 

where init.hoc xopens all necessary files to initialize the simulation. 

.. code-block::
    none

    init.hoc 
    //------- 
    xopen("$(NEURONHOME)/lib/hoc/noload.hoc")	// standard run tools 
    xopen("morph.hoc")	// topology, geometry, compartmentalization 
    xopen("memb.hoc")	// membrane properties 
    xopen("param.hoc")	// parameters that are occasionally changed 
    xopen("start.ses")	// will automatically change for every new version 
    //------- 

With this style, whenever an old version is checked out and run, the appearance 
of the screen should match the hardcopy and it should be possible to 
reproduce the archived simulation. 
     

.. warning::
    Reliance on a management policy that requires judgment is regrettable. 
    However making the system failsafe while retaining the generality of the 
    interpreter is probably impossible. Archive strategies consisting solely 
    of checkpoints, 
    eg. coredumps, use a great deal of disk space and don't capture any 
    semantic information about the logical structure of the variables and 
    how they are related. This strategy is low time and high space. 
    Audit trails, saving all the commands and changes, is high time and low space. 
    Its problem is that it captures all the false starts and mistakes. 
    Recapitulating every excruciating detail is probably too confusing. 
    The current system, by developing very low space, very low time logical 
    snapshots, although not failsafe, hopefully will realistically help to 
    solve the very real problems of simulation management. 

Examples
========

The following example illustrates the initialization of an essentially 
empty project. 
 
Here are the files. After initializing the project with these, they 
can be modified to handle arbitrary complexity. These files should be 
in an otherwise empty subdirectory. 
 
init.hoc 

.. code-block::
    none

    xopen("$(NEURONHOME)/lib/hoc/noload.hoc") 
    xopen("morph.hoc") 
    xopen("memb.hoc") 
    xopen("param.hoc") 
    xopen("start.ses") 

morph.hoc 

.. code-block::
    none

    create soma 
    access soma 
    L=5 
    diam=100/(PI*L) 

memb.hoc 

.. code-block::
    none

    insert hh 

param.hoc 

.. code-block::
    none

    gnabar_hh = .120 

start.ses 

.. code-block::
    none

    nrnmainmenu() 

 
The project is initialized with :ref:`prjnrninit` . 
This will create an RCS directory and checkout 
a nrnversion file with the contents: 

.. code-block::
    none

    $Revision: 1.3 $ 
    1.1 init.hoc 
    1.1 memb.hoc 
    1.1 morph.hoc 
    1.1 param.hoc 
    1.1 start.ses 

Note that nrnversion is essentially just a manifest of the files in 
the project. To add a new file to the project one can explicitly check 
the file into RCS with the ci command and insert the appropriate line 
in the nrnversion file. 
 
At this point one can run 

.. code-block::
    none

    nrniv init.hoc - 

and see a neuron main menu. Use the menu to generate a graph 
of an action potential. Since there was an RCS directory with a 
nrnversion,v archive when nrnmainmenu() was executed, 
the Miscellaneous menu has an ArchiveAndHardcopy item. 
Pressing this button will archive the current version with the session 
(it is saved in start.ses), request a description of this version and 
print the version number, description, and session windows on the 
printer specified by the ``$PRINT_CMD`` environment variable. 
 
It is recommended that you play with this simple project for a while 
to familiarize yourself with the style before employing it in a serious 
project. Make several different hardcopies. Use :ref:`prjnrnco` to check out 
earlier versions and run them, modify parameters, and make several more 
hardcopies. Note the way branch version numbers are generated and incremented. 

Utilities
=========     

.. _prjnrninit:

prjnrninit
~~~~~~~~~~


Syntax:
    ``$NEURONHOME/bin/prjnrninit``


Description:
    In the current working directory creates an RCS directory and 
    checks in (and out again with locking) 
    all the hoc, ses, mod files as version 1.1. A nrnversion file 
    is created (and archived) which contains a manifest of the files 
    necessary to recreate a simulation. The Revision level of 
    the nrnversion defines the version of the simulation. 


prjnrncmp
~~~~~~~~~


Syntax:
    ``$NEURONHOME/bin/prjnrncmp``


Description:
    If working files consistent with manifest in nrnversion return with 
    exit status 0. Otherwise return with exit status 1 and print the 
    names of the differing files on the standard output. 


.. _prjnrnco:

prjnrnco
~~~~~~~~


Syntax:
    ``$NEURONHOME/bin/prjnrnco version``


Description:
    Checkout the version from the RCS archive. 
     
    Prior to checkout if the working files differ from the archive, the user 
    is asked whether or not to checkout anyway. If "Checkout anyway" is chosen 
    the changes to the previous working files will be lost. 


prjnrnci
~~~~~~~~


Syntax:
    ``$NEURONHOME/bin/prjnrnci``


Description:
    Checkin a new version to the RCS archive. 
     
    The microemacs editor is run so the user can edit a description of the 
    new version. On exit from the editor the user will be asked whether or 
    not to continue checking in the version. 
     
    A new version is checked in even if the working files are unchanged. 
     
    On exit from this command, the working files are locked versions 
    of the newest version. The nrnversion file contains the version number 
    of the simulation (itself) as well as the version numbers of all the 
    working files it needs to reconstruct the simulation. 

.. _prjnrnpr:

prjnrnpr
~~~~~~~~


Syntax:
    ``cat postscriptfile | $NEURONHOME/bin/prjnrnpr``


Description:
    Checks in the working files and 
    sends the postscript file to the command specified in the 
    ``$PRINT_CMD`` (e.g. :command:`lp`) environment variable. 
     
    If the working files are not different from their archived versions 
    the user is asked whether to continue or verify that the simulation 
    can be reproduced. If the latter, a new the simulation is loaded in 
    an xterm window. The user should then try to reproduce the simulation 
    he/she is attempting to checkin. When the xterm goes away the user 
    will be asked whether or not to continue to checkin. If you can't reproduce 
    the simulation or had to change working files to reproduce it, choose "Abort" 
     
    If the working files did differ then :func:`prjnrnci` is run in an :program:`xterm`. 
     
    The last question for the user to answer is whether to leave the working 
    files at the new or old version. The answer depends on whether you envision 
    this simulation as a side branch off the primary version or as 
    additive. 
     
    The log message entered during checkin is added to the postcript stream 
    and sent to ``$PRINT_CMD``.
     
    This command is called by the :ref:`ArchiveAndHardcopy` menu item in the 
    :ref:`NEURONMainMenu` which first saves the session in :file:`start.hoc` and 
    sends the entire session as standard input to this command. 


ivdialog
~~~~~~~~


Syntax:
    ``$NEURONHOME/bin/prjnrnpr "banner" "accept" "cancel"``


Description:
    Pops up a boolean dialog. 
     
    "1" is printed on the standard output if 
    the "accept" button is pressed. 
     
    "0" is printed on the standard output 
    if the "cancel" button is pressed.