From 07ef36e1766130660028959cf5a93424ba270136 Mon Sep 17 00:00:00 2001
From: Dilawar Singh <dilawars@ncbs.res.in>
Date: Mon, 23 Jan 2017 11:59:58 +0530
Subject: [PATCH] Squashed 'moose-examples/' changes from ed3253d..8038f56

8038f56 documentation is moved under main function
6ebca4d Corrected kkitwrite function
1726122 Merge branch 'master' of https://github.com/BhallaLab/moose-examples
fbcaef7 added line to show how to set solver to sbml files
07a11d3 Merge pull request #11 from dilawar/master
536b53e Construct absolute path relative to script directory.
f5a7d84 All files must be python2 and python3 compatible [skip ci]
6895e56 All compiles with python2 and python3.
d9cb5b7 This version compiles with python2.
d80ec97 print_statement is the first statement of file.
74c70bc Custom fixes to print end='' statement on python2. Whenever possible import from __future__.
8977107 python-qt4 instead of python-pyqt4 is valid name package.
5e47fd8 Install and do not use moogli.
7b8c680 Fixed all files breaking with python3 compielall module.
e00a845 Fixed two more files.
3f789a1 Fixed one more script.
54f9549 Fixed syntax of this file as well.
63b9c43 Fix some more syntax issues.
5446b0e All scripts are now python3 compatible.
e5e259f This script is broken.
3e420f0 Merge remote-tracking branch 'bhallalab/master'
92ba920 Merge branch 'master' of github.com:dilawar/moose-examples
8a47205 Fixed print( , end='' ) with python2
f756065 Fixed print_function in couple of scripts.
3c6fbe0 Converted files to be campatible with python3 with tool 2to3.
da8c0dc Ran 2to3 on all examples. See which scripts are failing on travis.
469e3f3 These scripts were not chmod to executable. Removed hashbang from header.
3429792 Merge branch 'master' of github.com:BhallaLab/moose-examples
d34c8df Merge branch 'master' of github.com:BhallaLab/moose-examples
d56f575 Changelog:     - No python3 incompatible file should be added to repo.     - moose contains moogli now. No need to install it separately.
31137eb Fixed, python2 incompatible print function use.
a5375cc Merge commit '00a12e20a32db0c1e553dcea1b1b78d6158afd60'
15de0ce Since none of the following files was executable, removed shebangs.
4a20952 To run this file libsbml needs to be installed and not compile with moose as its at python level
092eec8 Doxygen_1.8.9 is added which should be used to generate doxygen files,Rdesigneur folder is creater under "user" folder and corrected index.rst file is updated, deleted "html" folder,Rdesigneur markdown file with correct date,"snippet " and "tutorial"folder is created with relevant files to generate html files
bee94a1 Merge commit '3c9138df91552ccd74acb7dfe7264c0c2180b334'
4590e9e Merge branch 'master' of https://github.com/BhallaLab/moose-examples
62e3218 Moved docs to moose. Removed temp directory.
dc5a230 Merge branch 'master' of https://github.com/BhallaLab/moose-examples
c8f96c5 Once simulation is done, store the results in png file.
5c36c87 Used 2to3 tool to make these scripts python3 compatibles. Also saving results to a png file after run is over.

git-subtree-dir: moose-examples
git-subtree-split: 8038f56ec24965353de70fb460ceccff3861f7b1
---
 .travis.yml                                   |   7 +-
 _travis/run_scripts.sh                        |   2 +-
 hopfield/guiHopfield.py                       |   2 +-
 hopfield/hopfield.py                          |   4 +-
 hopfield/test.py                              |  10 +-
 izhikevich/Izhikevich.py                      |  20 +-
 izhikevich/demogui_qt.py                      |   4 +-
 kinetics/test_ksolve.py                       |   4 +-
 moogli/purkinje_simulation.py                 |  16 +-
 moogli/purkinje_simulation_with_rm.py         |  28 +-
 .../purkinje_simulation_with_rm_and_graph.py  |  28 +-
 neuroml/CA1PyramidalCell/CA1.py               |   6 +-
 neuroml/CA1PyramidalCell/CA1_hsolve.py        |  10 +-
 neuroml/CA1PyramidalCell/FvsI_CA1.py          |   6 +-
 .../CA1.morph.bad.xml.REMOVED.git-id          |   1 -
 .../CA1.morph.original.xml.REMOVED.git-id     |   1 -
 .../CA1.morph.xml.REMOVED.git-id              |   1 -
 .../CA1_original.morph.xml.REMOVED.git-id     |   1 -
 .../CA1inhomog.morph.xml.REMOVED.git-id       |   1 -
 neuroml/GranuleCell/FvsI_Granule98.py         |   6 +-
 neuroml/GranuleCell/Granule98.py              |   6 +-
 neuroml/GranuleCell/Granule98_hsolve.py       |   6 +-
 neuroml/LIF/FvsI_LIF.py                       |   6 +-
 neuroml/LIF/LIFxml_firing_hsolve.py           |   4 +-
 neuroml/LIF/twoLIFxml_firing.py               |   6 +-
 .../cells/purk2.morph.xml.REMOVED.git-id      |   1 -
 neuroml/allChannelsCell/allChannelsCell.py    |   6 +-
 neuroml/lobster_pyloric/STG_net.py            |  12 +-
 .../lobster_pyloric/channels/ChannelTest.py   |  10 +-
 .../lobster_pyloric/synapses/AchSyn_STG.py    |   4 +-
 .../lobster_pyloric/synapses/GluSyn_STG.py    |   4 +-
 .../lobster_pyloric/synapses/load_synapses.py |   2 +-
 paper-2015/Fig2_elecModels/Fig2A.py           |   8 +-
 paper-2015/Fig2_elecModels/Fig2A_analysis.py  |   6 +-
 paper-2015/Fig2_elecModels/Fig2C.py           |  22 +-
 paper-2015/Fig2_elecModels/Fig2D.py           |   6 +-
 paper-2015/Fig2_elecModels/Fig2E.py           |   8 +-
 .../chans/CA1.morph.xml.REMOVED.git-id        |   1 -
 paper-2015/Fig3_chemModels/Fig3D.py           |   2 +-
 paper-2015/Fig3_chemModels/Fig3_NEURON.py     |   4 +-
 paper-2015/Fig4_ReacDiff/Fig4B.py             |   6 +-
 paper-2015/Fig4_ReacDiff/Fig4CDEF.py          |   8 +-
 paper-2015/Fig4_ReacDiff/Fig4GHIJ.py          |   8 +-
 paper-2015/Fig4_ReacDiff/rxdSpineSize.py      |   8 +-
 paper-2015/Fig5_CellMultiscale/Fig5A.py       |   8 +-
 paper-2015/Fig5_CellMultiscale/Fig5BCD.py     |  10 +-
 paper-2015/Fig6_NetMultiscale/Fig6A.py        |  12 +-
 paper-2015/Fig6_NetMultiscale/Fig6BCDE.py     |   9 +-
 paper-2015/Fig6_NetMultiscale/ReducedModel.py |  31 +-
 paper-2015/rxdSpineSize.py                    |   8 +-
 parallelSolver/Fig2_v4.py                     | 458 ++++++------
 parallelSolver/abstrModelEqns2.py             | 438 +++++------
 rall_1964/rall64.py                           |  28 +-
 rall_1964/rall64_graphic.py                   |   2 +-
 ...GraupnerBrunel2012_STDPfromCaPlasticity.py |  42 +-
 ...GraupnerBrunel2014_LifetimeCaPlasticity.py |   8 +-
 snippets/HsolveInstability.py                 |   8 +-
 snippets/IntegrateFireZoo.py                  |  10 +-
 snippets/MULTI/TuringInNeuron.py              | 338 +++++----
 snippets/MULTI/diffusionOnly.py               | 696 +++++++++---------
 snippets/MULTI/loadMulti.py                   | 562 +++++++-------
 snippets/MULTI/midchan.py                     | 521 +++++++------
 snippets/MULTI/minchan.py                     | 499 ++++++-------
 snippets/MULTI/minimal.py                     | 458 ++++++------
 snippets/MULTI/multi1.py                      | 517 +++++++------
 snippets/MULTI/multi1_ee.py                   | 554 +++++++-------
 snippets/MULTI/multi2.py                      | 554 +++++++-------
 snippets/MULTI/multi3.py                      | 601 ++++++++-------
 snippets/MULTI/proto18.py                     | 540 +++++++-------
 snippets/MULTI/runcell18.py                   |  22 +-
 snippets/MULTI/x_compt.py                     | 490 ++++++------
 snippets/RandSpikeStats.py                    |   2 +-
 snippets/STDP.py                              |  12 +-
 snippets/bidirectionalPlasticity.py           |  10 +-
 snippets/changeFuncExpression.py              | 128 ++--
 snippets/chemDoseResponse.py                  |   2 +-
 snippets/compartment_net.py                   |  10 +-
 snippets/compartment_net_no_array.py          |   4 +-
 snippets/compartmental_neuron.py              |   2 +-
 snippets/convert_Genesis2Sbml.py              |  22 +-
 snippets/crossComptNeuroMesh.py               |  98 +--
 snippets/crossComptOscillator.py              |  32 +-
 snippets/crossComptSimpleReac.py              |  88 +--
 snippets/crossComptSimpleReacGSSA.py          |  88 +--
 snippets/cspaceSteadyState.py                 | 108 +--
 snippets/cubeMeshSigNeur.py                   |   6 +-
 snippets/cylinderDiffusion.py                 |  20 +-
 snippets/cylinderMotor.py                     | 136 ++--
 snippets/diffSpinyNeuron.py                   |  38 +-
 snippets/fieldelement.py                      |  46 +-
 snippets/findChemSteadyState.py               |   9 +-
 snippets/func.py                              |  16 +-
 snippets/funcInputToPools.py                  |  90 +--
 snippets/funcRateHarmonicOsc.py               | 104 +--
 snippets/funcReacLotkaVolterra.py             |  44 +-
 snippets/gssaCylinderDiffusion.py             |  28 +-
 snippets/gssaRDspiny.py                       |  46 +-
 snippets/hdfdemo.py                           |   4 +-
 snippets/helloMoose.py                        |   2 +-
 snippets/hhcomp.py                            |   2 +-
 snippets/insertSpines.py                      |   4 +-
 snippets/insertSpinesWithoutRdesigneur.py     |   4 +-
 snippets/interpol.py                          |   4 +-
 snippets/interpol2d.py                        |  12 +-
 snippets/loadCspaceModel.py                   |  36 +-
 snippets/loadKineticModel.py                  |  46 +-
 snippets/loadMorphology.py                    |   4 +-
 snippets/loadSbmlmodel.py                     |  33 +-
 snippets/mgblock.py                           |   2 +-
 snippets/multiscaleOneCompt.py                |  24 +-
 snippets/neuronFromDotp.py                    | 118 +--
 snippets/nsdf.py                              |  10 +-
 snippets/nsdf_vec.py                          |   6 +-
 snippets/proto18.py                           | 558 +++++++-------
 snippets/pulsegen.py                          |   2 +-
 snippets/pulsegen2.py                         |   4 +-
 snippets/reacDiffBranchingNeuron.py           |   8 +-
 snippets/reacDiffConcGradient.py              |  68 +-
 snippets/reacDiffSpinyNeuron.py               |  42 +-
 snippets/recurrentIntFire.py                  | 118 +--
 snippets/recurrentLIF.py                      | 120 +--
 snippets/rxdFuncDiffusion.py                  |   6 +-
 snippets/rxdFuncDiffusionStoch.py             |   4 +-
 snippets/rxdReacDiffusion.py                  |   2 +-
 snippets/rxdSpineSize.py                      |   8 +-
 snippets/savemodel.py                         |  17 +-
 snippets/scaleVolumes.py                      | 134 ++--
 snippets/scriptGssaSolver.py                  | 184 ++---
 snippets/scriptKineticModel.py                | 199 +++--
 snippets/scriptKineticSolver.py               | 172 ++---
 snippets/showclocks.py                        |  26 +-
 snippets/showmsg.py                           |   6 +-
 snippets/singlemsgcross.py                    |   8 +-
 snippets/startstop.py                         |  12 +-
 snippets/stochasticLotkaVolterra.py           |  44 +-
 snippets/switchKineticSolvers.py              |   2 +-
 snippets/synapse.py                           |   8 +-
 snippets/synapse_tutorial.py                  |  18 +-
 snippets/testHsolve.py                        |   6 +-
 snippets/testRdesigneur.py                    |   8 +-
 snippets/testSigNeur.py                       |   6 +-
 snippets/testWigglySpines.py                  |  25 +-
 snippets/threading_demo.py                    |  38 +-
 snippets/transportBranchingNeuron.py          |  12 +-
 snippets/traub_naf.py                         |   2 +-
 snippets/tweakingParameters.py                |   2 +-
 snippets/vclamp.py                            |   6 +-
 snippets/wildcard.py                          |  52 +-
 squid/channeleditor.py                        |  16 +-
 squid/squid.py                                |  12 +-
 squid/squid_demo.py                           |  10 +-
 traub_2005/py/cell_test_util.py               |   2 +-
 traub_2005/py/cells.py                        |  13 +-
 traub_2005/py/channel_test_util.py            |  14 +-
 traub_2005/py/channelbase.py                  |   5 +-
 traub_2005/py/config.py                       |   2 +-
 traub_2005/py/deadlock_bug.py                 |  11 +-
 traub_2005/py/display_morphology.py           |  30 +-
 traub_2005/py/dump_f_i_curves.py              | 224 +++---
 traub_2005/py/fig_a2_fs.py                    |   2 +-
 traub_2005/py/fig_a3.py                       |   2 +-
 traub_2005/py/gui.py                          |  25 +-
 traub_2005/py/test_capool.py                  |  18 +-
 traub_2005/py/test_kchans.py                  |  14 +-
 traub_2005/py/test_nachans.py                 |  28 +-
 traub_2005/py/test_singlecomp.py              |   8 +-
 traub_2005/py/test_tcr.py                     |   6 +-
 traub_2005/py/testutils.py                    |  14 +-
 traub_2005/py/trbconfig.py                    |   2 +-
 .../ChemicalBistables/findSteadyState.py      | 111 +--
 tutorials/ChemicalBistables/mapkFB.py         |  33 +-
 tutorials/ChemicalBistables/propagationBis.py |  90 +--
 tutorials/ChemicalBistables/scaleVolumes.py   |   6 +-
 tutorials/ChemicalBistables/simpleBis.py      | 190 ++---
 tutorials/ChemicalBistables/strongBis.py      |  68 +-
 tutorials/ChemicalOscillators/TuringOneDim.py |   2 +-
 .../ExcInhNet_Ostojic2014_Brunel2000.py       |   6 +-
 .../ExcInhNet_Ostojic2014_Brunel2000_brian.py |  20 +-
 ...ExcInhNet_Ostojic2014_Brunel2000_brian2.py |  16 +-
 ...2014_Brunel2000_brian2_slow_2pops_4syns.py |  28 +-
 .../ExcInhNet_HigginsGraupnerBrunel2014.py    |   6 +-
 .../cells/CA1.morph.xml.REMOVED.git-id        |   1 -
 .../chans/CA1.morph.xml.REMOVED.git-id        |   1 -
 tutorials/Rdesigneur/rdes_ex3.2.py            |   2 +-
 unsorted/ksolve_with_heavy_load.py            |   2 +-
 util/moogli_viewer.py                         |  10 +-
 util/pymoose.py                               |   8 +-
 187 files changed, 6059 insertions(+), 6162 deletions(-)
 delete mode 100644 neuroml/CA1PyramidalCell/cells_channels/CA1.morph.bad.xml.REMOVED.git-id
 delete mode 100644 neuroml/CA1PyramidalCell/cells_channels/CA1.morph.original.xml.REMOVED.git-id
 delete mode 100644 neuroml/CA1PyramidalCell/cells_channels/CA1.morph.xml.REMOVED.git-id
 delete mode 100644 neuroml/CA1PyramidalCell/cells_channels/CA1_original.morph.xml.REMOVED.git-id
 delete mode 100644 neuroml/CA1PyramidalCell/cells_channels/CA1inhomog.morph.xml.REMOVED.git-id
 delete mode 100644 neuroml/PurkinjeCellPassivePulseInput/cells/purk2.morph.xml.REMOVED.git-id
 delete mode 100644 paper-2015/Fig2_elecModels/chans/CA1.morph.xml.REMOVED.git-id
 delete mode 100644 tutorials/Rdesigneur/cells/CA1.morph.xml.REMOVED.git-id
 delete mode 100644 tutorials/Rdesigneur/chans/CA1.morph.xml.REMOVED.git-id

diff --git a/.travis.yml b/.travis.yml
index f0ea2552..8799d5a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,11 +12,12 @@ install:
     - sudo apt-key add - < Release.key  
     - sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/moose/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/moose.list"
     - sudo apt-get -y update
-    - sudo apt-get install python-h5py
+    - sudo apt-get -y install python-qt4
     - sudo apt-get -y install moose
-    - sudo apt-get -y install moogli
 
 script:
+    - # Making sure no python3 incompatible file.
+    - python3 -m compileall -q .
+    - python2 -m compileall -q .
     - python -c 'import moose'
-    - python -c 'import moogli'
     - cd _travis && ./find_scripts_to_run.sh && ./run_scripts.sh 
diff --git a/_travis/run_scripts.sh b/_travis/run_scripts.sh
index c0140b9a..4b4ea106 100755
--- a/_travis/run_scripts.sh
+++ b/_travis/run_scripts.sh
@@ -10,7 +10,7 @@ TEMP=$PWD/__temp__
 rm -f $BLACKLISTED $SUCCEEDED $FAILED $TEMP TORUN
 $PWD/find_scripts_to_run.sh 
 
-PYC=`which python`
+PYC=`which python2`
 MATPLOTRC=$PWD/matplotlibrc
 if [ ! -f $MATPLOTRC ]; then
     echo "$MATPLOTRC not found"
diff --git a/hopfield/guiHopfield.py b/hopfield/guiHopfield.py
index 1df12e51..37dc6b1d 100644
--- a/hopfield/guiHopfield.py
+++ b/hopfield/guiHopfield.py
@@ -53,7 +53,7 @@ class DesignerMainWindow(QtGui.QMainWindow, Ui_MainWindow):
         self.connect(self.computeSynWeightsPushButton,QtCore.SIGNAL('clicked()'),self.computeAllWeights)
 
     def saveInput(self):
-        print 'saving current pattern as input'
+        print('saving current pattern as input')
         inpList = []
         for i in range(100):
             exec(('inpList.append(int(self.pushButton_%s.isChecked()))' %i))
diff --git a/hopfield/hopfield.py b/hopfield/hopfield.py
index 870c9b31..534c1921 100644
--- a/hopfield/hopfield.py
+++ b/hopfield/hopfield.py
@@ -58,9 +58,9 @@ class HopfieldNetwork():
                         memory[j] = -1
                     self.synWeights[i*len(memory)+j] += memory[i]*memory[j]
 
-        print self.synWeights[0:100]
+        print((self.synWeights[0:100]))
         self.numMemories += 1
-        print self.numMemories, '#number Of saved memories'
+        print((self.numMemories, '#number Of saved memories'))
 
     def createNetwork(self):
         '''setting up of the cells and their connections'''
diff --git a/hopfield/test.py b/hopfield/test.py
index 8ff674c5..4d296cda 100644
--- a/hopfield/test.py
+++ b/hopfield/test.py
@@ -37,20 +37,20 @@ cell.synapse[0].delay = 10e-3
 #else, goes back to 0 in tau time
 
 VmVal = moose.Table(cellPath+'/Vm_cell')
-print 'table>cellVm:', moose.connect(VmVal, 'requestOut', cell, 'getVm')
+print(('table>cellVm:', moose.connect(VmVal, 'requestOut', cell, 'getVm')))
 spikeTime = moose.Table(cellPath+'/spikeTimes')
-print 'table>cellSpike:', moose.connect(cell, 'spike', spikeTime, 'input')
+print(('table>cellSpike:', moose.connect(cell, 'spike', spikeTime, 'input')))
 
 inSpkGen = moose.SpikeGen(cellPath+'/inSpkGen')
 inSpkGen.setField('threshold', 2.0)
 inSpkGen.setField('edgeTriggered', True)
 
 if inputGiven == 1:
-    print 'pulse>spike:', moose.connect(pg, 'output', moose.element(cellPath+'/inSpkGen'), 'Vm')
+    print(('pulse>spike:', moose.connect(pg, 'output', moose.element(cellPath+'/inSpkGen'), 'Vm')))
     inTable = moose.Table(cellPath+'/inSpkGen/inTable')
-    print 'table>spike:',moose.connect(inTable, 'requestOut', inSpkGen, 'getHasFired')
+    print(('table>spike:',moose.connect(inTable, 'requestOut', inSpkGen, 'getHasFired')))
 
-print 'spike>cell:', moose.connect(inSpkGen, 'spikeOut', cell.synapse[0] ,'addSpike')
+print(('spike>cell:', moose.connect(inSpkGen, 'spikeOut', cell.synapse[0] ,'addSpike')))
 #print 'spike>cell:', moose.connect(pg, 'output', cell ,'injectDest')
 
 moose.setClock(0, 1e-4)
diff --git a/izhikevich/Izhikevich.py b/izhikevich/Izhikevich.py
index f6cf12ed..00194c99 100644
--- a/izhikevich/Izhikevich.py
+++ b/izhikevich/Izhikevich.py
@@ -197,7 +197,7 @@ These neurons show bursting in response to inhibitory input."""
         neuron = self._get_neuron(key)
         pulsegen = self._make_pulse_input(key)
         if pulsegen is None:
-            print key, 'Not implemented.'
+            print((key, 'Not implemented.'))
             
     def simulate(self, key):
         self.setup(key)
@@ -207,7 +207,7 @@ These neurons show bursting in response to inhibitory input."""
         try:
             Vm = self.Vm_tables[key]
             u = self.u_tables[key]
-        except KeyError, e:
+        except KeyError as e:
             Vm = moose.Table(self.data_container.path + '/' + key + '_Vm')
             nrn = self.neurons[key]
             moose.connect(Vm, 'requestOut', nrn, 'getVm')
@@ -217,7 +217,7 @@ These neurons show bursting in response to inhibitory input."""
             self.u_tables[key] = utable
         try:
             Im = self.inject_tables[key]
-        except KeyError, e:
+        except KeyError as e:
             Im = moose.Table(self.data_container.path + '/' + key + '_inject') # May be different for non-pulsegen sources.
             Im.connect('requestOut', self._get_neuron(key), 'getIm')
             self.inject_tables[key] = Im
@@ -237,7 +237,7 @@ These neurons show bursting in response to inhibitory input."""
         time = linspace(0, IzhikevichDemo.parameters[key][7], len(Vm.vector))
         # DEBUG
         nrn = self._get_neuron(key)
-        print 'a = %g, b = %g, c = %g, d = %g, initVm = %g, initU = %g' % (nrn.a,nrn.b, nrn.c, nrn.d, nrn.initVm, nrn.initU)
+        print(('a = %g, b = %g, c = %g, d = %g, initVm = %g, initU = %g' % (nrn.a,nrn.b, nrn.c, nrn.d, nrn.initVm, nrn.initU)))
         #! DEBUG
         return (time, Vm, Im)
 
@@ -246,14 +246,14 @@ These neurons show bursting in response to inhibitory input."""
         try:
             params = IzhikevichDemo.parameters[key]
         except KeyError as e:
-            print ' %s : Invalid neuron type. The valid types are:' % (key)
+            print((' %s : Invalid neuron type. The valid types are:' % (key)))
             for key in IzhikevichDemo.parameters:
-                print key
+                print(key)
             raise e
         try:
             neuron = self.neurons[key]
             return neuron
-        except KeyError, e:
+        except KeyError as e:
             neuron = moose.IzhikevichNrn(self.model_container.path + '/' + key)
 
         if key == 'integrator' or key == 'Class_1': # Integrator has different constants
@@ -354,7 +354,7 @@ These neurons show bursting in response to inhibitory input."""
             self.inputs[key] = input_table
             return input_table                        
         else:
-            print key, ': Stimulus is not based on pulse generator.'
+            print((key, ': Stimulus is not based on pulse generator.'))
             raise
         pulsegen = self._make_pulsegen(key, 
                                       firstLevel,
@@ -529,9 +529,9 @@ try:
         plot(time, Im.vector)
         subplot(3,1,3)
         show()
-        print 'Finished simulation.'
+        print('Finished simulation.')
 except ImportError:
-    print 'Matplotlib not installed.'
+    print('Matplotlib not installed.')
 
 # 
 # Izhikevich.py ends here
diff --git a/izhikevich/demogui_qt.py b/izhikevich/demogui_qt.py
index 753e98ff..62410ed4 100644
--- a/izhikevich/demogui_qt.py
+++ b/izhikevich/demogui_qt.py
@@ -62,11 +62,11 @@ class IzhikevichGui(QtGui.QMainWindow):
         self.controlPanel = QtGui.QFrame(self.demoFrame)
         self.figureNo = {}
         self.buttons = {}
-        for key, value in IzhikevichDemo.parameters.items():
+        for key, value in list(IzhikevichDemo.parameters.items()):
             button = QtGui.QPushButton(key, self.controlPanel)
             self.figureNo[value[0]] = key
             self.buttons[key] = button
-        keys = self.figureNo.keys()
+        keys = list(self.figureNo.keys())
         keys.sort()
         length = len(keys)
         rows = int(numpy.rint(numpy.sqrt(length)))
diff --git a/kinetics/test_ksolve.py b/kinetics/test_ksolve.py
index 84ab0802..373d7e26 100644
--- a/kinetics/test_ksolve.py
+++ b/kinetics/test_ksolve.py
@@ -306,7 +306,7 @@ def createChemModel( neuroCompt, spineCompt, psdCompt ):
 
 # Just for printf debugging
 def printMolVecs( title ):
-    print title
+    print(title)
     """    
     nCa = moose.vec( '/model/chem/neuroMesh/Ca' )
     sCa = moose.vec( '/model/chem/spineMesh/Ca' )
@@ -477,7 +477,7 @@ def testCubeMultiscale( useSolver ):
     moose.reinit()
     t = time.time()
     moose.start( 1.0 )
-    print("Total time taken: %s sec for 1.0 sec of simulation" % (time.time() - t))
+    print(("Total time taken: %s sec for 1.0 sec of simulation" % (time.time() - t)))
     dumpPlots( plotName )
 
 def main():
diff --git a/moogli/purkinje_simulation.py b/moogli/purkinje_simulation.py
index 02df05d2..07c10609 100644
--- a/moogli/purkinje_simulation.py
+++ b/moogli/purkinje_simulation.py
@@ -26,8 +26,8 @@ filename = os.path.join( os.path.split(os.path.realpath(__file__))[0]
 popdict, projdict = moose.neuroml.loadNeuroML_L123(filename)
 
 # setting up hsolve object for each neuron
-for popinfo in popdict.values():
-    for cell in popinfo[1].values():
+for popinfo in list(popdict.values()):
+    for cell in list(popinfo[1].values()):
         solver = moose.HSolve(cell.path + "/hsolve")
         solver.target = cell.path
 
@@ -37,9 +37,7 @@ moose.reinit()
 SIMULATION_DELTA = 0.001
 SIMULATION_TIME  = 0.03
 
-ALL_COMPARTMENTS = map( lambda x : x.path
-                      , moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")
-                      )
+ALL_COMPARTMENTS = [x.path for x in moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")]
 BASE_VM_VALUE = -0.065
 PEAK_VM_VALUE = -0.060
 BASE_VM_COLOR = [1.0, 0.0, 0.0, 0.1]
@@ -69,9 +67,7 @@ morphology.create_group( "group-all"    # group name
 
 # set initial color of all compartments in accordance with their vm
 morphology.set_color( "group-all"
-                    , map( lambda x : moose.element(x).Vm
-                         , ALL_COMPARTMENTS
-                         )
+                    , [moose.element(x).Vm for x in ALL_COMPARTMENTS]
                     )
 
 # instantiate the visualizer with the morphology object created earlier
@@ -90,9 +86,7 @@ def callback(morphology, viewer):
     # a value higher than peak value will be clamped to peak value
     # a value lower than base value will be clamped to base value.
     morphology.set_color( "group-all"
-                        , map( lambda x : x.Vm
-                            , moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")
-                            )
+                        , [x.Vm for x in moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")]
                         )
     # if the callback returns true, it will be called again.
     # if it returns false it will not be called ever again.
diff --git a/moogli/purkinje_simulation_with_rm.py b/moogli/purkinje_simulation_with_rm.py
index 4957c699..fcf8c585 100644
--- a/moogli/purkinje_simulation_with_rm.py
+++ b/moogli/purkinje_simulation_with_rm.py
@@ -28,8 +28,8 @@ filename = os.path.join( os.path.split(os.path.realpath(__file__))[0]
 popdict, projdict = moose.neuroml.loadNeuroML_L123(filename)
 
 # setting up hsolve object for each neuron
-for popinfo in popdict.values():
-    for cell in popinfo[1].values():
+for popinfo in list(popdict.values()):
+    for cell in list(popinfo[1].values()):
         solver = moose.HSolve(cell.path + "/hsolve")
         solver.target = cell.path
 
@@ -39,17 +39,11 @@ moose.reinit()
 SIMULATION_DELTA = 0.001
 SIMULATION_TIME  = 0.03
 
-ALL_COMPARTMENTS = map( lambda x : x.path
-                      , moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")
-                      )
+ALL_COMPARTMENTS = [x.path for x in moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")]
 
-BASE_RM_VALUE = min( map( lambda x : moose.element(x).Rm
-                        , ALL_COMPARTMENTS
-                        )
+BASE_RM_VALUE = min( [moose.element(x).Rm for x in ALL_COMPARTMENTS]
                    )
-PEAK_RM_VALUE = max( map( lambda x : moose.element(x).Rm
-                        , ALL_COMPARTMENTS
-                        )
+PEAK_RM_VALUE = max( [moose.element(x).Rm for x in ALL_COMPARTMENTS]
                    )
 BASE_RM_COLOR = [0.0, 1.0, 0.0, 0.1]
 PEAK_RM_COLOR = [1.0, 0.0, 0.0, 1.0]
@@ -86,9 +80,7 @@ def create_vm_visualizer():
 
     # set initial color of all compartments in accordance with their vm
     vm_morphology.set_color( "group-all"
-                           , map( lambda x : moose.element(x).Vm
-                                , ALL_COMPARTMENTS
-                                )
+                           , [moose.element(x).Vm for x in ALL_COMPARTMENTS]
                            )
 
     # instantiate the visualizer with the morphology object created earlier
@@ -105,9 +97,7 @@ def create_vm_visualizer():
         # a value higher than peak value will be clamped to peak value
         # a value lower than base value will be clamped to base value.
         morphology.set_color( "group-all"
-                            , map( lambda x : moose.element(x).Vm
-                                 , ALL_COMPARTMENTS
-                                 )
+                            , [moose.element(x).Vm for x in ALL_COMPARTMENTS]
                             )
         # if the callback returns true, it will be called again.
         # if it returns false it will not be called again.
@@ -148,9 +138,7 @@ def create_rm_visualizer():
 
     # set initial color of all compartments in accordance with their rm
     morphology.set_color( "group-all"
-                        , map( lambda x : moose.element(x).Rm
-                             , ALL_COMPARTMENTS
-                             )
+                        , [moose.element(x).Rm for x in ALL_COMPARTMENTS]
                         )
 
     # instantiate the visualizer with the morphology object created earlier
diff --git a/moogli/purkinje_simulation_with_rm_and_graph.py b/moogli/purkinje_simulation_with_rm_and_graph.py
index ec886b27..647e3491 100644
--- a/moogli/purkinje_simulation_with_rm_and_graph.py
+++ b/moogli/purkinje_simulation_with_rm_and_graph.py
@@ -30,8 +30,8 @@ filename = os.path.join( os.path.split(os.path.realpath(__file__))[0]
 popdict, projdict = moose.neuroml.loadNeuroML_L123(filename)
 
 # setting up hsolve object for each neuron
-for popinfo in popdict.values():
-    for cell in popinfo[1].values():
+for popinfo in list(popdict.values()):
+    for cell in list(popinfo[1].values()):
         solver = moose.HSolve(cell.path + "/hsolve")
         solver.target = cell.path
 
@@ -49,17 +49,11 @@ moose.reinit()
 SIMULATION_DELTA = 0.001
 SIMULATION_TIME  = 0.03
 
-ALL_COMPARTMENTS = map( lambda x : x.path
-                      , moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")
-                      )
+ALL_COMPARTMENTS = [x.path for x in moose.wildcardFind("/cells[0]/##[ISA=CompartmentBase]")]
 
-BASE_RM_VALUE = min( map( lambda x : moose.element(x).Rm
-                        , ALL_COMPARTMENTS
-                        )
+BASE_RM_VALUE = min( [moose.element(x).Rm for x in ALL_COMPARTMENTS]
                    )
-PEAK_RM_VALUE = max( map( lambda x : moose.element(x).Rm
-                        , ALL_COMPARTMENTS
-                        )
+PEAK_RM_VALUE = max( [moose.element(x).Rm for x in ALL_COMPARTMENTS]
                    )
 BASE_RM_COLOR = [0.0, 1.0, 0.0, 0.1]
 PEAK_RM_COLOR = [1.0, 0.0, 0.0, 1.0]
@@ -111,9 +105,7 @@ def create_vm_visualizer():
 
     # set initial color of all compartments in accordance with their vm
     vm_morphology.set_color( "group-all"
-                           , map( lambda x : moose.element(x).Vm
-                                , ALL_COMPARTMENTS
-                                )
+                           , [moose.element(x).Vm for x in ALL_COMPARTMENTS]
                            )
 
     # instantiate the visualizer with the morphology object created earlier
@@ -130,9 +122,7 @@ def create_vm_visualizer():
         # a value higher than peak value will be clamped to peak value
         # a value lower than base value will be clamped to base value.
         morphology.set_color( "group-all"
-                            , map( lambda x : moose.element(x).Vm
-                                 , ALL_COMPARTMENTS
-                                 )
+                            , [moose.element(x).Vm for x in ALL_COMPARTMENTS]
                             )
         # if the callback returns true, it will be called again.
         # if it returns false it will not be called again.
@@ -181,9 +171,7 @@ def create_rm_visualizer():
 
     # set initial color of all compartments in accordance with their rm
     morphology.set_color( "group-all"
-                        , map( lambda x : moose.element(x).Rm
-                             , ALL_COMPARTMENTS
-                             )
+                        , [moose.element(x).Rm for x in ALL_COMPARTMENTS]
                         )
 
     # instantiate the visualizer with the morphology object created earlier
diff --git a/neuroml/CA1PyramidalCell/CA1.py b/neuroml/CA1PyramidalCell/CA1.py
index c8b8e74d..bbe90edb 100644
--- a/neuroml/CA1PyramidalCell/CA1.py
+++ b/neuroml/CA1PyramidalCell/CA1.py
@@ -31,16 +31,16 @@ def loadGran98NeuroML_L123(filename):
     #somaIKCa = setupTable('somaIKCa',moose.HHChannel(soma_path+'/Gran_KCa_98'),'Gk')
     #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
     soma = moose.Compartment(soma_path)
-    print "Reinit MOOSE ... "
+    print("Reinit MOOSE ... ")
     resetSim(['/elec','/cells'],simdt,plotdt,simmethod='ee') # from moose.utils
-    print "Running ... "
+    print("Running ... ")
     moose.start(runtime)
     tvec = arange(0.0,runtime,simdt)
     plot(tvec,somaVm.vector[1:])
     title('Soma Vm')
     xlabel('time (s)')
     ylabel('Voltage (V)')
-    print "Showing plots ..."
+    print("Showing plots ...")
     show()
 
 if __name__ == "__main__":
diff --git a/neuroml/CA1PyramidalCell/CA1_hsolve.py b/neuroml/CA1PyramidalCell/CA1_hsolve.py
index 06f437ec..5823db72 100644
--- a/neuroml/CA1PyramidalCell/CA1_hsolve.py
+++ b/neuroml/CA1PyramidalCell/CA1_hsolve.py
@@ -23,8 +23,8 @@ def loadGran98NeuroML_L123(filename,params):
     neuromlR = NeuroML()
     populationDict, projectionDict = \
         neuromlR.readNeuroMLFromFile(filename,params=params)
-    print "Number of compartments =",\
-        len(moose.Neuron(populationDict['CA1group'][1][0].path).children)
+    print(("Number of compartments =",\
+        len(moose.Neuron(populationDict['CA1group'][1][0].path).children)))
     soma_path = populationDict['CA1group'][1][0].path+'/Seg0_soma_0_0'
     somaVm = setupTable('somaVm',moose.Compartment(soma_path),'Vm')
     #somaCa = setupTable('somaCa',moose.CaConc(soma_path+'/Gran_CaPool_98'),'Ca')
@@ -32,16 +32,16 @@ def loadGran98NeuroML_L123(filename,params):
     #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
     soma = moose.Compartment(soma_path)
     
-    print "Reinit MOOSE ... "
+    print("Reinit MOOSE ... ")
     resetSim(['/elec','/cells'],simdt,plotdt,simmethod='hsolve') # from moose.utils
-    print "Running ... "
+    print("Running ... ")
     moose.start(runtime)
     tvec = arange(0.0,runtime,simdt)
     plot(tvec,somaVm.vector[1:])
     title('Soma Vm')
     xlabel('time (s)')
     ylabel('Voltage (V)')
-    print "Showing plots ..."
+    print("Showing plots ...")
     show()
 
 if __name__ == "__main__":
diff --git a/neuroml/CA1PyramidalCell/FvsI_CA1.py b/neuroml/CA1PyramidalCell/FvsI_CA1.py
index 28d13b09..3de7794d 100644
--- a/neuroml/CA1PyramidalCell/FvsI_CA1.py
+++ b/neuroml/CA1PyramidalCell/FvsI_CA1.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+
 # -*- coding: utf-8 -*-
 ## all SI units
 ########################################################################################
@@ -63,8 +63,8 @@ for currenti in currentvec:
         spikesList = spikesList[where(spikesList>0.0)[0]]
         spikesNow = len(spikesList)
     else: spikesNow = 0.0
-    print "For injected current =",currenti,\
-        "number of spikes in",RUNTIME,"seconds =",spikesNow
+    print(("For injected current =",currenti,\
+        "number of spikes in",RUNTIME,"seconds =",spikesNow))
     freqList.append( spikesNow/float(RUNTIME) )
 
 ## plot the F vs I curve of the neuron
diff --git a/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.bad.xml.REMOVED.git-id b/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.bad.xml.REMOVED.git-id
deleted file mode 100644
index 63d5e4e5..00000000
--- a/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.bad.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-b7ea967caab7e1e55c783506429892b973da4e25
\ No newline at end of file
diff --git a/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.original.xml.REMOVED.git-id b/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.original.xml.REMOVED.git-id
deleted file mode 100644
index 6fe13999..00000000
--- a/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.original.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-68f982a3ed4e630891fd11c985fce9d7a3f44c39
\ No newline at end of file
diff --git a/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.xml.REMOVED.git-id b/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.xml.REMOVED.git-id
deleted file mode 100644
index 3e43c654..00000000
--- a/neuroml/CA1PyramidalCell/cells_channels/CA1.morph.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-074524a8ca7045254e3f75b817299f54beaf0096
\ No newline at end of file
diff --git a/neuroml/CA1PyramidalCell/cells_channels/CA1_original.morph.xml.REMOVED.git-id b/neuroml/CA1PyramidalCell/cells_channels/CA1_original.morph.xml.REMOVED.git-id
deleted file mode 100644
index 6fe13999..00000000
--- a/neuroml/CA1PyramidalCell/cells_channels/CA1_original.morph.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-68f982a3ed4e630891fd11c985fce9d7a3f44c39
\ No newline at end of file
diff --git a/neuroml/CA1PyramidalCell/cells_channels/CA1inhomog.morph.xml.REMOVED.git-id b/neuroml/CA1PyramidalCell/cells_channels/CA1inhomog.morph.xml.REMOVED.git-id
deleted file mode 100644
index 07fc399b..00000000
--- a/neuroml/CA1PyramidalCell/cells_channels/CA1inhomog.morph.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-c4700d039b3549376c1ff8d7e9e938a674b05e23
\ No newline at end of file
diff --git a/neuroml/GranuleCell/FvsI_Granule98.py b/neuroml/GranuleCell/FvsI_Granule98.py
index 40f3fef6..80c9ad6b 100644
--- a/neuroml/GranuleCell/FvsI_Granule98.py
+++ b/neuroml/GranuleCell/FvsI_Granule98.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+
 # -*- coding: utf-8 -*-
 ## all SI units
 ########################################################################################
@@ -56,8 +56,8 @@ for currenti in currentvec:
         spikesList = spikesList[where(spikesList>0.0)[0]]
         spikesNow = len(spikesList)
     else: spikesNow = 0.0
-    print "For injected current =",currenti,\
-        "number of spikes in",RUNTIME,"seconds =",spikesNow
+    print(("For injected current =",currenti,\
+        "number of spikes in",RUNTIME,"seconds =",spikesNow))
     freqList.append( spikesNow/float(RUNTIME) )
 
 ## plot the F vs I curve of the neuron
diff --git a/neuroml/GranuleCell/Granule98.py b/neuroml/GranuleCell/Granule98.py
index cde13f6b..9a29370a 100644
--- a/neuroml/GranuleCell/Granule98.py
+++ b/neuroml/GranuleCell/Granule98.py
@@ -31,9 +31,9 @@ def loadGran98NeuroML_L123(filename):
     somaIKCa = setupTable('somaIKCa',moose.HHChannel(soma_path+'/Gran_KCa_98'),'Gk')
     #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
     soma = moose.Compartment(soma_path)
-    print "Reinit MOOSE ... "
+    print("Reinit MOOSE ... ")
     resetSim(['/elec','/cells'],simdt,plotdt,simmethod='ee') # from moose.utils
-    print "Running ... "
+    print("Running ... ")
     moose.start(runtime)
     tvec = arange(0.0,runtime,plotdt)
     plot(tvec,somaVm.vector[1:])
@@ -50,7 +50,7 @@ def loadGran98NeuroML_L123(filename):
     title('KCa current (A)')
     xlabel('time (s)')
     ylabel('')
-    print "Showing plots ..."
+    print("Showing plots ...")
     show()
 
 filename = "GranuleCell.net.xml"
diff --git a/neuroml/GranuleCell/Granule98_hsolve.py b/neuroml/GranuleCell/Granule98_hsolve.py
index 52a3f817..7f62f0eb 100644
--- a/neuroml/GranuleCell/Granule98_hsolve.py
+++ b/neuroml/GranuleCell/Granule98_hsolve.py
@@ -34,10 +34,10 @@ def loadGran98NeuroML_L123(filename):
     ## Am not able to plot KDr gating variable X when running under hsolve
     #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
 
-    print "Reinit MOOSE ... "
+    print("Reinit MOOSE ... ")
     resetSim(['/elec',cells_path], simdt, plotdt, simmethod='hsolve')
 
-    print "Running ... "
+    print("Running ... ")
     moose.start(runtime)
     tvec = arange(0.0,runtime*2.0,plotdt)
     tvec = tvec[ : somaVm.vector.size ]
@@ -55,7 +55,7 @@ def loadGran98NeuroML_L123(filename):
     title('soma KCa current')
     xlabel('time (s)')
     ylabel('KCa current (A)')
-    print "Showing plots ..."
+    print("Showing plots ...")
     show()
 
 filename = "GranuleCell.net.xml"
diff --git a/neuroml/LIF/FvsI_LIF.py b/neuroml/LIF/FvsI_LIF.py
index 91309e76..5dce5b7b 100644
--- a/neuroml/LIF/FvsI_LIF.py
+++ b/neuroml/LIF/FvsI_LIF.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+
 # -*- coding: utf-8 -*-
 ## all SI units
 ########################################################################################
@@ -46,8 +46,8 @@ for currenti in currentvec:
         spikesList = spikesList[where(spikesList>0.0)[0]]
         spikesNow = len(spikesList)
     else: spikesNow = 0.0
-    print "For injected current =",currenti,\
-        "number of spikes in",RUNTIME,"seconds =",spikesNow
+    print(("For injected current =",currenti,\
+        "number of spikes in",RUNTIME,"seconds =",spikesNow))
     freqList.append( spikesNow/float(RUNTIME) )
 
 ## plot the F vs I curve of the neuron
diff --git a/neuroml/LIF/LIFxml_firing_hsolve.py b/neuroml/LIF/LIFxml_firing_hsolve.py
index 0e0e35fd..79316641 100644
--- a/neuroml/LIF/LIFxml_firing_hsolve.py
+++ b/neuroml/LIF/LIFxml_firing_hsolve.py
@@ -16,7 +16,7 @@ injectI = 2.5e-12 # Amperes
 
 ## moose imports
 import moose
-print( '[DBEUG] Using moose from %s' % moose.__file__ )
+print(( '[DBEUG] Using moose from %s' % moose.__file__ ))
 
 from moose.neuroml import *
 from moose.utils import * # has setupTable(), resetSim() etc
@@ -59,7 +59,7 @@ if __name__ == '__main__':
     moose.connect(spikeGen,'event',IF1spikesTable,'input')
 
     run_LIF()
-    print("Spiketimes :",IF1spikesTable.vector)
+    print(("Spiketimes :",IF1spikesTable.vector))
     ## plot the membrane potential of the neuron
     timevec = arange(0.0,RUNTIME+PLOTDT/2.0,PLOTDT)
     figure(facecolor='w')
diff --git a/neuroml/LIF/twoLIFxml_firing.py b/neuroml/LIF/twoLIFxml_firing.py
index aed0ef29..58aaef13 100644
--- a/neuroml/LIF/twoLIFxml_firing.py
+++ b/neuroml/LIF/twoLIFxml_firing.py
@@ -37,10 +37,10 @@ def create_twoLIFs():
 
 def run_twoLIFs():
 	## reset and run the simulation
-	print "Reinit MOOSE."
+	print("Reinit MOOSE.")
 	## from moose_utils.py sets clocks and resets
 	resetSim(['/cells[0]'], SIMDT, PLOTDT, simmethod='ee')
-	print "Running now..."
+	print("Running now...")
 	moose.start(RUNTIME)
 
 if __name__ == '__main__':
@@ -64,7 +64,7 @@ if __name__ == '__main__':
     moose.connect(IF2SynChanTable,'requestOut',IF2Soma.path+'/exc_syn','getIk')
 
     run_twoLIFs()
-    print "Spiketimes :",IF1spikesTable.vector
+    print(("Spiketimes :",IF1spikesTable.vector))
     ## plot the membrane potential of the neuron
     timevec = arange(0.0,RUNTIME+PLOTDT/2.0,PLOTDT)
     figure(facecolor='w')
diff --git a/neuroml/PurkinjeCellPassivePulseInput/cells/purk2.morph.xml.REMOVED.git-id b/neuroml/PurkinjeCellPassivePulseInput/cells/purk2.morph.xml.REMOVED.git-id
deleted file mode 100644
index 79eb5a0c..00000000
--- a/neuroml/PurkinjeCellPassivePulseInput/cells/purk2.morph.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-a2c7b6423a90d87568abd004b40f5a4929240d69
\ No newline at end of file
diff --git a/neuroml/allChannelsCell/allChannelsCell.py b/neuroml/allChannelsCell/allChannelsCell.py
index 99ae4284..7df463c1 100644
--- a/neuroml/allChannelsCell/allChannelsCell.py
+++ b/neuroml/allChannelsCell/allChannelsCell.py
@@ -32,9 +32,9 @@ def loadGran98NeuroML_L123(filename):
     somaIKCa = setupTable('somaIKCa',moose.HHChannel(soma_path+'/Gran_KCa_98'),'Gk')
     #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
     soma = moose.Compartment(soma_path)
-    print "Reinit MOOSE ... "
+    print("Reinit MOOSE ... ")
     resetSim(['/elec','/cells'],simdt,plotdt) # from moose.utils
-    print "Running ... "
+    print("Running ... ")
     moose.start(runtime)
     tvec = arange(0.0,runtime,simdt)
     plot(tvec,somaVm.vector[1:])
@@ -56,7 +56,7 @@ def loadGran98NeuroML_L123(filename):
     title('KC current (A)')
     xlabel('time (s)')
     ylabel('')
-    print "Showing plots ..."
+    print("Showing plots ...")
     show()
 
 filename = "allChannelsCell.net.xml"
diff --git a/neuroml/lobster_pyloric/STG_net.py b/neuroml/lobster_pyloric/STG_net.py
index 91226362..ca4b5a9e 100644
--- a/neuroml/lobster_pyloric/STG_net.py
+++ b/neuroml/lobster_pyloric/STG_net.py
@@ -74,9 +74,9 @@ def loadRunSTGNeuroML_L123(filename):
 
     # monitor synaptic current
     soma2 = moose.element(soma2_path)
-    print "Children of",soma2_path,"are:"
+    print(("Children of",soma2_path,"are:"))
     for child in soma2.children:
-        print child.className, child.path
+        print((child.className, child.path))
     if graded_syn:
         syn_path = soma2_path+'/DoubExpSyn_Ach__cells-0-_AB_PD_0-0-_Soma_0'
         syn = moose.element(syn_path)
@@ -85,11 +85,11 @@ def loadRunSTGNeuroML_L123(filename):
         syn = moose.element(syn_path)
     syn_Ik = setupTable('DoubExpSyn_Ach_Ik',syn,'Ik')
 
-    print "Reinit MOOSE ... "
+    print("Reinit MOOSE ... ")
     resetSim(['/elec',cells_path], simdt, plotdt, simmethod='hsolve')
 
-    print "Using graded synapses? = ", graded_syn
-    print "Running model filename = ",filename," ... "
+    print(("Using graded synapses? = ", graded_syn))
+    print(("Running model filename = ",filename," ... "))
     moose.start(runtime)
     tvec = np.arange(0.0,runtime+2*plotdt,plotdt)
     tvec = tvec[ : soma1Vm.vector.size ]
@@ -139,7 +139,7 @@ def loadRunSTGNeuroML_L123(filename):
     plt.title('Ach syn current in '+soma2_path)
     plt.xlabel('time (s)')
     plt.ylabel('Isyn (S)')
-    print "Showing plots ..."
+    print("Showing plots ...")
     
     plt.show()
 
diff --git a/neuroml/lobster_pyloric/channels/ChannelTest.py b/neuroml/lobster_pyloric/channels/ChannelTest.py
index 1928c505..8b1f3e18 100644
--- a/neuroml/lobster_pyloric/channels/ChannelTest.py
+++ b/neuroml/lobster_pyloric/channels/ChannelTest.py
@@ -18,16 +18,16 @@ mechanisms = {
 
 import sys
 if len(sys.argv)<2:
-    print("Selecting a channel randomly form %s" % list(mechanisms.keys()))
-    channel_name = random.choice( mechanisms.keys() )
-    print("Selected %s" % channel_name )
+    print(("Selecting a channel randomly form %s" % list(mechanisms.keys())))
+    channel_name = random.choice( list(mechanisms.keys()) )
+    print(("Selected %s" % channel_name ))
 else:
     channel_name = sys.argv[1]
 
 if channel_name in mechanisms:
     mechanism_vars = mechanisms[channel_name]
 else:
-    print("Undefined channel, please use one of", list(mechanisms.keys()))
+    print(("Undefined channel, please use one of", list(mechanisms.keys())))
     sys.exit(1)
 
 CELSIUS = 35 # degrees Centigrade
@@ -39,7 +39,7 @@ from pylab import *
 if __name__ == "__main__":
 
     for varidx in range(len(mechanism_vars)/2): # loop over each inf and tau
-        print( "Running for %s" % varidx )
+        print(( "Running for %s" % varidx ))
         var = ['X','Y','Z'][varidx]
         gate = moose.element('/library/'+channel_name+'/gate'+var)
         VMIN = gate.min
diff --git a/neuroml/lobster_pyloric/synapses/AchSyn_STG.py b/neuroml/lobster_pyloric/synapses/AchSyn_STG.py
index 2c8f9690..8a56bbcf 100644
--- a/neuroml/lobster_pyloric/synapses/AchSyn_STG.py
+++ b/neuroml/lobster_pyloric/synapses/AchSyn_STG.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # -*- coding: utf-8 -*-
 import sys
 import math
@@ -8,7 +8,7 @@ from pylab import *
 try:
     import moose
 except ImportError:
-    print "ERROR: Could not import moose. Please add the directory containing moose.py in your PYTHONPATH"
+    print("ERROR: Could not import moose. Please add the directory containing moose.py in your PYTHONPATH")
     import sys
     sys.exit(1)
 
diff --git a/neuroml/lobster_pyloric/synapses/GluSyn_STG.py b/neuroml/lobster_pyloric/synapses/GluSyn_STG.py
index 256525b9..b03142f2 100644
--- a/neuroml/lobster_pyloric/synapses/GluSyn_STG.py
+++ b/neuroml/lobster_pyloric/synapses/GluSyn_STG.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # -*- coding: utf-8 -*-
 import sys
 import math
@@ -8,7 +8,7 @@ from pylab import *
 try:
     import moose
 except ImportError:
-    print "ERROR: Could not import moose. Please add the directory containing moose.py in your PYTHONPATH"
+    print("ERROR: Could not import moose. Please add the directory containing moose.py in your PYTHONPATH")
     import sys
     sys.exit(1)
 
diff --git a/neuroml/lobster_pyloric/synapses/load_synapses.py b/neuroml/lobster_pyloric/synapses/load_synapses.py
index 468ca332..fe8b50ee 100644
--- a/neuroml/lobster_pyloric/synapses/load_synapses.py
+++ b/neuroml/lobster_pyloric/synapses/load_synapses.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # -*- coding: utf-8 -*-
 
 from GluSyn_STG import GluSyn_STG
diff --git a/paper-2015/Fig2_elecModels/Fig2A.py b/paper-2015/Fig2_elecModels/Fig2A.py
index 997b5f2b..0a50accf 100644
--- a/paper-2015/Fig2_elecModels/Fig2A.py
+++ b/paper-2015/Fig2_elecModels/Fig2A.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -224,15 +224,15 @@ class ExcInhNetBase:
         t1 = time.time()
         print('reinit MOOSE -- takes a while ~20s.')
         moose.reinit()
-        print('reinit time t = ', time.time() - t1)
+        print(('reinit time t = ', time.time() - t1))
         t1 = time.time()
         print('starting')
         simadvance = self.simtime / 50.0
         for i in range( 50 ):
             moose.start( simadvance )
-            print('at t = ', i * simadvance, 'realtime = ', time.time() - t1)
+            print(('at t = ', i * simadvance, 'realtime = ', time.time() - t1))
         #moose.start(self.simtime)
-        print('runtime for ', self.simtime, 'sec, is t = ', time.time() - t1)
+        print(('runtime for ', self.simtime, 'sec, is t = ', time.time() - t1))
 
         if plotif:
             self._plot()
diff --git a/paper-2015/Fig2_elecModels/Fig2A_analysis.py b/paper-2015/Fig2_elecModels/Fig2A_analysis.py
index 8caeccb5..0514bca5 100644
--- a/paper-2015/Fig2_elecModels/Fig2A_analysis.py
+++ b/paper-2015/Fig2_elecModels/Fig2A_analysis.py
@@ -13,7 +13,7 @@ fulltime = 1200         #s
 plotdt = 1              #s
 numpts = int(fulltime/plotdt)+1
 
-print 'reading'
+print('reading')
 wts = []
 while True:
     next_line = ''
@@ -23,7 +23,7 @@ while True:
     if next_line == '': break
     next_wt = [float(fh.readline()) for i in range(numpts)]
     wts.append(next_wt)
-    print 'weight',len(wts)
+    print(('weight',len(wts)))
 
 
 hiAve = np.zeros( len( wts[0] ) )
@@ -54,7 +54,7 @@ dumpVec( f, 'lowExample', wts[5] )
 f.close()
 
 
-print 'numHi = ', numHi, ' plotting...'
+print(('numHi = ', numHi, ' plotting...'))
 figure()
 plot(transpose(wts))
 plot( hiAve, linewidth=4 )
diff --git a/paper-2015/Fig2_elecModels/Fig2C.py b/paper-2015/Fig2_elecModels/Fig2C.py
index 5314c3ac..39604026 100644
--- a/paper-2015/Fig2_elecModels/Fig2C.py
+++ b/paper-2015/Fig2_elecModels/Fig2C.py
@@ -182,10 +182,10 @@ def displayPlots():
     pylab.figure(2, figsize= (8,10))
     ax = pylab.subplot( 1,1,1 )
     neuron = moose.element( '/model/elec' )
-    comptDistance = dict( zip( neuron.compartments, neuron.pathDistanceFromSoma ) )
+    comptDistance = dict( list(zip( neuron.compartments, neuron.pathDistanceFromSoma )) )
     for i in moose.wildcardFind( '/library/#[ISA=ChanBase]' ):
         chans = moose.wildcardFind( '/model/elec/#/' + i.name )
-        print i.name, len( chans )
+        print((i.name, len( chans )))
         p = [ 1e6*comptDistance.get( j.parent, 0) for j in chans ]
         Gbar = [ j.Gbar/(j.parent.length * j.parent.diameter * PI) for j in chans ]
         if len( p ) > 2:
@@ -213,7 +213,7 @@ def create_vm_viewer(rdes):
                                                                   0.0,
                                                                   0.1)])
     mapper = moogli.utilities.mapper(colormap, normalizer)
-    vms = [moose.element(x).Vm for x in network.shapes.keys()]
+    vms = [moose.element(x).Vm for x in list(network.shapes.keys())]
     network.set("color", vms, mapper)
 
     def prelude(view):
@@ -222,7 +222,7 @@ def create_vm_viewer(rdes):
 
     def interlude(view):
         moose.start(frameRunTime)
-        vms = [moose.element(x).Vm for x in network.shapes.keys()]
+        vms = [moose.element(x).Vm for x in list(network.shapes.keys())]
         network.set("color", vms, mapper)
         view.yaw(0.01)
         currTime = moose.element('/clock').currentTime
@@ -235,7 +235,7 @@ def create_vm_viewer(rdes):
         displayPlots()
 
     viewer = moogli.Viewer("vm-viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     view = moogli.View("vm-view",
                        prelude=prelude,
                        interlude=interlude,
@@ -247,7 +247,7 @@ def create_vm_viewer(rdes):
 def create_ca_viewer(rdes):
     network = moogli.extensions.moose.read(rdes.elecid.path)
     ca_elements = []
-    for compartment_path in network.shapes.keys():
+    for compartment_path in list(network.shapes.keys()):
         if moose.exists(compartment_path + '/Ca_conc'):
             ca_elements.append(moose.element(compartment_path + '/Ca_conc'))
         else:
@@ -286,7 +286,7 @@ def create_ca_viewer(rdes):
             view.stop()
 
     viewer = moogli.Viewer("ca-viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     view = moogli.View("ca-view",
                        prelude=prelude,
                        interlude=interlude)
@@ -294,7 +294,7 @@ def create_ca_viewer(rdes):
     return viewer
 
 def build3dDisplay(rdes):
-    print "building 3d Display"
+    print("building 3d Display")
     app = QtGui.QApplication(sys.argv)
 
     vm_viewer = create_vm_viewer(rdes)
@@ -325,7 +325,7 @@ def deliverStim( currTime ):
         step = int (currTime / frameRunTime )
         probeStep = int( probeInterval / frameRunTime )
         if step % probeStep == 0:
-            print "Doing probe Stim at ", currTime
+            print(("Doing probe Stim at ", currTime))
             for i in synSpineList:
                 i.activation( probeAmplitude )
 
@@ -341,7 +341,7 @@ def main():
     temp = set( moose.wildcardFind( "/model/elec/#/glu,/model/elec/#/NMDA" ) )
 
     synDendList = list( temp - set( synSpineList ) )
-    print "num spine, dend syns = ", len( synSpineList ), len( synDendList )
+    print(("num spine, dend syns = ", len( synSpineList ), len( synDendList )))
     moose.reinit()
     #for i in moose.wildcardFind( '/model/elec/#apical#/#[ISA=CaConcBase]' ):
         #print i.path, i.length, i.diameter, i.parent.length, i.parent.diameter
@@ -350,7 +350,7 @@ def main():
     # Run for baseline, tetanus, and post-tetanic settling time 
     t1 = time.time()
     build3dDisplay(rdes)
-    print 'real time = ', time.time() - t1
+    print(('real time = ', time.time() - t1))
 
 if __name__ == '__main__':
     main()
diff --git a/paper-2015/Fig2_elecModels/Fig2D.py b/paper-2015/Fig2_elecModels/Fig2D.py
index ef8a05eb..94ffcd83 100644
--- a/paper-2015/Fig2_elecModels/Fig2D.py
+++ b/paper-2015/Fig2_elecModels/Fig2D.py
@@ -49,7 +49,7 @@ def create_vm_viewer(rdes):
                                                                   0.0,
                                                                   0.9)])
     mapper = moogli.utilities.mapper(colormap, normalizer)
-    vms = [moose.element(x).Vm for x in network.shapes.keys()]
+    vms = [moose.element(x).Vm for x in list(network.shapes.keys())]
     network.set("color", vms, mapper)
 
     def interlude(view):
@@ -62,7 +62,7 @@ def create_vm_viewer(rdes):
             view.stop()
 
     viewer = moogli.Viewer("vm-viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     view = moogli.View("vm-view",
                        interlude=interlude)
     viewer.attach_view(view)
@@ -93,7 +93,7 @@ def main():
     compts[0].inject = inject
 
     ################## Now we set up the display ########################
-    print "Setting Up 3D Display"
+    print("Setting Up 3D Display")
     app = QtGui.QApplication(sys.argv)
     vm_viewer = create_vm_viewer(rdes)
     vm_viewer.showMaximized()
diff --git a/paper-2015/Fig2_elecModels/Fig2E.py b/paper-2015/Fig2_elecModels/Fig2E.py
index 1a02727a..08d64060 100644
--- a/paper-2015/Fig2_elecModels/Fig2E.py
+++ b/paper-2015/Fig2_elecModels/Fig2E.py
@@ -59,7 +59,7 @@ def create_vm_viewer(rdes, somaVm):
                                                                   0.9)])
     mapper = moogli.utilities.mapper(colormap, normalizer)
 
-    vms = [moose.element(x).Vm for x in network.shapes.keys()]
+    vms = [moose.element(x).Vm for x in list(network.shapes.keys())]
     network.set("color", vms, mapper)
 
     def prelude(view):
@@ -67,7 +67,7 @@ def create_vm_viewer(rdes, somaVm):
 
     def interlude(view):
         moose.start(frameRunTime)
-        vms = [moose.element(x).Vm for x in network.shapes.keys()]
+        vms = [moose.element(x).Vm for x in list(network.shapes.keys())]
         network.set("color", vms, mapper)
         view.yaw(0.01)
         currTime = moose.element('/clock').currentTime
@@ -84,7 +84,7 @@ def create_vm_viewer(rdes, somaVm):
         pylab.show()
 
     viewer = moogli.Viewer("vm-viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     view = moogli.View("vm-view",
                        prelude=prelude,
                        interlude=interlude,
@@ -114,7 +114,7 @@ def main():
     compts = moose.wildcardFind( "/model/elec/#[ISA=CompartmentBase]" )
     compts[0].inject = inject
 
-    print "Setting Up 3D Display"
+    print("Setting Up 3D Display")
     app = QtGui.QApplication(sys.argv)
     vm_viewer = create_vm_viewer(rdes, somaVm)
     vm_viewer.show()
diff --git a/paper-2015/Fig2_elecModels/chans/CA1.morph.xml.REMOVED.git-id b/paper-2015/Fig2_elecModels/chans/CA1.morph.xml.REMOVED.git-id
deleted file mode 100644
index be0ea2fb..00000000
--- a/paper-2015/Fig2_elecModels/chans/CA1.morph.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-2a3815b394f8bcb4b6450081d9ba45d20abdf3cf
\ No newline at end of file
diff --git a/paper-2015/Fig3_chemModels/Fig3D.py b/paper-2015/Fig3_chemModels/Fig3D.py
index b2117f22..8cd2be9a 100644
--- a/paper-2015/Fig3_chemModels/Fig3D.py
+++ b/paper-2015/Fig3_chemModels/Fig3D.py
@@ -59,7 +59,7 @@ t1 = time.time()
 for t in range( 0, runtime-1, updateDt ):
     moose.start( updateDt )
     plt = pylab.plot( x, c.vec.n, label='t = '+str(t + updateDt) )
-print "Time = ", time.time() - t1
+print(("Time = ", time.time() - t1))
 
 pylab.ylim( 0, 1.05 )
 pylab.legend()
diff --git a/paper-2015/Fig3_chemModels/Fig3_NEURON.py b/paper-2015/Fig3_chemModels/Fig3_NEURON.py
index ea4330c4..66d03f7a 100644
--- a/paper-2015/Fig3_chemModels/Fig3_NEURON.py
+++ b/paper-2015/Fig3_chemModels/Fig3_NEURON.py
@@ -36,9 +36,9 @@ plot_it('r')
 interval = 50
 
 t1 = time.time()
-for i in xrange(1, 5):
+for i in range(1, 5):
     h.continuerun(i * interval)
     plot_it()
-print "Time = ", time.time() - t1
+print(("Time = ", time.time() - t1))
 
 pyplot.show()
diff --git a/paper-2015/Fig4_ReacDiff/Fig4B.py b/paper-2015/Fig4_ReacDiff/Fig4B.py
index fd3029f1..cc19cba3 100644
--- a/paper-2015/Fig4_ReacDiff/Fig4B.py
+++ b/paper-2015/Fig4_ReacDiff/Fig4B.py
@@ -130,7 +130,7 @@ def createVmViewer(rdes):
     mapper = moogli.utilities.mapper(colormap, normalizer)
 
     def prelude(view):
-        vms = [moose.element(x).Vm for x in network.shapes.keys()]
+        vms = [moose.element(x).Vm for x in list(network.shapes.keys())]
         network.set("color", vms, mapper)
         view.pitch(PI/2.0)
         view.down(450)
@@ -145,7 +145,7 @@ def createVmViewer(rdes):
         view.yaw(0.01)
 
     viewer = moogli.Viewer("vm-viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     view = moogli.View("vm-view",
                        prelude=prelude,
                        interlude=interlude)
@@ -167,7 +167,7 @@ def main():
     if do3D:
         app = QtGui.QApplication(sys.argv)
         compts = moose.wildcardFind( "/model/elec/#[ISA=CompartmentBase]" )
-        print "LEN = ", len( compts )
+        print(("LEN = ", len( compts )))
         for i in compts:
             n = i.name[:4]
             if ( n == 'head' or n == 'shaf' ):
diff --git a/paper-2015/Fig4_ReacDiff/Fig4CDEF.py b/paper-2015/Fig4_ReacDiff/Fig4CDEF.py
index 5d769096..5b9a1ddf 100644
--- a/paper-2015/Fig4_ReacDiff/Fig4CDEF.py
+++ b/paper-2015/Fig4_ReacDiff/Fig4CDEF.py
@@ -175,7 +175,7 @@ def displayPlots():
         for k in i[0].vec:
             plt.plot( timePts, k.vector * i[4] )
         #plt.title( i.name )
-        print i[0].name
+        print((i[0].name))
 
     plt.xlabel( 'Time (s)', fontsize = 16 )
     plt.show()
@@ -194,7 +194,7 @@ def main():
     moose.reinit()
     buildPlots()
     # Run for baseline, tetanus, and post-tetanic settling time 
-    print 'starting...'
+    print('starting...')
     t1 = time.time()
     moose.start( baselineTime )
     caPsd = moose.vec( '/model/chem/psd/Ca_input' )
@@ -218,12 +218,12 @@ def main():
     caPsd.concInit = basalCa
     caDend.concInit = basalCa
     moose.start( postLtdTime )
-    print 'real time = ', time.time() - t1
+    print(('real time = ', time.time() - t1))
 
     if do3D:
         app = QtGui.QApplication(sys.argv)
         compts = moose.wildcardFind( "/model/elec/#[ISA=compartmentBase]" )
-        ecomptPath = map( lambda x : x.path, compts )
+        ecomptPath = [x.path for x in compts]
         morphology = moogli.read_morphology_from_moose(name = "", path = "/model/elec")
         morphology.create_group( "group_all", ecomptPath, -0.08, 0.02, \
             [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 0.9] )
diff --git a/paper-2015/Fig4_ReacDiff/Fig4GHIJ.py b/paper-2015/Fig4_ReacDiff/Fig4GHIJ.py
index 997dfd91..aec72b1f 100644
--- a/paper-2015/Fig4_ReacDiff/Fig4GHIJ.py
+++ b/paper-2015/Fig4_ReacDiff/Fig4GHIJ.py
@@ -175,7 +175,7 @@ def displayPlots():
         for k in i[0].vec:
             plt.plot( timePts, k.vector * i[4] )
         #plt.title( i.name )
-        print i[0].name
+        print((i[0].name))
 
     plt.xlabel( 'Time (s)', fontsize = 16 )
     plt.show()
@@ -194,7 +194,7 @@ def main():
     moose.reinit()
     buildPlots()
     # Run for baseline, tetanus, and post-tetanic settling time 
-    print 'starting...'
+    print('starting...')
     t1 = time.time()
     moose.start( baselineTime )
     caPsd = moose.vec( '/model/chem/psd/Ca_input' )
@@ -218,12 +218,12 @@ def main():
     caPsd.concInit = basalCa
     caDend.concInit = basalCa
     moose.start( postLtdTime )
-    print 'real time = ', time.time() - t1
+    print(('real time = ', time.time() - t1))
 
     if do3D:
         app = QtGui.QApplication(sys.argv)
         compts = moose.wildcardFind( "/model/elec/#[ISA=compartmentBase]" )
-        ecomptPath = map( lambda x : x.path, compts )
+        ecomptPath = [x.path for x in compts]
         morphology = moogli.read_morphology_from_moose(name = "", path = "/model/elec")
         morphology.create_group( "group_all", ecomptPath, -0.08, 0.02, \
             [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 0.9] )
diff --git a/paper-2015/Fig4_ReacDiff/rxdSpineSize.py b/paper-2015/Fig4_ReacDiff/rxdSpineSize.py
index 1d071aba..544adc56 100644
--- a/paper-2015/Fig4_ReacDiff/rxdSpineSize.py
+++ b/paper-2015/Fig4_ReacDiff/rxdSpineSize.py
@@ -54,7 +54,7 @@ def makeChemProto( name ):
     chem = moose.Neutral( '/library/' + name )
     comptVol = diffLen * dendDia * dendDia * PI / 4.0
     for i in ( ['dend', comptVol], ['spine', 1e-19], ['psd', 1e-20] ):
-        print 'making ', i
+        print(('making ', i))
         compt = moose.CubeMesh( chem.path + '/' + i[0] )
         compt.volume = i[1]
         #x = moose.Pool( compt.path + '/x' )
@@ -72,7 +72,7 @@ def makeChemProto( name ):
     x.diffConst = diffConst
     func = moose.Function( x.path + '/func' )
     func.expr = "-x0 * (0.3 - " + nstr + " * x0) * ( 1 - " + nstr + " * x0)"
-    print func.expr
+    print((func.expr))
     func.x.num = 1
     moose.connect( x, 'nOut', func.x[0], 'input' )
     moose.connect( func, 'valueOut', x, 'increment' )
@@ -264,9 +264,9 @@ def create_viewer(path, moose_dendrite, dendZ, diaTab, psdZ):
             view.stop()
 
     viewer = moogli.Viewer("Viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     viewer.detach_shape(dendrite)
-    viewer.attach_shapes(chem_compt_group.shapes.values())
+    viewer.attach_shapes(list(chem_compt_group.shapes.values()))
 
     view = moogli.View("main-view",
                        prelude=prelude,
diff --git a/paper-2015/Fig5_CellMultiscale/Fig5A.py b/paper-2015/Fig5_CellMultiscale/Fig5A.py
index 330516ea..0aa1e00b 100644
--- a/paper-2015/Fig5_CellMultiscale/Fig5A.py
+++ b/paper-2015/Fig5_CellMultiscale/Fig5A.py
@@ -109,7 +109,7 @@ def interlude( view ):
 	view.yaw( 0.01 )
 
 def create_viewer(rdes):
-    print ' doing viewer for ', rdes.soma.path
+    print((' doing viewer for ', rdes.soma.path))
     network = moogli.extensions.moose.read(rdes.elecid.path)
     normalizer = moogli.utilities.normalizer(-0.08,
                                              0.02,
@@ -125,10 +125,10 @@ def create_viewer(rdes):
                                                                   0.9)])
     mapper = moogli.utilities.mapper(colormap, normalizer)
 
-    vms = [moose.element(x).Vm for x in network.shapes.keys()]
+    vms = [moose.element(x).Vm for x in list(network.shapes.keys())]
     network.set("color", vms, mapper)
     viewer = moogli.Viewer("vm-viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     view = moogli.View("vm-view", interlude=interlude )
     viewer.attach_view(view)
     viewer.show()
@@ -143,7 +143,7 @@ def main():
     viewers = []
     j = 0
     for i in elecFileNames:
-        print i
+        print(i)
         ename = '/model' + str(j)
         rdes.cellProtoList = [ ['./cells/' + i, 'elec' ] ]
         rdes.buildModel( ename )
diff --git a/paper-2015/Fig5_CellMultiscale/Fig5BCD.py b/paper-2015/Fig5_CellMultiscale/Fig5BCD.py
index 78595b4d..7e3889cd 100644
--- a/paper-2015/Fig5_CellMultiscale/Fig5BCD.py
+++ b/paper-2015/Fig5_CellMultiscale/Fig5BCD.py
@@ -197,7 +197,7 @@ def buildPlots( rdes ):
     moose.connect( eSpineGkTab, 'requestOut', path, 'getGk' )
 
 def saveAndClearPlots( name ):
-    print 'saveAndClearPlots( ', name, ' )'
+    print(('saveAndClearPlots( ', name, ' )'))
     for i in moose.wildcardFind( "/graphs/#" ):
         #plot stuff
         i.xplot( name + '.xplot', i.name )
@@ -208,8 +208,8 @@ def printPsd( name ):
     psdR = moose.vec( '/model/chem/psd/tot_PSD_R' )
     neuronVoxel = moose.element( '/model/chem/spine' ).neuronVoxel
     elecComptMap = moose.element( '/model/chem/dend' ).elecComptMap
-    print "len( neuronVoxel = ", len( neuronVoxel), min( neuronVoxel), max( neuronVoxel)
-    print len( elecComptMap), elecComptMap[0], elecComptMap[12]
+    print(("len( neuronVoxel = ", len( neuronVoxel), min( neuronVoxel), max( neuronVoxel)))
+    print((len( elecComptMap), elecComptMap[0], elecComptMap[12]))
     neuron = moose.element( '/model/elec' )
     ncompts = neuron.compartments
     d = {}
@@ -255,7 +255,7 @@ def main():
     numpy.random.seed( 1234 )
     rdes = buildRdesigneur()
     for i in elecFileNames:
-        print i
+        print(i)
         rdes.cellProtoList = [ ['./cells/' + i, 'elec'] ]
         rdes.buildModel( '/model' )
         assert( moose.exists( '/model' ) )
@@ -270,7 +270,7 @@ def main():
         probeStimulus( baselineTime )
         tetanicStimulus( tetTime )
         probeStimulus( postTetTime )
-        print 'real time = ', time.time() - t1
+        print(('real time = ', time.time() - t1))
 
         printPsd( i + ".fig5" )
         saveAndClearPlots( i + ".fig5" )
diff --git a/paper-2015/Fig6_NetMultiscale/Fig6A.py b/paper-2015/Fig6_NetMultiscale/Fig6A.py
index 752fa896..489b1b76 100644
--- a/paper-2015/Fig6_NetMultiscale/Fig6A.py
+++ b/paper-2015/Fig6_NetMultiscale/Fig6A.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -319,7 +319,7 @@ class ExcInhNetBase:
         numVms = 10
         self.plots = moose.Table( '/plotVms', numVms )
         ## draw numVms out of N neurons
-        nrnIdxs = random.sample(range(self.N),numVms)
+        nrnIdxs = random.sample(list(range(self.N)),numVms)
         for i in range( numVms ):
             moose.connect( self.network.vec[nrnIdxs[i]], 'VmOut', \
                 self.plots.vec[i], 'input')
@@ -444,7 +444,7 @@ def create_viewer(rdes):
      #    dendrite.set_colors(moogli.core.Vec4f(173 / 255.0, 216 / 255.0, 230 / 255.0, 1.0))
 
     [shape.set_radius(shape.get_apex_radius() * 4.0) for shape in
-     network.groups["spine"].groups["head"].shapes.values()]
+     list(network.groups["spine"].groups["head"].shapes.values())]
     # print "Creating LIFS"
     soma = network.shapes[rdes.soma.path]
 
@@ -474,8 +474,8 @@ def create_viewer(rdes):
     # print "Creating Viewer"
     viewer = moogli.Viewer("viewer") # prelude = prelude, interlude = interlude)
     # print "Created Viewer"
-    viewer.attach_shapes(network.shapes.values())
-    viewer.attach_shapes(lifs.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
+    viewer.attach_shapes(list(lifs.shapes.values()))
     # print "Attached Shapes"
     view = moogli.View("view", interlude=interlude)
     viewer.attach_view(view)
@@ -492,7 +492,7 @@ if __name__=='__main__':
     ## Instantiate either ExcInhNetBase or ExcInhNet below
     #net = ExcInhNetBase(N=N)
     net = ExcInhNet(N=N)
-    print net
+    print(net)
     moose.le( '/' )
     moose.le( '/network' )
     rdes = buildRdesigneur()
diff --git a/paper-2015/Fig6_NetMultiscale/Fig6BCDE.py b/paper-2015/Fig6_NetMultiscale/Fig6BCDE.py
index 6d795700..9a5fb806 100644
--- a/paper-2015/Fig6_NetMultiscale/Fig6BCDE.py
+++ b/paper-2015/Fig6_NetMultiscale/Fig6BCDE.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -11,6 +10,7 @@
 '''
 This LIF network with Ca plasticity is based on:
 David Higgins, Michael Graupner, Nicolas Brunel
+
     Memory Maintenance in Synapses with Calcium-Based
     Plasticity in the Presence of Background Activity
     PLOS Computational Biology, 2014.
@@ -21,8 +21,11 @@ This variant has 2500 LIF neurons
 Upi Bhalla, Nov 2014: Appended single neuron model.
 This script generates the panels in Figure 6. It takes a long time,
 about 65 minutes to run 30 seconds of simulation time.
+
 '''
 
+from __future__ import print_function
+
 ## import modules and functions to be used
 import numpy as np
 import matplotlib.pyplot as plt
@@ -33,11 +36,9 @@ from PyQt4 import Qt, QtCore, QtGui
 from numpy import random as nprand
 from moose.neuroml.NeuroML import NeuroML
 import sys
-sys.path.append( "/home/bhalla/moose/trunk/Demos/util" )
 import rdesigneur as rd
 import moogli
 cellname = "./cells_channels/CA1_nochans.morph.xml"
-#cellname = "./ca1_minimal.p"
 fname = "fig6bcde"
 
 #############################################
@@ -937,4 +938,4 @@ if __name__=='__main__':
     plt.show()
     plt.savefig( fname + '.svg', bbox_inches='tight')
     print( "Hit 'enter' to exit" )
-    input()
+    eval(input())
diff --git a/paper-2015/Fig6_NetMultiscale/ReducedModel.py b/paper-2015/Fig6_NetMultiscale/ReducedModel.py
index 6b0ae964..3f151cb3 100644
--- a/paper-2015/Fig6_NetMultiscale/ReducedModel.py
+++ b/paper-2015/Fig6_NetMultiscale/ReducedModel.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -8,6 +7,8 @@
 #** See the file COPYING.LIB for the full notice.
 #**********************************************************************/
 
+from __future__ import print_function
+
 '''
 This LIF network with Ca plasticity is based on:
 David Higgins, Michael Graupner, Nicolas Brunel
@@ -314,7 +315,7 @@ def connectDetailedNeuron():
             x.vec.weight = nprand.rand( exc.numEntries ) * excWeightMax
             #x.parent.tick = 4
             x.parent.parent.tick = 4
-            print '+',
+            print('+', end=' ')
             totGluWt += sum(x.vec.weight) * x.parent.parent.Gbar
 
     seed = excSeed
@@ -330,7 +331,7 @@ def connectDetailedNeuron():
             x.vec.weight = nprand.rand( exc.numEntries ) * nmdaWeightMax
             #x.parent.tick = 4
             x.parent.parent.tick = 4
-            print '*',
+            print('*', end=' ')
             totNMDAWt += sum(x.vec.weight) * x.parent.parent.Gbar
 
     seed = inhSeed
@@ -345,11 +346,11 @@ def connectDetailedNeuron():
             x.vec.weight = nprand.rand( inh.numEntries ) * inhWeightMax
             #x.parent.tick = 4
             x.parent.parent.tick = 4
-            print '-',
+            print('-', end=' ')
             totGABAWt += sum(x.vec.weight) * x.parent.parent.Gbar
 
-    print 'connectDetailedNeuron: numExc = ', numExc, ', numNMDA=', numNMDA, ', numInh = ', numInh
-    print 'connectDetailedNeuron: totWts Glu = ', totGluWt, ', NMDA = ', totNMDAWt, ', GABA = ', totGABAWt
+    print('connectDetailedNeuron: numExc = ', numExc, ', numNMDA=', numNMDA, ', numInh = ', numInh)
+    print('connectDetailedNeuron: totWts Glu = ', totGluWt, ', NMDA = ', totNMDAWt, ', GABA = ', totGABAWt)
 
 #############################################
 # Exc-Inh network base class without connections
@@ -452,7 +453,7 @@ class ExcInhNetBase:
         numVms = 10
         self.plots = moose.Table( '/plotVms', numVms )
         ## draw numVms out of N neurons
-        nrnIdxs = random.sample(range(self.N),numVms)
+        nrnIdxs = random.sample(list(range(self.N)),numVms)
         for i in range( numVms ):
             moose.connect( self.network.vec[nrnIdxs[i]], 'VmOut', \
                 self.plots.vec[i], 'input')
@@ -577,7 +578,7 @@ class ExcInhNet(ExcInhNetBase):
 
             ## Connections from some Exc neurons to each Exc neuron
             ## draw excC number of neuron indices out of NmaxExc neurons
-            preIdxs = random.sample(range(self.NmaxExc),self.excC)
+            preIdxs = random.sample(list(range(self.NmaxExc)),self.excC)
             ## connect these presynaptically to i-th post-synaptic neuron
             for synnum,preIdx in enumerate(preIdxs):
                 synidx = i*self.excC+synnum
@@ -630,7 +631,7 @@ class ExcInhNet(ExcInhNetBase):
 
             ## Connections from some Inh neurons to each Exc neuron
             ## draw inhC=incC-excC number of neuron indices out of inhibitory neurons
-            preIdxs = random.sample(range(self.NmaxExc,self.N),self.incC-self.excC)
+            preIdxs = random.sample(list(range(self.NmaxExc,self.N)),self.incC-self.excC)
             ## connect these presynaptically to i-th post-synaptic neuron
             for synnum,preIdx in enumerate(preIdxs):
                 synij = self.synsIE.vec[i].synapse[synnum]
@@ -645,7 +646,7 @@ class ExcInhNet(ExcInhNetBase):
             self.synsI.vec[i].numSynapses = self.incC
 
             ## draw excC number of neuron indices out of NmaxExc neurons
-            preIdxs = random.sample(range(self.NmaxExc),self.excC)
+            preIdxs = random.sample(list(range(self.NmaxExc)),self.excC)
             ## connect these presynaptically to i-th post-synaptic neuron
             for synnum,preIdx in enumerate(preIdxs):
                 synij = self.synsI.vec[i].synapse[synnum]
@@ -655,7 +656,7 @@ class ExcInhNet(ExcInhNetBase):
                 synij.weight = self.J   # activation = weight
 
             ## draw inhC=incC-excC number of neuron indices out of inhibitory neurons
-            preIdxs = random.sample(range(self.NmaxExc,self.N),self.incC-self.excC)
+            preIdxs = random.sample(list(range(self.NmaxExc,self.N)),self.incC-self.excC)
             ## connect these presynaptically to i-th post-synaptic neuron
             for synnum,preIdx in enumerate(preIdxs):
                 synij = self.synsI.vec[i].synapse[ self.excC + synnum ]
@@ -829,7 +830,7 @@ if __name__=='__main__':
     ## Instantiate either ExcInhNetBase or ExcInhNet below
     #net = ExcInhNetBase(N=N)
     net = ExcInhNet(N=N)
-    print net
+    print(net)
     moose.le( '/' )
     moose.le( '/network' )
     rdes = buildRdesigneur()
@@ -865,7 +866,7 @@ if __name__=='__main__':
 
     moose.reinit()
     t1 = time.time()
-    print 'starting'
+    print('starting')
     for currTime in np.arange( 0, simtime, updateDt ):
         moose.start(updateDt)
         lastt = net.network.vec.lastEventTime
@@ -874,7 +875,7 @@ if __name__=='__main__':
         ret.set_array( lastt )
         fig2.canvas.draw()
 
-    print 'runtime, t = ', time.time() - t1
+    print('runtime, t = ', time.time() - t1)
 
     if plotif:
         net._plot( fig )
@@ -884,4 +885,4 @@ if __name__=='__main__':
     plt.show()
     plt.savefig( fname + '.svg', bbox_inches='tight')
     print( "Hit 'enter' to exit" )
-    raw_input()
+    input()
diff --git a/paper-2015/rxdSpineSize.py b/paper-2015/rxdSpineSize.py
index c6fb8280..77a9fec8 100644
--- a/paper-2015/rxdSpineSize.py
+++ b/paper-2015/rxdSpineSize.py
@@ -54,7 +54,7 @@ def makeChemProto( name ):
     chem = moose.Neutral( '/library/' + name )
     comptVol = diffLen * dendDia * dendDia * PI / 4.0
     for i in ( ['dend', comptVol], ['spine', 1e-19], ['psd', 1e-20] ):
-        print 'making ', i
+        print(('making ', i))
         compt = moose.CubeMesh( chem.path + '/' + i[0] )
         compt.volume = i[1]
         #x = moose.Pool( compt.path + '/x' )
@@ -72,7 +72,7 @@ def makeChemProto( name ):
     x.diffConst = diffConst
     func = moose.Function( x.path + '/func' )
     func.expr = "-x0 * (0.3 - " + nstr + " * x0) * ( 1 - " + nstr + " * x0)"
-    print func.expr
+    print((func.expr))
     func.x.num = 1
     moose.connect( x, 'nOut', func.x[0], 'input' )
     moose.connect( func, 'valueOut', x, 'increment' )
@@ -264,9 +264,9 @@ def create_viewer(path, moose_dendrite, dendZ, diaTab, psdZ):
             view.stop()
 
     viewer = moogli.Viewer("Viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     viewer.detach_shape(dendrite)
-    viewer.attach_shapes(chem_compt_group.shapes.values())
+    viewer.attach_shapes(list(chem_compt_group.shapes.values()))
 
     view = moogli.View("main-view",
                        prelude=prelude,
diff --git a/parallelSolver/Fig2_v4.py b/parallelSolver/Fig2_v4.py
index 87888ade..52535a3b 100644
--- a/parallelSolver/Fig2_v4.py
+++ b/parallelSolver/Fig2_v4.py
@@ -1,229 +1,229 @@
-# Generates time-series response to a Ca pulse for each of the models. No
-# diffusion involved.
-
-import sys
-import numpy as np
-import pylab
-import matplotlib.pyplot as plt
-import moose
-import abstrModelEqns2
-import rdesigneur as rd
-import time
-
-
-def singleCompt( name, params ):
-    mod = moose.copy( '/library/' + name + '/' + name, '/model' )
-    A = moose.element( mod.path + '/A' )
-    Z = moose.element( mod.path + '/Z' )
-    Z.nInit = 1
-    Ca = moose.element( mod.path + '/Ca' )
-    CaStim = moose.element( Ca.path + '/CaStim' )
-    runtime = params['preStimTime'] + params['stimWidth'] + params['postStimTime'] 
-    steptime = 100
-
-    CaStim.expr += ' + x2 * (t > ' + str( runtime ) + ' ) * ( t < ' + str( runtime + steptime ) +  ' )'
-    print CaStim.expr
-    tab = moose.Table2( '/model/' + name + '/Atab' )
-    #for i in range( 10, 19 ):
-        #moose.setClock( i, 0.01 )
-    ampl = moose.element( mod.path + '/ampl' )
-    phase = moose.element( mod.path + '/phase' )
-    moose.connect( tab, 'requestOut', A, 'getN' )
-    ampl.nInit = params['stimAmplitude'] * 1
-    phase.nInit = params['preStimTime']
-
-    ksolve = moose.Ksolve( mod.path + '/ksolve' )
-    stoich = moose.Stoich( mod.path + '/stoich' )
-    stoich.compartment = mod
-    stoich.ksolve = ksolve
-    stoich.path = mod.path + '/##'
-    runtime += 2 * steptime
-
-    moose.reinit()
-    moose.start( runtime )
-    t = np.arange( 0, runtime + 1e-9, tab.dt )
-    return name, t, tab.vector
-    #pylab.plot( t, tab.vector, label='[A] (mM)' )
-    
-    #pylab.show()
-
-def plotBoilerplate( panelTitle, plotPos, xlabel = ''):
-    ax = plt.subplot( 8,4,plotPos )
-    #ax.xaxis.set_ticks( i[1] )
-    #ax.locator_params( 
-    ax.spines['top'].set_visible( False )
-    ax.spines['right'].set_visible( False )
-    ax.tick_params( direction = 'out' )
-    if (((plotPos -1)/4) % 2) == 0:
-        ax.set_xticklabels([])
-    else:
-        ax.set_xlabel( xlabel )
-    for tick in ax.xaxis.get_major_ticks():
-        tick.tick2On = False
-    for tick in ax.yaxis.get_major_ticks():
-        tick.tick2On = False
-    
-    if (plotPos % 4) == 1:
-        plt.ylabel( 'conc', fontsize = 16 )
-        # alternate way of doing this separately.
-        #plt.yaxis.label.size_size(16)
-        #plt.title( 'B' )
-        ax.text( -0.3, 1, panelTitle, fontsize = 18, weight = 'bold',
-        transform=ax.transAxes )
-    return ax
-
-def plotPanelB():
-    panelB = []
-    panelBticks = []
-    panelB.append( singleCompt( 'fhn', abstrModelEqns2.makeFHN() ) )
-    panelB.append( singleCompt( 'bis', abstrModelEqns2.makeBis() ) )
-    panelB.append( singleCompt( 'negFB', abstrModelEqns2.makeNegFB() ) )
-    panelB.append( singleCompt( 'negFF', abstrModelEqns2.makeNegFF() ) )
-
-    panelBticks.append( np.arange( 0, 4.00001, 1 ) )
-    panelBticks.append( np.arange( 0, 4.00001, 1 ) )
-    panelBticks.append( np.arange( 0, 15.00001, 5 ) )
-    panelBticks.append( np.arange( 0, 6.00001, 2 ) )
-    moose.delete( '/model' )
-
-    for i in zip( panelB, panelBticks, range( len( panelB ) ) ):
-        plotPos = i[2] + 5
-        ax = plotBoilerplate( 'B', plotPos )
-        plt.plot( i[0][1], i[0][2] )
-        xmax = ax.get_xlim()[1]
-        #ax.xaxis.set_ticks( np.arange( 0, xmax, 50 ) )
-        ax.xaxis.set_ticks( np.arange( 0, 200.001, 50 ) )
-        ax.yaxis.set_ticks( i[1] )
-
-def runPanelCDEF( name, dist, seqDt, numSpine, seq, stimAmpl ):
-    preStim = 10.0
-    blanks = 20
-    rdes = rd.rdesigneur(
-        useGssa = False,
-        turnOffElec = True,
-        chemPlotDt = 0.1,
-        #diffusionLength = params['diffusionLength'],
-        diffusionLength = 1e-6,
-        cellProto = [['cell', 'soma']],
-        chemProto = [['dend', name]],
-        chemDistrib = [['dend', 'soma', 'install', '1' ]],
-        plotList = [['soma', '1', 'dend' + '/A', 'n', '# of A']],
-    )
-    rdes.buildModel()
-    #for i in range( 20 ):
-        #moose.setClock( i, 0.02 )
-    A = moose.vec( '/model/chem/dend/A' )
-    Z = moose.vec( '/model/chem/dend/Z' )
-    print moose.element( '/model/chem/dend/A/Adot' ).expr
-    print moose.element( '/model/chem/dend/B/Bdot' ).expr
-    print moose.element( '/model/chem/dend/Ca/CaStim' ).expr
-    phase = moose.vec( '/model/chem/dend/phase' )
-    ampl = moose.vec( '/model/chem/dend/ampl' )
-    vel = moose.vec( '/model/chem/dend/vel' )
-    vel.nInit = 1e-6 * seqDt
-    ampl.nInit = stimAmpl
-    stride = int( dist ) / numSpine
-    phase.nInit = 10000
-    Z.nInit = 0
-    for j in range( numSpine ):
-        k = blanks + j * stride
-        Z[k].nInit = 1
-        phase[k].nInit = preStim + seq[j] * seqDt
-    moose.reinit()
-    runtime = 50
-    snapshot = preStim + seqDt * (numSpine - 0.8)
-    print snapshot
-    #snapshot = 26
-    moose.start( snapshot )
-    avec = moose.vec( '/model/chem/dend/A' ).n
-    moose.start( runtime - snapshot )
-    tvec = []
-    for i in range( 5 ):
-        tab = moose.element( '/model/graphs/plot0[' + str( blanks + i * stride ) + ']' )
-        dt = tab.dt
-        tvec.append( tab.vector )
-    moose.delete( '/model' )
-    return dt, tvec, avec
-
-def makePassiveSoma( name, length, diameter ):
-    elecid = moose.Neuron( '/library/' + name )
-    dend = moose.Compartment( elecid.path + '/soma' )
-    dend.diameter = diameter
-    dend.length = length
-    dend.x = length
-    return elecid
-
-def plotOnePanel( tLabel, dt, tplot, numSyn, plotRange, tick ):
-    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
-    ax = plotBoilerplate( tLabel, 1 + start )
-    for i in range( 5 ):
-        plt.plot( t, tplot[i] )
-    ax.yaxis.set_ticks( np.arange( 0, plotRange, tick ) )
-
-
-def plotPanelCDEF( seq, row ):
-    makePassiveSoma( 'cell', 100e-6, 10e-6 )
-    start = (row -1) * 4
-    tLabel = chr( ord( 'A' ) + row - 1 )
-    xLabel = chr( ord( 'C' ) + row - 1 )
-    xplot = []
-    #dt, tplot, avec = runPanelCDEF( 'fhn', 15.0, 3.0, 5, seq, 0.4 )
-    dt, tplot, avec = runPanelCDEF( 'fhn', 5.0, 0.5, 5, seq, 0.4 )
-    xplot.append( avec )
-    #plotOnePanel( dt, 'B', tplot, 5, 1.5, 0.5 )
-    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
-    #ax = plotBoilerplate( tLabel, 1 + start )
-    ax = plotBoilerplate( tLabel, 1 + start, 'Time (s)')
-    for i in range( 5 ):
-        plt.plot( t, tplot[i] )
-    yl = ax.get_ylim()[1] 
-    ax.yaxis.set_ticks( np.arange( 0, 4.0001, 1.0 ) )
-
-    #dt, tplot, avec = runPanelCDEF( 'bis', 5.0, 4.0, 5, seq, 1.0 )
-    dt, tplot, avec = runPanelCDEF( 'bis', 15.0, 2.0, 5, seq, 1.0 )
-    xplot.append( avec )
-    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
-    ax = plotBoilerplate( tLabel, 2 + start, 'Time (s)' )
-    for i in range( 5 ):
-        plt.plot( t, tplot[i] )
-    yl = ax.get_ylim()[1] 
-    ax.yaxis.set_ticks( np.arange( 0, 3.0001, 1.0 ) )
-
-    dt, tplot, avec = runPanelCDEF( 'negFB', 5.0, 2.0, 5, seq, 1.0 )
-    xplot.append( avec )
-    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
-    ax = plotBoilerplate( tLabel, 3 + start, 'Time (s)')
-    for i in range( 5 ):
-        plt.plot( t, tplot[i] )
-    ax.yaxis.set_ticks( np.arange( 0, 10.00001, 5.0 ) )
-
-    dt, tplot, avec = runPanelCDEF( 'negFF', 5.0, 4.0, 5, seq, 1.0 )
-    xplot.append( avec )
-    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
-    ax = plotBoilerplate( tLabel, 4 + start, 'Time (s)')
-    for i in range( 5 ):
-        plt.plot( t, tplot[i] )
-    ax.yaxis.set_ticks( np.arange( 0, 5.00001, 2.0 ) )
-
-    for i in zip( range(4), (4.0, 3.0, 10, 4 ), (1, 1, 5, 2) ):
-        ax = plotBoilerplate( xLabel, 9 + start + i[0], 'Position( um)' )
-        plt.plot( xplot[i[0]][:50] )
-        ax.yaxis.set_ticks( np.arange( 0, i[1] * 1.0000001, i[2] ) )
-
-##################################################################
-if __name__ == '__main__':
-    moose.Neutral( '/library' )
-    moose.Neutral( '/model' )
-
-    t1 = time.time()
-    fig = plt.figure( figsize = (10,10), facecolor='white' )
-    fig.subplots_adjust( left = 0.18 )
-    plotPanelB()
-    plotPanelCDEF( [0,1,2,3,4], 3 )
-    plotPanelCDEF( [4,1,0,3,2], 4 )
-    print ("Time taken = ", time.time() - t1)
-    plt.tight_layout()
-        
-    plt.show()
-        
-        
+# Generates time-series response to a Ca pulse for each of the models. No
+# diffusion involved.
+
+import sys
+import numpy as np
+import pylab
+import matplotlib.pyplot as plt
+import moose
+import abstrModelEqns2
+import rdesigneur as rd
+import time
+
+
+def singleCompt( name, params ):
+    mod = moose.copy( '/library/' + name + '/' + name, '/model' )
+    A = moose.element( mod.path + '/A' )
+    Z = moose.element( mod.path + '/Z' )
+    Z.nInit = 1
+    Ca = moose.element( mod.path + '/Ca' )
+    CaStim = moose.element( Ca.path + '/CaStim' )
+    runtime = params['preStimTime'] + params['stimWidth'] + params['postStimTime'] 
+    steptime = 100
+
+    CaStim.expr += ' + x2 * (t > ' + str( runtime ) + ' ) * ( t < ' + str( runtime + steptime ) +  ' )'
+    print(CaStim.expr)
+    tab = moose.Table2( '/model/' + name + '/Atab' )
+    #for i in range( 10, 19 ):
+        #moose.setClock( i, 0.01 )
+    ampl = moose.element( mod.path + '/ampl' )
+    phase = moose.element( mod.path + '/phase' )
+    moose.connect( tab, 'requestOut', A, 'getN' )
+    ampl.nInit = params['stimAmplitude'] * 1
+    phase.nInit = params['preStimTime']
+
+    ksolve = moose.Ksolve( mod.path + '/ksolve' )
+    stoich = moose.Stoich( mod.path + '/stoich' )
+    stoich.compartment = mod
+    stoich.ksolve = ksolve
+    stoich.path = mod.path + '/##'
+    runtime += 2 * steptime
+
+    moose.reinit()
+    moose.start( runtime )
+    t = np.arange( 0, runtime + 1e-9, tab.dt )
+    return name, t, tab.vector
+    #pylab.plot( t, tab.vector, label='[A] (mM)' )
+    
+    #pylab.show()
+
+def plotBoilerplate( panelTitle, plotPos, xlabel = ''):
+    ax = plt.subplot( 8,4,plotPos )
+    #ax.xaxis.set_ticks( i[1] )
+    #ax.locator_params( 
+    ax.spines['top'].set_visible( False )
+    ax.spines['right'].set_visible( False )
+    ax.tick_params( direction = 'out' )
+    if (((plotPos -1)/4) % 2) == 0:
+        ax.set_xticklabels([])
+    else:
+        ax.set_xlabel( xlabel )
+    for tick in ax.xaxis.get_major_ticks():
+        tick.tick2On = False
+    for tick in ax.yaxis.get_major_ticks():
+        tick.tick2On = False
+    
+    if (plotPos % 4) == 1:
+        plt.ylabel( 'conc', fontsize = 16 )
+        # alternate way of doing this separately.
+        #plt.yaxis.label.size_size(16)
+        #plt.title( 'B' )
+        ax.text( -0.3, 1, panelTitle, fontsize = 18, weight = 'bold',
+        transform=ax.transAxes )
+    return ax
+
+def plotPanelB():
+    panelB = []
+    panelBticks = []
+    panelB.append( singleCompt( 'fhn', abstrModelEqns2.makeFHN() ) )
+    panelB.append( singleCompt( 'bis', abstrModelEqns2.makeBis() ) )
+    panelB.append( singleCompt( 'negFB', abstrModelEqns2.makeNegFB() ) )
+    panelB.append( singleCompt( 'negFF', abstrModelEqns2.makeNegFF() ) )
+
+    panelBticks.append( np.arange( 0, 4.00001, 1 ) )
+    panelBticks.append( np.arange( 0, 4.00001, 1 ) )
+    panelBticks.append( np.arange( 0, 15.00001, 5 ) )
+    panelBticks.append( np.arange( 0, 6.00001, 2 ) )
+    moose.delete( '/model' )
+
+    for i in zip( panelB, panelBticks, list(range( len( panelB ))) ):
+        plotPos = i[2] + 5
+        ax = plotBoilerplate( 'B', plotPos )
+        plt.plot( i[0][1], i[0][2] )
+        xmax = ax.get_xlim()[1]
+        #ax.xaxis.set_ticks( np.arange( 0, xmax, 50 ) )
+        ax.xaxis.set_ticks( np.arange( 0, 200.001, 50 ) )
+        ax.yaxis.set_ticks( i[1] )
+
+def runPanelCDEF( name, dist, seqDt, numSpine, seq, stimAmpl ):
+    preStim = 10.0
+    blanks = 20
+    rdes = rd.rdesigneur(
+        useGssa = False,
+        turnOffElec = True,
+        chemPlotDt = 0.1,
+        #diffusionLength = params['diffusionLength'],
+        diffusionLength = 1e-6,
+        cellProto = [['cell', 'soma']],
+        chemProto = [['dend', name]],
+        chemDistrib = [['dend', 'soma', 'install', '1' ]],
+        plotList = [['soma', '1', 'dend' + '/A', 'n', '# of A']],
+    )
+    rdes.buildModel()
+    #for i in range( 20 ):
+        #moose.setClock( i, 0.02 )
+    A = moose.vec( '/model/chem/dend/A' )
+    Z = moose.vec( '/model/chem/dend/Z' )
+    print(moose.element( '/model/chem/dend/A/Adot' ).expr)
+    print(moose.element( '/model/chem/dend/B/Bdot' ).expr)
+    print(moose.element( '/model/chem/dend/Ca/CaStim' ).expr)
+    phase = moose.vec( '/model/chem/dend/phase' )
+    ampl = moose.vec( '/model/chem/dend/ampl' )
+    vel = moose.vec( '/model/chem/dend/vel' )
+    vel.nInit = 1e-6 * seqDt
+    ampl.nInit = stimAmpl
+    stride = int( dist ) / numSpine
+    phase.nInit = 10000
+    Z.nInit = 0
+    for j in range( numSpine ):
+        k = blanks + j * stride
+        Z[k].nInit = 1
+        phase[k].nInit = preStim + seq[j] * seqDt
+    moose.reinit()
+    runtime = 50
+    snapshot = preStim + seqDt * (numSpine - 0.8)
+    print(snapshot)
+    #snapshot = 26
+    moose.start( snapshot )
+    avec = moose.vec( '/model/chem/dend/A' ).n
+    moose.start( runtime - snapshot )
+    tvec = []
+    for i in range( 5 ):
+        tab = moose.element( '/model/graphs/plot0[' + str( blanks + i * stride ) + ']' )
+        dt = tab.dt
+        tvec.append( tab.vector )
+    moose.delete( '/model' )
+    return dt, tvec, avec
+
+def makePassiveSoma( name, length, diameter ):
+    elecid = moose.Neuron( '/library/' + name )
+    dend = moose.Compartment( elecid.path + '/soma' )
+    dend.diameter = diameter
+    dend.length = length
+    dend.x = length
+    return elecid
+
+def plotOnePanel( tLabel, dt, tplot, numSyn, plotRange, tick ):
+    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
+    ax = plotBoilerplate( tLabel, 1 + start )
+    for i in range( 5 ):
+        plt.plot( t, tplot[i] )
+    ax.yaxis.set_ticks( np.arange( 0, plotRange, tick ) )
+
+
+def plotPanelCDEF( seq, row ):
+    makePassiveSoma( 'cell', 100e-6, 10e-6 )
+    start = (row -1) * 4
+    tLabel = chr( ord( 'A' ) + row - 1 )
+    xLabel = chr( ord( 'C' ) + row - 1 )
+    xplot = []
+    #dt, tplot, avec = runPanelCDEF( 'fhn', 15.0, 3.0, 5, seq, 0.4 )
+    dt, tplot, avec = runPanelCDEF( 'fhn', 5.0, 0.5, 5, seq, 0.4 )
+    xplot.append( avec )
+    #plotOnePanel( dt, 'B', tplot, 5, 1.5, 0.5 )
+    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
+    #ax = plotBoilerplate( tLabel, 1 + start )
+    ax = plotBoilerplate( tLabel, 1 + start, 'Time (s)')
+    for i in range( 5 ):
+        plt.plot( t, tplot[i] )
+    yl = ax.get_ylim()[1] 
+    ax.yaxis.set_ticks( np.arange( 0, 4.0001, 1.0 ) )
+
+    #dt, tplot, avec = runPanelCDEF( 'bis', 5.0, 4.0, 5, seq, 1.0 )
+    dt, tplot, avec = runPanelCDEF( 'bis', 15.0, 2.0, 5, seq, 1.0 )
+    xplot.append( avec )
+    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
+    ax = plotBoilerplate( tLabel, 2 + start, 'Time (s)' )
+    for i in range( 5 ):
+        plt.plot( t, tplot[i] )
+    yl = ax.get_ylim()[1] 
+    ax.yaxis.set_ticks( np.arange( 0, 3.0001, 1.0 ) )
+
+    dt, tplot, avec = runPanelCDEF( 'negFB', 5.0, 2.0, 5, seq, 1.0 )
+    xplot.append( avec )
+    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
+    ax = plotBoilerplate( tLabel, 3 + start, 'Time (s)')
+    for i in range( 5 ):
+        plt.plot( t, tplot[i] )
+    ax.yaxis.set_ticks( np.arange( 0, 10.00001, 5.0 ) )
+
+    dt, tplot, avec = runPanelCDEF( 'negFF', 5.0, 4.0, 5, seq, 1.0 )
+    xplot.append( avec )
+    t = np.arange( 0, len( tplot[0] ), 1.0 ) * dt
+    ax = plotBoilerplate( tLabel, 4 + start, 'Time (s)')
+    for i in range( 5 ):
+        plt.plot( t, tplot[i] )
+    ax.yaxis.set_ticks( np.arange( 0, 5.00001, 2.0 ) )
+
+    for i in zip( list(range(4)), (4.0, 3.0, 10, 4 ), (1, 1, 5, 2) ):
+        ax = plotBoilerplate( xLabel, 9 + start + i[0], 'Position( um)' )
+        plt.plot( xplot[i[0]][:50] )
+        ax.yaxis.set_ticks( np.arange( 0, i[1] * 1.0000001, i[2] ) )
+
+##################################################################
+if __name__ == '__main__':
+    moose.Neutral( '/library' )
+    moose.Neutral( '/model' )
+
+    t1 = time.time()
+    fig = plt.figure( figsize = (10,10), facecolor='white' )
+    fig.subplots_adjust( left = 0.18 )
+    plotPanelB()
+    plotPanelCDEF( [0,1,2,3,4], 3 )
+    plotPanelCDEF( [4,1,0,3,2], 4 )
+    print(("Time taken = ", time.time() - t1))
+    plt.tight_layout()
+        
+    plt.show()
+        
+        
diff --git a/parallelSolver/abstrModelEqns2.py b/parallelSolver/abstrModelEqns2.py
index 42ce9e51..16fb3e91 100644
--- a/parallelSolver/abstrModelEqns2.py
+++ b/parallelSolver/abstrModelEqns2.py
@@ -1,219 +1,219 @@
-import re
-import moose
-# Equations here are:
-# Adot = 1 -6A + 5A^2 - A^3, or spread out as:
-# Adot = k0a + k1a.A + k2a.A.A + k3a.A.A.A + k4a.Ca.A/(1+A+10*B) - k5a.A.B
-# Bdot = k1b.A - k2b.B
-#
-
-
-def parseExpr( expr, params, hasCa ):
-    if hasCa:
-        expr = expr.replace( 'Ca', 'x0' )
-        expr = expr.replace( 'A', 'x1' )
-        expr = expr.replace( 'B', 'x2' )
-    else:
-        expr = expr.replace( 'Ca', 'x0' ) # happens in the negFF model
-        expr = expr.replace( 'A', 'x0' ) # This is the usual case.
-        expr = expr.replace( 'B', 'x1' )
-
-    parts = re.split( 'k', expr )
-    ret = parts[0]
-    for i in parts[1:]:
-        ret += str( params[ 'k' + i[:2] ] )
-        ret += i[2:]
-
-    if hasCa:
-        return 'x3*( ' + ret + ')'
-    else:
-        return 'x2*( ' + ret + ')'
-
-def makeChemProto( name, Aexpr, Bexpr, params ):
-    sw = params['stimWidth']
-    diffLength = params['diffusionLength']
-    dca = params['diffConstA'] * diffLength * diffLength
-    dcb = params['diffConstB'] * diffLength * diffLength
-
-    # Objects
-    chem = moose.Neutral( '/library/' + name )
-    compt = moose.CubeMesh( '/library/' + name + '/' + name )
-    A = moose.Pool( compt.path + '/A' )
-    B = moose.Pool( compt.path + '/B' )
-    Z = moose.BufPool( compt.path + '/Z' )
-    Ca = moose.BufPool( compt.path + '/Ca' )
-    phase = moose.BufPool( compt.path + '/phase' )
-    vel = moose.BufPool( compt.path + '/vel' )
-    ampl = moose.BufPool( compt.path + '/ampl' )
-    Adot = moose.Function( A.path + '/Adot' )
-    Bdot = moose.Function( B.path + '/Bdot' )
-    CaStim = moose.Function( Ca.path + '/CaStim' )
-    A.diffConst = dca
-    B.diffConst = dcb
-
-    # Equations
-
-    Adot.expr = parseExpr( Aexpr, params, True )
-    Bdot.expr = parseExpr( Bexpr, params, False )
-    CaStim.expr = 'x2 * exp( -((x0 - t)^2)/(2* ' + str(sw*sw) + ') )'
-
-    print Adot.expr
-    print Bdot.expr
-    print CaStim.expr
-
-    # Connections
-    Adot.x.num = 4
-    moose.connect( Ca, 'nOut', Adot.x[0], 'input' )
-    moose.connect( A, 'nOut', Adot.x[1], 'input' )
-    moose.connect( B, 'nOut', Adot.x[2], 'input' )
-    moose.connect( Z, 'nOut', Adot.x[3], 'input' )
-    moose.connect( Adot, 'valueOut', A, 'increment' )
-
-    Bdot.x.num = 3
-    if name == 'negFF':
-        moose.connect( Ca, 'nOut', Bdot.x[0], 'input' )
-    else:
-        moose.connect( A, 'nOut', Bdot.x[0], 'input' )
-    moose.connect( B, 'nOut', Bdot.x[1], 'input' )
-    moose.connect( Z, 'nOut', Bdot.x[2], 'input' )
-    moose.connect( Bdot, 'valueOut', B, 'increment' )
-
-    CaStim.x.num = 3
-    moose.connect( phase, 'nOut', CaStim.x[0], 'input' )
-    moose.connect( vel, 'nOut', CaStim.x[1], 'input' )
-    moose.connect( ampl, 'nOut', CaStim.x[2], 'input' )
-    moose.connect( CaStim, 'valueOut', Ca, 'setN' )
-
-    return compt
-
-
-def makeBis():
-    params = {
-        'k0a':0.1,  # Constant
-        'k1a':-5.0,  # Coeff for A
-        'k2a':5.0,  # Coeff for A^2
-        'k3a':-1.0,  # Coeff for A^3
-        'k4a':10.0,  # turnon of A by A and Ca
-        'k5a':-5.0,  # Turnoff of A by B
-        'k1b':0.1,  # turnon of B by A
-        'k2b':-0.01,   # Decay rate of B
-        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
-        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
-        'dendLength': 100e-6,   # Length of section of dendrite in model
-        'diffConstA':1.0,       # Diffusion constant of A
-        'diffConstB':1.0,       # Diffusion constant of B
-        'stimWidth' :5.0,        # Stimulus width in seconds
-        'stimAmplitude':1.0,    # Stimulus amplitude, arb units. From FHN review
-        'blankVoxelsAtEnd':10,  # of voxels to leave blank at end of cylinder
-        'preStimTime':40.0,     # Time to run before turning on stimulus.
-        'postStimTime':80.0,    # Time to run after stimulus. ~3x decay time
-        'settleTime':20.0,    # Settling time of response, after stimulus. 
-                              # To include in analysis of total response over 
-                              # entire dendrite.
-        'fnumber':1,          # Number to append to fname
-    }
-
-    makeChemProto( 'bis', 
-        'k0a + k1a*A + k2a*A*A + k3a*A*A*A + k4a*Ca*A/(1+A+10*B) + k5a*A*B',
-        'k1b*A*A + k2b*B',
-        params )
-    return params
-
-def makeFHN():
-    params = {
-        'k_t':2.5,  # Time-const.
-        'k_a':0.7,  # Coeff1
-        'k_b':0.8,  # Coeff2
-        'kxa': 2.0, # Offset for V for FHN eqns.
-        'kxb': 0.8, # Offset for W for FHN eqns.
-        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
-        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
-        'dendLength': 100e-6,   # Length of section of dendrite in model
-        'diffConstA':7.5,      # Diffusion constant of A
-        'diffConstB':5.0,       # Diffusion constant of B
-        'stimWidth' :1.0,        # Stimulus width in seconds
-        'stimAmplitude':0.4,    # Stimulus amplitude, arb units. From FHN review
-        'blankVoxelsAtEnd':10,  # of voxels to leave blank at end of cylinder
-        'preStimTime':30.0,     # Time to run before turning on stimulus.
-        'postStimTime':40.0,    # Time to run after stimulus. ~3x decay time
-        'settleTime':20.0,    # Settling time of response, after stimulus. 
-                              # To include in analysis of total response over 
-                              # entire dendrite.
-        'fnumber': 1,         # Number to append to fname
-    }
-    makeChemProto( 'fhn', 
-        '5.0*(A - kxa - (A-kxa)^3/3 - (B-kxb) + Ca)',
-        '(A-kxa + k_a - k_b*(B-kxb))/k_t',
-        params )
-    return params
-
-
-def makeNegFB():
-    params = {
-        'k1a':-0.1,  # Coeff for decay of A, slow.
-        'k2a':-0.2,  # Coeff for turnoff of A by B, medium.
-        'k3a':10.0,  # turnon of A by Ca, fast.
-        'k1b':0.2,  # turnon of B by A, medium
-        'k2b':-0.1,   # Decay rate of B, slow
-        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
-        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
-        'dendLength': 100e-6,   # Length of section of dendrite in model
-        'diffConstA':0.5,      # Diffusion constant of A
-        'diffConstB':1.0,       # Diffusion constant of B
-        'stimWidth' :1.0,        # Stimulus width in seconds
-        'stimAmplitude':1.0,    # Stimulus amplitude, arb units. From FHN review
-        'blankVoxelsAtEnd':10,  #of voxels to leave blank at end of cylinder
-        'preStimTime':10.0,     # Time to run before turning on stimulus.
-        'postStimTime':60.0,    # Time to run after stimulus. ~3x decay time
-        'settleTime':20.0,    # Settling time of response, after stimulus. 
-                              # To include in analysis of total response over 
-                              # entire dendrite.
-        'fnumber':1,          # Number to append to fname
-    }
-    makeChemProto( 'negFB', 
-        'k1a*A + k2a*A*B + k3a*Ca',
-        'k1b*A + k2b*B',
-        params )
-    return params
-
-
-def makeNegFF():
-    params = {
-        'k1a':-0.1,  # Coeff for decay of A, slow.
-        'k2a':-1.0,  # Coeff for turnoff of A by B, medium.
-        'k3a':10.0,  # turnon of A by Ca, fast.
-        'k1b':2.0,  # turnon of B by Ca, medium
-        'k2b':-0.1,   # Decay rate of B, slow
-        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
-        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
-        'dendLength': 100e-6,   # Length of section of dendrite in model
-        'diffConstA':1.0,      # Diffusion constant of A
-        'diffConstB':2.0,       # Diffusion constant of B
-        'stimWidth' :1.0,        # Stimulus width in seconds
-        'stimAmplitude':1.0,    # Stimulus amplitude, arb units. From FHN review
-        'blankVoxelsAtEnd':10,  # of voxels to leave blank at end of cylinder
-        'preStimTime':10.0,     # Time to run before turning on stimulus.
-        'postStimTime':60.0,    # Time to run after stimulus. ~3x decay time
-        'settleTime':20.0,    # Settling time of response, after stimulus. 
-                              # To include in analysis of total response over 
-                              # entire dendrite.
-        'fnumber':1,          # Number to append to fname
-    }
-    makeChemProto( 'negFF', 
-        'k1a*A + k2a*A*B + k3a*Ca',
-        'k1b*Ca + k2b*B',
-        params )
-
-    return params
-
-if __name__ == '__main__':
-    moose.Neutral( '/library' )
-    print "Making Bistable model"
-    makeBis()
-    print "Making FHN model"
-    makeFHN()
-    print "Making Negative Feedback model"
-    makeNegFB()
-    print "Making Negative Feedforward model"
-    makeNegFF()
-
-
+import re
+import moose
+# Equations here are:
+# Adot = 1 -6A + 5A^2 - A^3, or spread out as:
+# Adot = k0a + k1a.A + k2a.A.A + k3a.A.A.A + k4a.Ca.A/(1+A+10*B) - k5a.A.B
+# Bdot = k1b.A - k2b.B
+#
+
+
+def parseExpr( expr, params, hasCa ):
+    if hasCa:
+        expr = expr.replace( 'Ca', 'x0' )
+        expr = expr.replace( 'A', 'x1' )
+        expr = expr.replace( 'B', 'x2' )
+    else:
+        expr = expr.replace( 'Ca', 'x0' ) # happens in the negFF model
+        expr = expr.replace( 'A', 'x0' ) # This is the usual case.
+        expr = expr.replace( 'B', 'x1' )
+
+    parts = re.split( 'k', expr )
+    ret = parts[0]
+    for i in parts[1:]:
+        ret += str( params[ 'k' + i[:2] ] )
+        ret += i[2:]
+
+    if hasCa:
+        return 'x3*( ' + ret + ')'
+    else:
+        return 'x2*( ' + ret + ')'
+
+def makeChemProto( name, Aexpr, Bexpr, params ):
+    sw = params['stimWidth']
+    diffLength = params['diffusionLength']
+    dca = params['diffConstA'] * diffLength * diffLength
+    dcb = params['diffConstB'] * diffLength * diffLength
+
+    # Objects
+    chem = moose.Neutral( '/library/' + name )
+    compt = moose.CubeMesh( '/library/' + name + '/' + name )
+    A = moose.Pool( compt.path + '/A' )
+    B = moose.Pool( compt.path + '/B' )
+    Z = moose.BufPool( compt.path + '/Z' )
+    Ca = moose.BufPool( compt.path + '/Ca' )
+    phase = moose.BufPool( compt.path + '/phase' )
+    vel = moose.BufPool( compt.path + '/vel' )
+    ampl = moose.BufPool( compt.path + '/ampl' )
+    Adot = moose.Function( A.path + '/Adot' )
+    Bdot = moose.Function( B.path + '/Bdot' )
+    CaStim = moose.Function( Ca.path + '/CaStim' )
+    A.diffConst = dca
+    B.diffConst = dcb
+
+    # Equations
+
+    Adot.expr = parseExpr( Aexpr, params, True )
+    Bdot.expr = parseExpr( Bexpr, params, False )
+    CaStim.expr = 'x2 * exp( -((x0 - t)^2)/(2* ' + str(sw*sw) + ') )'
+
+    print(Adot.expr)
+    print(Bdot.expr)
+    print(CaStim.expr)
+
+    # Connections
+    Adot.x.num = 4
+    moose.connect( Ca, 'nOut', Adot.x[0], 'input' )
+    moose.connect( A, 'nOut', Adot.x[1], 'input' )
+    moose.connect( B, 'nOut', Adot.x[2], 'input' )
+    moose.connect( Z, 'nOut', Adot.x[3], 'input' )
+    moose.connect( Adot, 'valueOut', A, 'increment' )
+
+    Bdot.x.num = 3
+    if name == 'negFF':
+        moose.connect( Ca, 'nOut', Bdot.x[0], 'input' )
+    else:
+        moose.connect( A, 'nOut', Bdot.x[0], 'input' )
+    moose.connect( B, 'nOut', Bdot.x[1], 'input' )
+    moose.connect( Z, 'nOut', Bdot.x[2], 'input' )
+    moose.connect( Bdot, 'valueOut', B, 'increment' )
+
+    CaStim.x.num = 3
+    moose.connect( phase, 'nOut', CaStim.x[0], 'input' )
+    moose.connect( vel, 'nOut', CaStim.x[1], 'input' )
+    moose.connect( ampl, 'nOut', CaStim.x[2], 'input' )
+    moose.connect( CaStim, 'valueOut', Ca, 'setN' )
+
+    return compt
+
+
+def makeBis():
+    params = {
+        'k0a':0.1,  # Constant
+        'k1a':-5.0,  # Coeff for A
+        'k2a':5.0,  # Coeff for A^2
+        'k3a':-1.0,  # Coeff for A^3
+        'k4a':10.0,  # turnon of A by A and Ca
+        'k5a':-5.0,  # Turnoff of A by B
+        'k1b':0.1,  # turnon of B by A
+        'k2b':-0.01,   # Decay rate of B
+        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
+        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
+        'dendLength': 100e-6,   # Length of section of dendrite in model
+        'diffConstA':1.0,       # Diffusion constant of A
+        'diffConstB':1.0,       # Diffusion constant of B
+        'stimWidth' :5.0,        # Stimulus width in seconds
+        'stimAmplitude':1.0,    # Stimulus amplitude, arb units. From FHN review
+        'blankVoxelsAtEnd':10,  # of voxels to leave blank at end of cylinder
+        'preStimTime':40.0,     # Time to run before turning on stimulus.
+        'postStimTime':80.0,    # Time to run after stimulus. ~3x decay time
+        'settleTime':20.0,    # Settling time of response, after stimulus. 
+                              # To include in analysis of total response over 
+                              # entire dendrite.
+        'fnumber':1,          # Number to append to fname
+    }
+
+    makeChemProto( 'bis', 
+        'k0a + k1a*A + k2a*A*A + k3a*A*A*A + k4a*Ca*A/(1+A+10*B) + k5a*A*B',
+        'k1b*A*A + k2b*B',
+        params )
+    return params
+
+def makeFHN():
+    params = {
+        'k_t':2.5,  # Time-const.
+        'k_a':0.7,  # Coeff1
+        'k_b':0.8,  # Coeff2
+        'kxa': 2.0, # Offset for V for FHN eqns.
+        'kxb': 0.8, # Offset for W for FHN eqns.
+        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
+        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
+        'dendLength': 100e-6,   # Length of section of dendrite in model
+        'diffConstA':7.5,      # Diffusion constant of A
+        'diffConstB':5.0,       # Diffusion constant of B
+        'stimWidth' :1.0,        # Stimulus width in seconds
+        'stimAmplitude':0.4,    # Stimulus amplitude, arb units. From FHN review
+        'blankVoxelsAtEnd':10,  # of voxels to leave blank at end of cylinder
+        'preStimTime':30.0,     # Time to run before turning on stimulus.
+        'postStimTime':40.0,    # Time to run after stimulus. ~3x decay time
+        'settleTime':20.0,    # Settling time of response, after stimulus. 
+                              # To include in analysis of total response over 
+                              # entire dendrite.
+        'fnumber': 1,         # Number to append to fname
+    }
+    makeChemProto( 'fhn', 
+        '5.0*(A - kxa - (A-kxa)^3/3 - (B-kxb) + Ca)',
+        '(A-kxa + k_a - k_b*(B-kxb))/k_t',
+        params )
+    return params
+
+
+def makeNegFB():
+    params = {
+        'k1a':-0.1,  # Coeff for decay of A, slow.
+        'k2a':-0.2,  # Coeff for turnoff of A by B, medium.
+        'k3a':10.0,  # turnon of A by Ca, fast.
+        'k1b':0.2,  # turnon of B by A, medium
+        'k2b':-0.1,   # Decay rate of B, slow
+        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
+        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
+        'dendLength': 100e-6,   # Length of section of dendrite in model
+        'diffConstA':0.5,      # Diffusion constant of A
+        'diffConstB':1.0,       # Diffusion constant of B
+        'stimWidth' :1.0,        # Stimulus width in seconds
+        'stimAmplitude':1.0,    # Stimulus amplitude, arb units. From FHN review
+        'blankVoxelsAtEnd':10,  #of voxels to leave blank at end of cylinder
+        'preStimTime':10.0,     # Time to run before turning on stimulus.
+        'postStimTime':60.0,    # Time to run after stimulus. ~3x decay time
+        'settleTime':20.0,    # Settling time of response, after stimulus. 
+                              # To include in analysis of total response over 
+                              # entire dendrite.
+        'fnumber':1,          # Number to append to fname
+    }
+    makeChemProto( 'negFB', 
+        'k1a*A + k2a*A*B + k3a*Ca',
+        'k1b*A + k2b*B',
+        params )
+    return params
+
+
+def makeNegFF():
+    params = {
+        'k1a':-0.1,  # Coeff for decay of A, slow.
+        'k2a':-1.0,  # Coeff for turnoff of A by B, medium.
+        'k3a':10.0,  # turnon of A by Ca, fast.
+        'k1b':2.0,  # turnon of B by Ca, medium
+        'k2b':-0.1,   # Decay rate of B, slow
+        'diffusionLength':1.0e-6,  # Diffusion characteristic length, used as voxel length too.
+        'dendDiameter': 10e-6,  # Diameter of section of dendrite in model
+        'dendLength': 100e-6,   # Length of section of dendrite in model
+        'diffConstA':1.0,      # Diffusion constant of A
+        'diffConstB':2.0,       # Diffusion constant of B
+        'stimWidth' :1.0,        # Stimulus width in seconds
+        'stimAmplitude':1.0,    # Stimulus amplitude, arb units. From FHN review
+        'blankVoxelsAtEnd':10,  # of voxels to leave blank at end of cylinder
+        'preStimTime':10.0,     # Time to run before turning on stimulus.
+        'postStimTime':60.0,    # Time to run after stimulus. ~3x decay time
+        'settleTime':20.0,    # Settling time of response, after stimulus. 
+                              # To include in analysis of total response over 
+                              # entire dendrite.
+        'fnumber':1,          # Number to append to fname
+    }
+    makeChemProto( 'negFF', 
+        'k1a*A + k2a*A*B + k3a*Ca',
+        'k1b*Ca + k2b*B',
+        params )
+
+    return params
+
+if __name__ == '__main__':
+    moose.Neutral( '/library' )
+    print("Making Bistable model")
+    makeBis()
+    print("Making FHN model")
+    makeFHN()
+    print("Making Negative Feedback model")
+    makeNegFB()
+    print("Making Negative Feedforward model")
+    makeNegFF()
+
+
diff --git a/rall_1964/rall64.py b/rall_1964/rall64.py
index 7b016ad8..5dff8a17 100755
--- a/rall_1964/rall64.py
+++ b/rall_1964/rall64.py
@@ -44,11 +44,17 @@
 # 
 
 # Code:
-"""Implementation of Rall 1964 model of dendritic branching. All units
-SI."""
 
-import sys
 
+
+"""
+Implementation of Rall 1964 model of dendritic branching. All units
+SI.
+
+"""
+from __future__ import print_function
+
+import sys
 import math
 import pylab
 import moose
@@ -73,7 +79,7 @@ Ra = RA * length / (math.pi * diameter * diameter / 4.0)
 
 Ek = Em + 1e-3
 
-print 'tau =', tau, 'lambda =', lambda_
+print('tau =', tau, 'lambda =', lambda_)
 
 # Rall used `0.05 * tau`, but that does not reproduce in our
 # case. Why? Sym vs Asym comp??
@@ -176,7 +182,7 @@ def run_model_fig6():
     """Do a simulation for fig6 and plot data."""
     for ch in moose.wildcardFind('/model/##[ISA=ChanBase]'):
         ch.Gk = 1.0/Rm
-    print 'Starting for', inject_time
+    print('Starting for', inject_time)
     moose.start(inject_time)
     for ch in moose.wildcardFind('/model/##[ISA=ChanBase]'):
         ch.Gk = 0.0
@@ -235,8 +241,8 @@ def run_model_fig7(chans_1, chans_2, chans_3):
     to_run = simtime
     delta_t = 0.25 * tau
     for ii in range(0, len(chans_1), 2):
-        print ii
-        print '-----------------'
+        print(ii)
+        print('-----------------')
         chans_1[ii].Gk = 1 / Rm
         chans_1[ii+1].Gk = 1 / Rm
         chans_2[-ii-1].Gk = 1 / Rm
@@ -245,11 +251,11 @@ def run_model_fig7(chans_1, chans_2, chans_3):
             chan.Gk = 0.25 / Rm
         
         for chan in chans_1:
-            print chan.Gk,
-        print
+            print(chan.Gk, end=' ')
+        print()
         for chan in chans_2:
-            print chan.Gk,
-        print
+            print(chan.Gk, end=' ')
+        print()
         moose.start(delta_t)
         for chan in chans_1:
             chan.Gk = 0.0
diff --git a/rall_1964/rall64_graphic.py b/rall_1964/rall64_graphic.py
index a8b9d178..f5dc7dcd 100755
--- a/rall_1964/rall64_graphic.py
+++ b/rall_1964/rall64_graphic.py
@@ -133,7 +133,7 @@ ax_data.set_xlim(0, simtime/tau)
 ax_data.set_ylim(0, 0.15)
 ax_data.set_xlabel('Time (t/tau)')
 ax_data.set_ylabel('Membrane voltage  (Vm - Em)/(Ek - Vm)')
-print lines
+print(lines)
 plt.legend()
 schedule()
 fanim = anim.FuncAnimation(fig, update, fargs=None, interval=25, repeat=False)
diff --git a/snippets/GraupnerBrunel2012_STDPfromCaPlasticity.py b/snippets/GraupnerBrunel2012_STDPfromCaPlasticity.py
index c26b623e..257add48 100644
--- a/snippets/GraupnerBrunel2012_STDPfromCaPlasticity.py
+++ b/snippets/GraupnerBrunel2012_STDPfromCaPlasticity.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -208,7 +208,7 @@ t_extent = 100e-3       # s  # STDP kernel extent,
                         # t_extent > t_between_pairs/2 inverts pre-post pairing!
 # dt = tpost - tpre
 # negative dt corresponds to post before pre
-print '-----------------------------------------------'
+print('-----------------------------------------------')
 for deltat in arange(t_extent,0.0,-ddt):
     reset_settle()
     for i in range(numpairs):
@@ -220,9 +220,9 @@ for deltat in arange(t_extent,0.0,-ddt):
         moose.start(t_between_pairs)  # weight changes after pre-spike+delayD
                                       # must run for at least delayD after pre-spike
     dw = ( syn.synapse[0].weight - weight ) / weight
-    print 'post before pre, dt = %1.3f s, dw/w = %1.3f'%(-deltat,dw)
+    print(('post before pre, dt = %1.3f s, dw/w = %1.3f'%(-deltat,dw)))
     dwlist_neg.append(dw)
-print '-----------------------------------------------'
+print('-----------------------------------------------')
 # positive dt corresponds to pre before post
 dwlist_pos = []
 for deltat in arange(ddt,t_extent+ddt,ddt):
@@ -235,24 +235,24 @@ for deltat in arange(ddt,t_extent+ddt,ddt):
         make_neuron_spike(1)
         moose.start(t_between_pairs)
     dw = ( syn.synapse[0].weight - weight ) / weight
-    print 'pre before post, dt = %1.3f s, dw/w = %1.3f'%(deltat,dw)
+    print(('pre before post, dt = %1.3f s, dw/w = %1.3f'%(deltat,dw)))
     dwlist_pos.append(dw)
-print '-----------------------------------------------'
-print 'Each of the above pre-post pairs was repeated',\
-        numpairs,'times, with',t_between_pairs,'s between pairs.'
-print 
-print 'Due to event based updates, Ca decays suddenly at events:'
-print 'pre-spike, pre-spike + delayD, and post-spike;'
-print 'apart from the usual CaPre and CaPost jumps at'
-print 'pre-spike + delayD and post-spike respectively.'
-print 'Because of the event based update, multiple pre-post pairs are used.'
-print 
-print 'If you reduce the t_between_pairs,'
-print ' you\'ll see potentiation for the LTD part without using any triplet rule!'
-print
-print "If you turn on noise, the weights fluctuate too much,"
-print " not sure if there's a bug in my noise implementation."
-print '-----------------------------------------------'
+print('-----------------------------------------------')
+print(('Each of the above pre-post pairs was repeated',\
+        numpairs,'times, with',t_between_pairs,'s between pairs.'))
+print() 
+print('Due to event based updates, Ca decays suddenly at events:')
+print('pre-spike, pre-spike + delayD, and post-spike;')
+print('apart from the usual CaPre and CaPost jumps at')
+print('pre-spike + delayD and post-spike respectively.')
+print('Because of the event based update, multiple pre-post pairs are used.')
+print() 
+print('If you reduce the t_between_pairs,')
+print(' you\'ll see potentiation for the LTD part without using any triplet rule!')
+print()
+print("If you turn on noise, the weights fluctuate too much,")
+print(" not sure if there's a bug in my noise implementation.")
+print('-----------------------------------------------')
 
 # ###########################################
 # Plot the simulated Vm-s and STDP curve
diff --git a/snippets/HigginsGraupnerBrunel2014_LifetimeCaPlasticity.py b/snippets/HigginsGraupnerBrunel2014_LifetimeCaPlasticity.py
index 04800616..1d3ddff2 100644
--- a/snippets/HigginsGraupnerBrunel2014_LifetimeCaPlasticity.py
+++ b/snippets/HigginsGraupnerBrunel2014_LifetimeCaPlasticity.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -126,18 +126,18 @@ moose.seed(100)
 moose.reinit()
 
 # function to make the aPlus and aMinus settle to equilibrium values
-print "Rates of pre- and post-syanptic neurons =",frate
+print(("Rates of pre- and post-syanptic neurons =",frate))
 WtSeries = []
 numsteps = int(runtime/dt)
 for i in range(numrepeats):
     syn.synapse[0].weight = 1.0 # starting weight to decay from
     syn.Ca = 0.0
-    print "Repeat number",i,"running..."
+    print(("Repeat number",i,"running..."))
     moose.start(runtime)
     WtSeries.append(WtTable.vector[i*numsteps:(i+1)*numsteps])
 WtSeries = array(WtSeries)
 WtMean = mean(WtSeries,axis=0)
-print "plotting..."
+print("plotting...")
 
 # ###########################################
 # Plot the simulated weights and Ca vs time
diff --git a/snippets/HsolveInstability.py b/snippets/HsolveInstability.py
index 61ac1df2..467bd7ee 100644
--- a/snippets/HsolveInstability.py
+++ b/snippets/HsolveInstability.py
@@ -187,7 +187,7 @@ def create_spine( parentCompt, parentObj, index, frac, length, dia, theta ):
     return head
 
 def create_spine_with_receptor( compt, cell, index, frac ):
-    FaradayConst = 96485.3415			# s A / mol
+    FaradayConst = 96485.3415                        # s A / mol
     spineLength = 5.0e-6
     spineDia = 4.0e-6
     head = create_spine( compt, cell, index, frac, spineLength, spineDia, 0.0 )
@@ -199,10 +199,10 @@ def create_spine_with_receptor( compt, cell, index, frac ):
     moose.connect( head, 'channel', gluR, 'channel', 'single' )
 
     caPool = moose.CaConc( head.path + '/ca' )
-    caPool.CaBasal = 1e-4 		# 0.1 micromolar
+    caPool.CaBasal = 1e-4                 # 0.1 micromolar
     caPool.tau = 0.01
     B = 1.0 / ( FaradayConst * spineLength * spineDia * spineDia *math.pi/4)
-    B = B / 20.0 				# scaling factor for Ca buffering
+    B = B / 20.0                                 # scaling factor for Ca buffering
     caPool.B = B
     moose.connect( gluR, 'IkOut', caPool, 'current', 'single' )
 
@@ -227,7 +227,7 @@ def display_plots( name ):
     pylab.figure()
     for x in moose.wildcardFind( '/graphs/#' ):
         pos = numpy.arange( 0, x.vector.size ) * x.dt
-        print len( pos ), len( x.vector )
+        print((len( pos ), len( x.vector )))
         pylab.plot( pos, x.vector, label=x.name )
     pylab.legend()
     pylab.title( name )
diff --git a/snippets/IntegrateFireZoo.py b/snippets/IntegrateFireZoo.py
index 3d138452..be885456 100644
--- a/snippets/IntegrateFireZoo.py
+++ b/snippets/IntegrateFireZoo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # -*- coding: utf-8 -*-
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
@@ -119,9 +119,9 @@ def main():
     #### CHOOSE ONE OF THE NEURON KEYS AS choiceKey FROM BELOW DICTIONARY ####
     #choiceKey = 'LIF'
     #### No need, am inputting it from the user on the terminal
-    choiceKeys = neuronChoices.keys() # keys() does not retain the order in dict defn above!
-    choiceIndex = input('Choose a number corresponding to your desired neuron: '+ \
-                        str([(i,key) for (i,key) in enumerate(choiceKeys)])+' -- ')
+    choiceKeys = list(neuronChoices.keys()) # keys() does not retain the order in dict defn above!
+    choiceIndex = eval(input('Choose a number corresponding to your desired neuron: '+ \
+                        str([(i,key) for (i,key) in enumerate(choiceKeys)])+' -- '))
     choiceKey = choiceKeys[choiceIndex]
     neuronChoice = neuronChoices[choiceKey]
 
@@ -171,7 +171,7 @@ def main():
         network.vec.vPeak = vPeak           # reset at vPeak, not at thresh
         network.vec.inject = 5e-9  # Amp    # injected current I
 
-    print "Injecting current =",network.vec[0].inject,"in",choiceKey,"neuron."
+    print(("Injecting current =",network.vec[0].inject,"in",choiceKey,"neuron."))
 
     # ###########################################
     # Setting up table
diff --git a/snippets/MULTI/TuringInNeuron.py b/snippets/MULTI/TuringInNeuron.py
index 1f38df81..7f1c7a1e 100644
--- a/snippets/MULTI/TuringInNeuron.py
+++ b/snippets/MULTI/TuringInNeuron.py
@@ -19,185 +19,183 @@ import moose
 import proto18
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	model = moose.element( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    model = moose.element( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
+    return cellId
 
 def makeChemModel( cellId ):
-		# create container for model
-		r0 = 1e-6	# m
-		r1 = 1e-6	# m
-		num = 2800
-		diffLength = 1e-6 # m
-		diffConst = 5e-12 # m^2/sec
-		motorRate = 1e-6 # m/sec
-		concA = 1 # millimolar
-
-		model = moose.element( '/model' )
-		compartment = moose.NeuroMesh( '/model/compartment' )
-                # FIXME: No attribute cell
-                compartment.cell =  cellId
-		compartment.diffLength = diffLength
-                print "cell NeuroMesh parameters: numSeg and numDiffCompt: ", compartment.numSegments, compartment.numDiffCompts
-		
-                print "compartment.numDiffCompts == num: ", compartment.numDiffCompts, num
-		assert( compartment.numDiffCompts == num )
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		s = moose.Pool( '/model/compartment/s' )
-                e1 = moose.MMenz( '/model/compartment/e1' )
-                e2 = moose.MMenz( '/model/compartment/e2' )
-                e3 = moose.MMenz( '/model/compartment/e3' )
-                r1 = moose.Reac( '/model/compartment/r1' )
-                moose.connect( e1, 'sub', s, 'reac' )
-                moose.connect( e1, 'prd', a, 'reac' )
-                moose.connect( a, 'nOut', e1, 'enzDest' )
-                e1.Km = 1
-                e1.kcat = 1
-
-                moose.connect( e2, 'sub', s, 'reac' )
-                moose.connect( e2, 'prd', b, 'reac' )
-                moose.connect( a, 'nOut', e2, 'enzDest' )
-                e2.Km = 1
-                e2.kcat = 0.5
-
-                moose.connect( e3, 'sub', a, 'reac' )
-                moose.connect( e3, 'prd', s, 'reac' )
-                moose.connect( b, 'nOut', e3, 'enzDest' )
-                e3.Km = 0.1
-                e3.kcat = 1
-
-                moose.connect( r1, 'sub', b, 'reac' )
-                moose.connect( r1, 'prd', s, 'reac' )
-                r1.Kf = 0.3 # 1/sec
-                r1.Kb = 0 # 1/sec
-
-		# Assign parameters
-		a.diffConst = diffConst/10
-		b.diffConst = diffConst
-		s.diffConst = 0
+        # create container for model
+        r0 = 1e-6    # m
+        r1 = 1e-6    # m
+        num = 2800
+        diffLength = 1e-6 # m
+        diffConst = 5e-12 # m^2/sec
+        motorRate = 1e-6 # m/sec
+        concA = 1 # millimolar
+
+        model = moose.element( '/model' )
+        compartment = moose.NeuroMesh( '/model/compartment' )
+        # FIXME: No attribute cell
+        compartment.cell =  cellId
+        compartment.diffLength = diffLength
+        print(("cell NeuroMesh parameters: numSeg and numDiffCompt: ", compartment.numSegments, compartment.numDiffCompts))
+        
+        print(("compartment.numDiffCompts == num: ", compartment.numDiffCompts, num))
+        assert( compartment.numDiffCompts == num )
+
+        # create molecules and reactions
+        a = moose.Pool( '/model/compartment/a' )
+        b = moose.Pool( '/model/compartment/b' )
+        s = moose.Pool( '/model/compartment/s' )
+        e1 = moose.MMenz( '/model/compartment/e1' )
+        e2 = moose.MMenz( '/model/compartment/e2' )
+        e3 = moose.MMenz( '/model/compartment/e3' )
+        r1 = moose.Reac( '/model/compartment/r1' )
+        moose.connect( e1, 'sub', s, 'reac' )
+        moose.connect( e1, 'prd', a, 'reac' )
+        moose.connect( a, 'nOut', e1, 'enzDest' )
+        e1.Km = 1
+        e1.kcat = 1
+
+        moose.connect( e2, 'sub', s, 'reac' )
+        moose.connect( e2, 'prd', b, 'reac' )
+        moose.connect( a, 'nOut', e2, 'enzDest' )
+        e2.Km = 1
+        e2.kcat = 0.5
+
+        moose.connect( e3, 'sub', a, 'reac' )
+        moose.connect( e3, 'prd', s, 'reac' )
+        moose.connect( b, 'nOut', e3, 'enzDest' )
+        e3.Km = 0.1
+        e3.kcat = 1
+
+        moose.connect( r1, 'sub', b, 'reac' )
+        moose.connect( r1, 'prd', s, 'reac' )
+        r1.Kf = 0.3 # 1/sec
+        r1.Kb = 0 # 1/sec
+
+        # Assign parameters
+        a.diffConst = diffConst/10
+        b.diffConst = diffConst
+        s.diffConst = 0
                 #b.motorConst = motorRate
 
-		# Make solvers
-		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
-		dsolve = moose.Dsolve( '/model/compartment/dsolve' )
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = compartment
-		#ksolve.numAllVoxels = compartment.numDiffCompts
-		stoich.ksolve = ksolve
-		stoich.dsolve = dsolve
-		stoich.path = "/model/compartment/##"
-                assert( dsolve.numPools == 3 )
-		a.vec.concInit = [0.1]*num
-                a.vec[0].concInit += 0.5
-                a.vec[400].concInit += 0.5
-                a.vec[800].concInit += 0.5
-                a.vec[1200].concInit += 0.5
-                a.vec[1600].concInit += 0.5
-                a.vec[2000].concInit += 0.5
-                a.vec[2400].concInit += 0.5
-                #a.vec[num/2].concInit -= 0.1
-		b.vec.concInit = [0.1]*num
-		s.vec.concInit = [1]*num
+        # Make solvers
+        ksolve = moose.Ksolve( '/model/compartment/ksolve' )
+        dsolve = moose.Dsolve( '/model/compartment/dsolve' )
+        stoich = moose.Stoich( '/model/compartment/stoich' )
+        stoich.compartment = compartment
+        #ksolve.numAllVoxels = compartment.numDiffCompts
+        stoich.ksolve = ksolve
+        stoich.dsolve = dsolve
+        stoich.path = "/model/compartment/##"
+        assert( dsolve.numPools == 3 )
+        a.vec.concInit = [0.1]*num
+        a.vec[0].concInit += 0.5
+        a.vec[400].concInit += 0.5
+        a.vec[800].concInit += 0.5
+        a.vec[1200].concInit += 0.5
+        a.vec[1600].concInit += 0.5
+        a.vec[2000].concInit += 0.5
+        a.vec[2400].concInit += 0.5
+        #a.vec[num/2].concInit -= 0.1
+        b.vec.concInit = [0.1]*num
+        s.vec.concInit = [1]*num
 
 def displayPlots( num ):
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
-                print '/newplot\n/plotname a' + str(num)
-                for x in a.vec.conc:
-                    print x
-                print '/newplot\n/plotname b' + str(num)
-                for y in b.vec.conc:
-                    print y
-                """
-                print '/newplot\n/plotname bvol'
-                for z in a.vec.volume:
-                    print z * 1e18
-                print '/newplot\n/plotname aInit'
-                for x in a.vec.concInit:
-                    print x
-                pos = numpy.arange( 0, a.vec.conc.size, 1.0 )
-                aconc = numpy.array( a.vec.conc )
-                bconc = numpy.array( b.vec.conc )
-                print "pos a, b = ", pos, b.vec.conc.size
-                pylab.plot( pos[:100], aconc[:100], label='a' )
-                pylab.plot( pos[:100], bconc[:100], label='b' )
-                #pylab.plot( pos, a.vec.conc, label='a' )
-                #pylab.plot( pos, b.vec.conc, label='b' )
-                print "plotting done"
-                pylab.legend()
-                print "legend done"
-                pylab.show()
-                print "show done"
-                """
+        a = moose.element( '/model/compartment/a' )
+        b = moose.element( '/model/compartment/b' )
+        print(('/newplot\n/plotname a' + str(num)))
+        for x in a.vec.conc:
+            print(x)
+        print(('/newplot\n/plotname b' + str(num)))
+        for y in b.vec.conc:
+            print(y)
+        """
+        print '/newplot\n/plotname bvol'
+        for z in a.vec.volume:
+            print z * 1e18
+        print '/newplot\n/plotname aInit'
+        for x in a.vec.concInit:
+            print x
+        pos = numpy.arange( 0, a.vec.conc.size, 1.0 )
+        aconc = numpy.array( a.vec.conc )
+        bconc = numpy.array( b.vec.conc )
+        print "pos a, b = ", pos, b.vec.conc.size
+        pylab.plot( pos[:100], aconc[:100], label='a' )
+        pylab.plot( pos[:100], bconc[:100], label='b' )
+        #pylab.plot( pos, a.vec.conc, label='a' )
+        #pylab.plot( pos, b.vec.conc, label='b' )
+        print "plotting done"
+        pylab.legend()
+        print "legend done"
+        pylab.show()
+        print "show done"
+        """
 
 def main():
-                runtime = 400
-		dt4 = 0.02  # for the diffusion
-		dt5 = 0.2   # for the reaction
-                # Set up clocks. The dsolver to know before assigning stoich
-		moose.setClock( 4, dt4 )
-		moose.setClock( 5, dt5 )
-                model = moose.Neutral( '/model' )
-                cellId = loadElec()
-		makeChemModel( cellId )
-		moose.useClock( 4, '/model/compartment/dsolve', 'process' )
-                # Ksolve must be scheduled after dsolve.
-		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
-                print "finished loading"
-		moose.reinit()
-                for i in range( 10 ):
-		    moose.start( runtime / 10 ) # Run the model for 10 seconds.
-                    # print 'done', i
-                    displayPlots( i )
-                print "finished running"
-
-                """
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
-		s = moose.element( '/model/compartment/s' )
-
-                atot = sum( a.vec.conc )
-                btot = sum( b.vec.conc )
-                stot = sum( s.vec.conc )
-                print "a = ", a.vec.conc
-                print "b = ", b.vec.conc
-                print "s = ", s.vec.conc
-
-                print 'tot = ', atot, btot, atot + btot + stot
-                displayPlots()
-                """
-
-                """
-		dsolve = moose.element( '/model/compartment/dsolve' )
-                
-                print '**************** dsolve.nvecs'
-                x = dsolve.nVec[0]
-                print dsolve.numPools, x, sum(x)
-                print dsolve.nVec[1], sum( dsolve.nVec[1] )
-                print dsolve.nVec[2], sum( dsolve.nVec[2] )
-                print dsolve.nVec[3], sum( dsolve.nVec[3] )
-                """
-
-		quit()
+        runtime = 400
+        dt4 = 0.02  # for the diffusion
+        dt5 = 0.2   # for the reaction
+        # Set up clocks. The dsolver to know before assigning stoich
+        moose.setClock( 4, dt4 )
+        moose.setClock( 5, dt5 )
+        model = moose.Neutral( '/model' )
+        cellId = loadElec()
+        makeChemModel( cellId )
+        moose.useClock( 4, '/model/compartment/dsolve', 'process' )
+        # Ksolve must be scheduled after dsolve.
+        moose.useClock( 5, '/model/compartment/ksolve', 'process' )
+        print("finished loading")
+        moose.reinit()
+        for i in range( 10 ):
+            moose.start( runtime / 10 ) # Run the model for 10 seconds.
+            # print 'done', i
+            displayPlots( i )
+            print("finished running")
+
+        """
+        a = moose.element( '/model/compartment/a' )
+        b = moose.element( '/model/compartment/b' )
+        s = moose.element( '/model/compartment/s' )
+
+        atot = sum( a.vec.conc )
+        btot = sum( b.vec.conc )
+        stot = sum( s.vec.conc )
+        print "a = ", a.vec.conc
+        print "b = ", b.vec.conc
+        print "s = ", s.vec.conc
+
+        print 'tot = ', atot, btot, atot + btot + stot
+        displayPlots()
+        """
+
+        """
+        dsolve = moose.element( '/model/compartment/dsolve' )
+        x = dsolve.nVec[0]
+        print dsolve.numPools, x, sum(x)
+        print dsolve.nVec[1], sum( dsolve.nVec[1] )
+        print dsolve.nVec[2], sum( dsolve.nVec[2] )
+        print dsolve.nVec[3], sum( dsolve.nVec[3] )
+        """
+
+        quit()
 
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/MULTI/diffusionOnly.py b/snippets/MULTI/diffusionOnly.py
index 68faddb9..9797c50d 100644
--- a/snippets/MULTI/diffusionOnly.py
+++ b/snippets/MULTI/diffusionOnly.py
@@ -43,30 +43,30 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "hsolve" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "hsolve" )
+    return cellId
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if ( moose.exists( objpath ) ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		moose.connect( tab, 'requestOut', obj, field )
+    #assert moose.exists( objpath )
+    if ( moose.exists( objpath ) ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        moose.connect( tab, 'requestOut', obj, field )
 
 
 def dumpPlots( fname ):
@@ -78,231 +78,231 @@ def dumpPlots( fname ):
         moose.element( x[0] ).xplot( fname, x[0].name + '_e' )
 
 def moveCompt( path, oldParent, newParent ):
-	meshEntries = moose.element( newParent.path + '/mesh' )
-	# Set up vol messaging from new compts to all their child objects.
-	for x in moose.wildcardFind( path + '/##[ISA=PoolBase]' ):
-		moose.connect( meshEntries, 'mesh', x, 'mesh', 'OneToOne' )
-	#print 'path = ', path, ', oldparent = ', oldParent.path
-	orig = moose.element( path )
-	moose.move( orig, newParent )
-	moose.delete( moose.vec( oldParent.path ) )
-	chem = moose.element( '/model/chem' )
-	moose.move( newParent, chem )
+    meshEntries = moose.element( newParent.path + '/mesh' )
+    # Set up vol messaging from new compts to all their child objects.
+    for x in moose.wildcardFind( path + '/##[ISA=PoolBase]' ):
+        moose.connect( meshEntries, 'mesh', x, 'mesh', 'OneToOne' )
+    #print 'path = ', path, ', oldparent = ', oldParent.path
+    orig = moose.element( path )
+    moose.move( orig, newParent )
+    moose.delete( moose.vec( oldParent.path ) )
+    chem = moose.element( '/model/chem' )
+    moose.move( newParent, chem )
 
 def loadChem( neuroCompt, spineCompt, psdCompt ):
-	# We need the compartments to come in with a volume of 1 to match the
-	# original CubeMesh.
-	assert( neuroCompt.volume == 1.0 )
-	assert( spineCompt.volume == 1.0 )
-	assert( psdCompt.volume == 1.0 )
-	assert( neuroCompt.mesh.num == 1 )
-	print('volume = ', neuroCompt.mesh[0].volume)
-	#assert( neuroCompt.mesh[0].volume == 1.0 ) 
-	#an unfortunate mismatch
-	# So we'll have to resize the volumes of the current compartments to the
-	# new ones.
-
-	modelId = moose.loadModel( 'diffonly.g', '/model', 'ee' )
-	#moose.le( '/model/model' )
-	#moose.le( '/model/model/kinetics' )
-	#moose.le( '/model/model/kinetics/PSD' )
-	#moose.le( '/model/model/kinetics/SPINE' )
-	moose.delete( moose.vec( '/model/model/kinetics/PSD/kreac' ) )
-	moose.delete( moose.vec( '/model/model/kinetics/SPINE/kreac' ) )
-	#moose.le( '/model/model/kinetics/PSD' )
-	#moose.le( '/model/model/kinetics/SPINE' )
-	pCaCaM = moose.element( '/model/model/kinetics/PSD/Ca_CaM' )
-	pCaCaM.concInit = 0.001
-	dCaCaM = moose.element( '/model/model/kinetics/PSD/Ca_CaM' )
-	sCaCaM = moose.element( '/model/model/kinetics/SPINE/Ca_CaM' )
-	print("CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit)
-	#moose.delete( moose.vec( '/model/model/kinetics/SPINE/Ca_CaM' ) )
-	#CaCaM2 = moose.element( '/model/model/kinetics/SPINE/Ca_CaM' )
-	#CaCaM2.concInit = 0.001
-	chem = moose.element( '/model/model' )
-	chem.name = 'chem'
-	oldS = moose.element( '/model/chem/compartment_1' )
-	oldP = moose.element( '/model/chem/compartment_2' )
-	oldN = moose.element( '/model/chem/kinetics' )
-	print('oldvols[p,s,d] = ', oldP.volume, oldS.volume, oldN.volume)
-	print('newvols[p,s,d] = ', psdCompt.mesh[0].volume, spineCompt.mesh[0].volume, neuroCompt.mesh[0].volume)
-	oldN.volume = neuroCompt.mesh[0].volume
-	oldS.volume = spineCompt.mesh[0].volume
-	oldP.volume = psdCompt.mesh[0].volume
-	print('after redoing vols')
-	print("CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit)
-	moveCompt( '/model/chem/kinetics/SPINE', oldS, spineCompt )
-	moveCompt( '/model/chem/kinetics/PSD', oldP, psdCompt )
-	# Need to do the DEND last because the oldN is /kinetics, 
-	# and it will be deleted.
-	moveCompt( '/model/chem/kinetics/DEND', oldN, neuroCompt )
-	print('after moving to new compts')
-	print("CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit)
+    # We need the compartments to come in with a volume of 1 to match the
+    # original CubeMesh.
+    assert( neuroCompt.volume == 1.0 )
+    assert( spineCompt.volume == 1.0 )
+    assert( psdCompt.volume == 1.0 )
+    assert( neuroCompt.mesh.num == 1 )
+    print(('volume = ', neuroCompt.mesh[0].volume))
+    #assert( neuroCompt.mesh[0].volume == 1.0 ) 
+    #an unfortunate mismatch
+    # So we'll have to resize the volumes of the current compartments to the
+    # new ones.
+
+    modelId = moose.loadModel( 'diffonly.g', '/model', 'ee' )
+    #moose.le( '/model/model' )
+    #moose.le( '/model/model/kinetics' )
+    #moose.le( '/model/model/kinetics/PSD' )
+    #moose.le( '/model/model/kinetics/SPINE' )
+    moose.delete( moose.vec( '/model/model/kinetics/PSD/kreac' ) )
+    moose.delete( moose.vec( '/model/model/kinetics/SPINE/kreac' ) )
+    #moose.le( '/model/model/kinetics/PSD' )
+    #moose.le( '/model/model/kinetics/SPINE' )
+    pCaCaM = moose.element( '/model/model/kinetics/PSD/Ca_CaM' )
+    pCaCaM.concInit = 0.001
+    dCaCaM = moose.element( '/model/model/kinetics/PSD/Ca_CaM' )
+    sCaCaM = moose.element( '/model/model/kinetics/SPINE/Ca_CaM' )
+    print(("CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit))
+    #moose.delete( moose.vec( '/model/model/kinetics/SPINE/Ca_CaM' ) )
+    #CaCaM2 = moose.element( '/model/model/kinetics/SPINE/Ca_CaM' )
+    #CaCaM2.concInit = 0.001
+    chem = moose.element( '/model/model' )
+    chem.name = 'chem'
+    oldS = moose.element( '/model/chem/compartment_1' )
+    oldP = moose.element( '/model/chem/compartment_2' )
+    oldN = moose.element( '/model/chem/kinetics' )
+    print(('oldvols[p,s,d] = ', oldP.volume, oldS.volume, oldN.volume))
+    print(('newvols[p,s,d] = ', psdCompt.mesh[0].volume, spineCompt.mesh[0].volume, neuroCompt.mesh[0].volume))
+    oldN.volume = neuroCompt.mesh[0].volume
+    oldS.volume = spineCompt.mesh[0].volume
+    oldP.volume = psdCompt.mesh[0].volume
+    print('after redoing vols')
+    print(("CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit))
+    moveCompt( '/model/chem/kinetics/SPINE', oldS, spineCompt )
+    moveCompt( '/model/chem/kinetics/PSD', oldP, psdCompt )
+    # Need to do the DEND last because the oldN is /kinetics, 
+    # and it will be deleted.
+    moveCompt( '/model/chem/kinetics/DEND', oldN, neuroCompt )
+    print('after moving to new compts')
+    print(("CaCaM.concInit[p,s,d] = ", pCaCaM.concInit, sCaCaM.concInit, dCaCaM.concInit))
 
 def makeNeuroMeshModel():
-	diffLength = 20e-6 # But we only want diffusion over part of the model.
-	numSyn = 13
-	elec = loadElec()
-	synInput = moose.SpikeGen( '/model/elec/synInput' )
-	synInput.refractT = 47e-3
-	synInput.threshold = -1.0
-	synInput.edgeTriggered = 0
-	synInput.Vm( 0 )
-
-	synInput.refractT = 47e-3
-	for i in range( numSyn ):
-		name = '/model/elec/spine_head_14_' + str( i + 1 )
-		r = moose.element( name + '/glu' )
-		r.synapse.num = 1 
-		syn = moose.element( r.path + '/synapse' )
-		moose.connect( synInput, 'spikeOut', syn, 'addSpike', 'Single' )
-		syn.weight = 0.2 * i * ( numSyn - 1 - i )
-		syn.delay = i * 1.0e-3
-
-	neuroCompt = moose.NeuroMesh( '/model/neuroMesh' )
-	#print 'neuroMeshvolume = ', neuroCompt.mesh[0].volume
-	neuroCompt.separateSpines = 1
-	neuroCompt.diffLength = diffLength
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/spineMesh' )
-	#print 'spineMeshvolume = ', spineCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/psdMesh' )
-	#print 'psdMeshvolume = ', psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	loadChem( neuroCompt, spineCompt, psdCompt )
-
-	# Put in the solvers, see how they fare.
-	nmksolve = moose.GslStoich( '/model/chem/neuroMesh/ksolve' )
-	nmksolve.path = '/model/chem/neuroMesh/##'
-	nmksolve.compartment = moose.element( '/model/chem/neuroMesh' )
-	nmksolve.method = 'rk5'
-	nm = moose.element( '/model/chem/neuroMesh/mesh' )
-	moose.connect( nm, 'remesh', nmksolve, 'remesh' )
+    diffLength = 20e-6 # But we only want diffusion over part of the model.
+    numSyn = 13
+    elec = loadElec()
+    synInput = moose.SpikeGen( '/model/elec/synInput' )
+    synInput.refractT = 47e-3
+    synInput.threshold = -1.0
+    synInput.edgeTriggered = 0
+    synInput.Vm( 0 )
+
+    synInput.refractT = 47e-3
+    for i in range( numSyn ):
+        name = '/model/elec/spine_head_14_' + str( i + 1 )
+        r = moose.element( name + '/glu' )
+        r.synapse.num = 1 
+        syn = moose.element( r.path + '/synapse' )
+        moose.connect( synInput, 'spikeOut', syn, 'addSpike', 'Single' )
+        syn.weight = 0.2 * i * ( numSyn - 1 - i )
+        syn.delay = i * 1.0e-3
+
+    neuroCompt = moose.NeuroMesh( '/model/neuroMesh' )
+    #print 'neuroMeshvolume = ', neuroCompt.mesh[0].volume
+    neuroCompt.separateSpines = 1
+    neuroCompt.diffLength = diffLength
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/spineMesh' )
+    #print 'spineMeshvolume = ', spineCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/psdMesh' )
+    #print 'psdMeshvolume = ', psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    loadChem( neuroCompt, spineCompt, psdCompt )
+
+    # Put in the solvers, see how they fare.
+    nmksolve = moose.GslStoich( '/model/chem/neuroMesh/ksolve' )
+    nmksolve.path = '/model/chem/neuroMesh/##'
+    nmksolve.compartment = moose.element( '/model/chem/neuroMesh' )
+    nmksolve.method = 'rk5'
+    nm = moose.element( '/model/chem/neuroMesh/mesh' )
+    moose.connect( nm, 'remesh', nmksolve, 'remesh' )
     #print "neuron: nv=", nmksolve.numLocalVoxels, ", nav=", nmksolve.numAllVoxels, nmksolve.numVarPools, nmksolve.numAllPools
 
     #print 'setting up smksolve'
-	smksolve = moose.GslStoich( '/model/chem/spineMesh/ksolve' )
-	smksolve.path = '/model/chem/spineMesh/##'
-	smksolve.compartment = moose.element( '/model/chem/spineMesh' )
-	smksolve.method = 'rk5'
-	sm = moose.element( '/model/chem/spineMesh/mesh' )
-	moose.connect( sm, 'remesh', smksolve, 'remesh' )
-	#print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
-	#
-	#print 'setting up pmksolve'
-	pmksolve = moose.GslStoich( '/model/chem/psdMesh/ksolve' )
-	pmksolve.path = '/model/chem/psdMesh/##'
-	pmksolve.compartment = moose.element( '/model/chem/psdMesh' )
-	pmksolve.method = 'rk5'
-	pm = moose.element( '/model/chem/psdMesh/mesh' )
-	moose.connect( pm, 'remesh', pmksolve, 'remesh' )
-	#print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
-	#
-	print('neuroMeshvolume = ', neuroCompt.mesh[0].volume)
-
-	#print 'Assigning the cell model'
-	# Now to set up the model.
-	#neuroCompt.cell = elec
-	neuroCompt.cellPortion( elec, '/model/elec/lat_14_#,/model/elec/spine_neck#,/model/elec/spine_head#' )
-	"""
-	ns = neuroCompt.numSegments
-	#assert( ns == 11 ) # dend, 5x (shaft+head)
-	ndc = neuroCompt.numDiffCompts
-	#print 'numDiffCompts = ', ndc
-	assert( ndc == 145 )
-	ndc = neuroCompt.mesh.num
-	#print 'NeuroMeshNum = ', ndc
-	assert( ndc == 145 )
-
-	sdc = spineCompt.mesh.num
-	#print 'SpineMeshNum = ', sdc
-	assert( sdc == 13 )
-	pdc = psdCompt.mesh.num
-	#print 'PsdMeshNum = ', pdc
-	assert( pdc == 13 )
-	"""
-
-	mesh = moose.vec( '/model/chem/neuroMesh/mesh' )
-	#for i in range( ndc ):
-	#	print 's[', i, '] = ', mesh[i].volume
-	mesh2 = moose.vec( '/model/chem/spineMesh/mesh' )
-#	for i in range( sdc ):
-#		print 's[', i, '] = ', mesh2[i].volume
-	#print 'numPSD = ', moose.element( '/model/chem/psdMesh/mesh' ).localNumField
-	mesh = moose.vec( '/model/chem/psdMesh/mesh' )
-	#print 'psd mesh.volume = ', mesh.volume
-	#for i in range( pdc ):
-	#	print 's[', i, '] = ', mesh[i].volume
-	#
-	# We need to use the spine solver as the master for the purposes of
-	# these calculations. This will handle the diffusion calculations
-	# between head and dendrite, and between head and PSD.
-	smksolve.addJunction( nmksolve )
-	#print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
-	smksolve.addJunction( pmksolve )
-	#print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
-	ndc = neuroCompt.numDiffCompts
-	#print 'numDiffCompts = ', ndc
-	assert( ndc == 13 )
-	ndc = neuroCompt.mesh.num
-	#print 'NeuroMeshNum = ', ndc
-	assert( ndc == 13 )
-	sdc = spineCompt.mesh.num
-	#print 'SpineMeshNum = ', sdc
-	assert( sdc == 13 )
-	pdc = psdCompt.mesh.num
-	#print 'PsdMeshNum = ', pdc
-	assert( pdc == 13 )
-
-	"""
-	print 'neuroCompt'
-	for i in range( ndc ):
-			print i, neuroCompt.stencilIndex[i]
-			print i, neuroCompt.stencilRate[i]
-
-	print 'spineCompt'
-	for i in range( sdc * 3 ):
-			print i, spineCompt.stencilIndex[i]
-			print i, spineCompt.stencilRate[i]
-
-	print 'psdCompt'
-	for i in range( pdc ):
-			print i, psdCompt.stencilIndex[i]
-			print i, psdCompt.stencilRate[i]
-	print 'Spine parents:'
-	pavoxel = spineCompt.parentVoxel
-	for i in range( sdc ):
-		print i, pavoxel[i]
-	"""
-
-	# oddly, numLocalFields does not work.
-	#moose.le( '/model/chem/neuroMesh' )
-	ca = moose.element( '/model/chem/neuroMesh/DEND/Ca' )
-	assert( ca.lastDimension == ndc )
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spineMesh/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/psdMesh/adaptCa', pdc )
-	adaptCa = moose.vec( '/model/chem/psdMesh/adaptCa' )
-	chemCa = moose.vec( '/model/chem/psdMesh/PSD/Ca' )
-	assert( len( adaptCa ) == pdc )
-	assert( len( chemCa ) == pdc )
-	for i in range( pdc ):
-		path = '/model/elec/spine_head_14_' + str( i + 1 ) + '/NMDA_Ca_conc'
-		elecCa = moose.element( path )
-		moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-	moose.connect( adaptCa, 'outputSrc', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0		# 
-	adaptCa.outputOffset = 80e-6	# 80 nM offset in chem.
-   	adaptCa.scale = 1e-5	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-	#print adaptCa.scale
+    smksolve = moose.GslStoich( '/model/chem/spineMesh/ksolve' )
+    smksolve.path = '/model/chem/spineMesh/##'
+    smksolve.compartment = moose.element( '/model/chem/spineMesh' )
+    smksolve.method = 'rk5'
+    sm = moose.element( '/model/chem/spineMesh/mesh' )
+    moose.connect( sm, 'remesh', smksolve, 'remesh' )
+    #print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
+    #
+    #print 'setting up pmksolve'
+    pmksolve = moose.GslStoich( '/model/chem/psdMesh/ksolve' )
+    pmksolve.path = '/model/chem/psdMesh/##'
+    pmksolve.compartment = moose.element( '/model/chem/psdMesh' )
+    pmksolve.method = 'rk5'
+    pm = moose.element( '/model/chem/psdMesh/mesh' )
+    moose.connect( pm, 'remesh', pmksolve, 'remesh' )
+    #print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
+    #
+    print(('neuroMeshvolume = ', neuroCompt.mesh[0].volume))
+
+    #print 'Assigning the cell model'
+    # Now to set up the model.
+    #neuroCompt.cell = elec
+    neuroCompt.cellPortion( elec, '/model/elec/lat_14_#,/model/elec/spine_neck#,/model/elec/spine_head#' )
+    """
+    ns = neuroCompt.numSegments
+    #assert( ns == 11 ) # dend, 5x (shaft+head)
+    ndc = neuroCompt.numDiffCompts
+    #print 'numDiffCompts = ', ndc
+    assert( ndc == 145 )
+    ndc = neuroCompt.mesh.num
+    #print 'NeuroMeshNum = ', ndc
+    assert( ndc == 145 )
+
+    sdc = spineCompt.mesh.num
+    #print 'SpineMeshNum = ', sdc
+    assert( sdc == 13 )
+    pdc = psdCompt.mesh.num
+    #print 'PsdMeshNum = ', pdc
+    assert( pdc == 13 )
+    """
+
+    mesh = moose.vec( '/model/chem/neuroMesh/mesh' )
+    #for i in range( ndc ):
+    #    print 's[', i, '] = ', mesh[i].volume
+    mesh2 = moose.vec( '/model/chem/spineMesh/mesh' )
+#    for i in range( sdc ):
+#        print 's[', i, '] = ', mesh2[i].volume
+    #print 'numPSD = ', moose.element( '/model/chem/psdMesh/mesh' ).localNumField
+    mesh = moose.vec( '/model/chem/psdMesh/mesh' )
+    #print 'psd mesh.volume = ', mesh.volume
+    #for i in range( pdc ):
+    #    print 's[', i, '] = ', mesh[i].volume
+    #
+    # We need to use the spine solver as the master for the purposes of
+    # these calculations. This will handle the diffusion calculations
+    # between head and dendrite, and between head and PSD.
+    smksolve.addJunction( nmksolve )
+    #print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
+    smksolve.addJunction( pmksolve )
+    #print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
+    ndc = neuroCompt.numDiffCompts
+    #print 'numDiffCompts = ', ndc
+    assert( ndc == 13 )
+    ndc = neuroCompt.mesh.num
+    #print 'NeuroMeshNum = ', ndc
+    assert( ndc == 13 )
+    sdc = spineCompt.mesh.num
+    #print 'SpineMeshNum = ', sdc
+    assert( sdc == 13 )
+    pdc = psdCompt.mesh.num
+    #print 'PsdMeshNum = ', pdc
+    assert( pdc == 13 )
+
+    """
+    print 'neuroCompt'
+    for i in range( ndc ):
+            print i, neuroCompt.stencilIndex[i]
+            print i, neuroCompt.stencilRate[i]
+
+    print 'spineCompt'
+    for i in range( sdc * 3 ):
+            print i, spineCompt.stencilIndex[i]
+            print i, spineCompt.stencilRate[i]
+
+    print 'psdCompt'
+    for i in range( pdc ):
+            print i, psdCompt.stencilIndex[i]
+            print i, psdCompt.stencilRate[i]
+    print 'Spine parents:'
+    pavoxel = spineCompt.parentVoxel
+    for i in range( sdc ):
+        print i, pavoxel[i]
+    """
+
+    # oddly, numLocalFields does not work.
+    #moose.le( '/model/chem/neuroMesh' )
+    ca = moose.element( '/model/chem/neuroMesh/DEND/Ca' )
+    assert( ca.lastDimension == ndc )
+    """
+    CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
+    print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
+    CaNspine = moose.vec( '/model/chem/spineMesh/SPINE/CaN_BULK/CaN' )
+    print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
+    """
+
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/psdMesh/adaptCa', pdc )
+    adaptCa = moose.vec( '/model/chem/psdMesh/adaptCa' )
+    chemCa = moose.vec( '/model/chem/psdMesh/PSD/Ca' )
+    assert( len( adaptCa ) == pdc )
+    assert( len( chemCa ) == pdc )
+    for i in range( pdc ):
+        path = '/model/elec/spine_head_14_' + str( i + 1 ) + '/NMDA_Ca_conc'
+        elecCa = moose.element( path )
+        moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+    moose.connect( adaptCa, 'outputSrc', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0        # 
+    adaptCa.outputOffset = 80e-6    # 80 nM offset in chem.
+    adaptCa.scale = 1e-5    # 520 to 0.0052 mM
+    #print adaptCa.outputOffset
+    #print adaptCa.scale
 
 def makeElecPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -317,121 +317,121 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head_14_13/NMDA_Ca_conc', 'getCa', 'elec/spine_13Ca' )
 
 def makeChemPlots():
-	spineMesh = moose.element( '/model/chem/spineMesh' )
-	middleSpine = 6
-	midSpineVoxel = spineMesh.parentVoxel[middleSpine]
-	graphs = moose.Neutral( '/graphs' )
-	addPlot( '/model/chem/psdMesh/PSD/Ca[0]', 'getConc', 'pCa0' )
-	addPlot( '/model/chem/psdMesh/PSD/Ca[6]', 'getConc', 'pCa6' )
-	addPlot( '/model/chem/psdMesh/PSD/Ca[12]', 'getConc', 'pCa12' )
-
-	addPlot( '/model/chem/spineMesh/SPINE/Ca[0]', 'getConc', 'sCa0' )
-	addPlot( '/model/chem/spineMesh/SPINE/Ca[6]', 'getConc', 'sCa6' )
-	addPlot( '/model/chem/spineMesh/SPINE/Ca[12]', 'getConc', 'sCa12' )
-
-	addPlot( '/model/chem/neuroMesh/DEND/Ca[0]', 'getConc', 'dend0Ca' )
-	addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel ) + ']', 'getConc', 'dendMidCa' )
-	addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel+2 ) + ']', 'getConc', 'dendMid2' )
-	addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel+4 ) + ']', 'getConc', 'dendMid4' )
-	addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel+6 ) + ']', 'getConc', 'dendMid6' )
-	addPlot( '/model/chem/neuroMesh/DEND/Ca[144]', 'getConc', 'dend144Ca' )
-
-	addPlot( '/model/chem/psdMesh/PSD/CaM[0]', 'getConc', 'pCaM0' )
-	addPlot( '/model/chem/psdMesh/PSD/CaM[6]', 'getConc', 'pCaM6' )
-	addPlot( '/model/chem/psdMesh/PSD/CaM[12]', 'getConc', 'pCaM12' )
-
-	addPlot( '/model/chem/spineMesh/SPINE/CaM[0]', 'getConc', 'sCaM0' )
-	addPlot( '/model/chem/spineMesh/SPINE/CaM[6]', 'getConc', 'sCaM6' )
-	addPlot( '/model/chem/spineMesh/SPINE/CaM[12]', 'getConc', 'sCaM12' )
-
-	addPlot( '/model/chem/psdMesh/PSD/Ca_CaM[0]', 'getConc', 'pCaCaM0' )
-	addPlot( '/model/chem/psdMesh/PSD/Ca_CaM[6]', 'getConc', 'pCaCaM6' )
-	addPlot( '/model/chem/psdMesh/PSD/Ca_CaM[12]', 'getConc', 'pCaCaM12' )
-
-	addPlot( '/model/chem/spineMesh/SPINE/Ca_CaM[0]', 'getConc', 'sCaCaM0' )
-	addPlot( '/model/chem/spineMesh/SPINE/Ca_CaM[6]', 'getConc', 'sCaCaM6' )
-	addPlot( '/model/chem/spineMesh/SPINE/Ca_CaM[12]', 'getConc', 'sCaCaM12' )
-
-	addPlot( '/model/chem/neuroMesh/DEND/Ca_CaM[0]', 'getConc', 'dCaCaM0' )
-	addPlot( '/model/chem/neuroMesh/DEND/Ca_CaM[' + str( midSpineVoxel ) + ']', 'getConc', 'dendMidCaCaM' )
-	addPlot( '/model/chem/neuroMesh/DEND/Ca_CaM[144]', 'getConc', 'dCaCaM144' )
+    spineMesh = moose.element( '/model/chem/spineMesh' )
+    middleSpine = 6
+    midSpineVoxel = spineMesh.parentVoxel[middleSpine]
+    graphs = moose.Neutral( '/graphs' )
+    addPlot( '/model/chem/psdMesh/PSD/Ca[0]', 'getConc', 'pCa0' )
+    addPlot( '/model/chem/psdMesh/PSD/Ca[6]', 'getConc', 'pCa6' )
+    addPlot( '/model/chem/psdMesh/PSD/Ca[12]', 'getConc', 'pCa12' )
+
+    addPlot( '/model/chem/spineMesh/SPINE/Ca[0]', 'getConc', 'sCa0' )
+    addPlot( '/model/chem/spineMesh/SPINE/Ca[6]', 'getConc', 'sCa6' )
+    addPlot( '/model/chem/spineMesh/SPINE/Ca[12]', 'getConc', 'sCa12' )
+
+    addPlot( '/model/chem/neuroMesh/DEND/Ca[0]', 'getConc', 'dend0Ca' )
+    addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel ) + ']', 'getConc', 'dendMidCa' )
+    addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel+2 ) + ']', 'getConc', 'dendMid2' )
+    addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel+4 ) + ']', 'getConc', 'dendMid4' )
+    addPlot( '/model/chem/neuroMesh/DEND/Ca[' + str( midSpineVoxel+6 ) + ']', 'getConc', 'dendMid6' )
+    addPlot( '/model/chem/neuroMesh/DEND/Ca[144]', 'getConc', 'dend144Ca' )
+
+    addPlot( '/model/chem/psdMesh/PSD/CaM[0]', 'getConc', 'pCaM0' )
+    addPlot( '/model/chem/psdMesh/PSD/CaM[6]', 'getConc', 'pCaM6' )
+    addPlot( '/model/chem/psdMesh/PSD/CaM[12]', 'getConc', 'pCaM12' )
+
+    addPlot( '/model/chem/spineMesh/SPINE/CaM[0]', 'getConc', 'sCaM0' )
+    addPlot( '/model/chem/spineMesh/SPINE/CaM[6]', 'getConc', 'sCaM6' )
+    addPlot( '/model/chem/spineMesh/SPINE/CaM[12]', 'getConc', 'sCaM12' )
+
+    addPlot( '/model/chem/psdMesh/PSD/Ca_CaM[0]', 'getConc', 'pCaCaM0' )
+    addPlot( '/model/chem/psdMesh/PSD/Ca_CaM[6]', 'getConc', 'pCaCaM6' )
+    addPlot( '/model/chem/psdMesh/PSD/Ca_CaM[12]', 'getConc', 'pCaCaM12' )
+
+    addPlot( '/model/chem/spineMesh/SPINE/Ca_CaM[0]', 'getConc', 'sCaCaM0' )
+    addPlot( '/model/chem/spineMesh/SPINE/Ca_CaM[6]', 'getConc', 'sCaCaM6' )
+    addPlot( '/model/chem/spineMesh/SPINE/Ca_CaM[12]', 'getConc', 'sCaCaM12' )
+
+    addPlot( '/model/chem/neuroMesh/DEND/Ca_CaM[0]', 'getConc', 'dCaCaM0' )
+    addPlot( '/model/chem/neuroMesh/DEND/Ca_CaM[' + str( midSpineVoxel ) + ']', 'getConc', 'dendMidCaCaM' )
+    addPlot( '/model/chem/neuroMesh/DEND/Ca_CaM[144]', 'getConc', 'dCaCaM144' )
 
 def testNeuroMeshMultiscale():
-	elecDt = 50e-6
-	chemDt = 1e-4
-	plotDt = 5e-4
-	plotName = 'diffonly.plot'
-
-	makeNeuroMeshModel()
-	"""
-	for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if ( i[0].diffConst > 0 ):
-			grandpaname = i.parent[0].parent.name + '/'
-			paname = i.parent[0].name + '/'
-			print grandpaname + paname + i[0].name, i[0].diffConst
-	moose.le( '/model/chem/spineMesh/ksolve' )
-	print 'Neighbors:'
-	for t in moose.element( '/model/chem/spineMesh/ksolve/junction' ).neighbors['masterJunction']:
-		print 'masterJunction <-', t.path
-	for t in moose.wildcardFind( '/model/chem/#Mesh/ksolve' ):
-		k = moose.element( t[0] )
-		print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
-	"""
-
-	makeChemPlots()
-	makeElecPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, plotDt )
-	moose.setClock( 8, plotDt )
-	moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	moose.useClock( 6, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 7, '/graphs/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#', 'process' )
-	moose.useClock( 5, '/model/chem/#Mesh/ksolve', 'init' )
-	moose.useClock( 6, '/model/chem/#Mesh/ksolve', 'process' )
-	hsolve = moose.HSolve( '/model/elec/hsolve' )
-	moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	hsolve.dt = elecDt
-	hsolve.target = '/model/elec/compt'
-	moose.reinit()
-	moose.reinit()
-	"""
-	print 'pre'
-	eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'dend'
-	eca = moose.vec( '/model/chem/neuroMesh/DEND/Ca' )
-	for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
-		print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-
-	print 'PSD'
-	eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'spine'
-	eca = moose.vec( '/model/chem/spineMesh/SPINE/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	"""
-
-	moose.start( 0.5 )
-	dumpPlots( plotName )
-	print('All done')
+    elecDt = 50e-6
+    chemDt = 1e-4
+    plotDt = 5e-4
+    plotName = 'diffonly.plot'
+
+    makeNeuroMeshModel()
+    """
+    for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if ( i[0].diffConst > 0 ):
+            grandpaname = i.parent[0].parent.name + '/'
+            paname = i.parent[0].name + '/'
+            print grandpaname + paname + i[0].name, i[0].diffConst
+    moose.le( '/model/chem/spineMesh/ksolve' )
+    print 'Neighbors:'
+    for t in moose.element( '/model/chem/spineMesh/ksolve/junction' ).neighbors['masterJunction']:
+        print 'masterJunction <-', t.path
+    for t in moose.wildcardFind( '/model/chem/#Mesh/ksolve' ):
+        k = moose.element( t[0] )
+        print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
+    """
+
+    makeChemPlots()
+    makeElecPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, plotDt )
+    moose.setClock( 8, plotDt )
+    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+    moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
+    moose.useClock( 6, '/model/chem/##[ISA=Adaptor]', 'process' )
+    moose.useClock( 7, '/graphs/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#', 'process' )
+    moose.useClock( 5, '/model/chem/#Mesh/ksolve', 'init' )
+    moose.useClock( 6, '/model/chem/#Mesh/ksolve', 'process' )
+    hsolve = moose.HSolve( '/model/elec/hsolve' )
+    moose.useClock( 1, '/model/elec/hsolve', 'process' )
+    hsolve.dt = elecDt
+    hsolve.target = '/model/elec/compt'
+    moose.reinit()
+    moose.reinit()
+    """
+    print 'pre'
+    eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'dend'
+    eca = moose.vec( '/model/chem/neuroMesh/DEND/Ca' )
+    for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
+        print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+
+    print 'PSD'
+    eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'spine'
+    eca = moose.vec( '/model/chem/spineMesh/SPINE/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    """
+
+    moose.start( 0.5 )
+    dumpPlots( plotName )
+    print('All done')
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # loadMulti.py ends here.
diff --git a/snippets/MULTI/loadMulti.py b/snippets/MULTI/loadMulti.py
index d4e92aa3..128acd3b 100644
--- a/snippets/MULTI/loadMulti.py
+++ b/snippets/MULTI/loadMulti.py
@@ -35,39 +35,39 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
+    return cellId
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print("addPlot failed: object is a Neutral: ", objpath)
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print("addPlot failed: object not found: ", objpath)
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def dumpPlots( fname ):
     if ( os.path.exists( fname ) ):
@@ -78,143 +78,141 @@ def dumpPlots( fname ):
         moose.element( x[0] ).xplot( fname, x[0].name + '_e' )
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    #print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 
 def makeNeuroMeshModel():
-	diffLength = 10e-6 # But we only want diffusion over part of the model.
-	numSyn = 13
-	elec = loadElec()
-	synInput = moose.SpikeGen( '/model/elec/synInput' )
-	synInput.threshold = -1.0
-	synInput.edgeTriggered = 0
-	synInput.Vm( 0 )
-	synInput.refractT = 47e-3
-
-	for i in range( numSyn ):
-		name = '/model/elec/spine_head_14_' + str( i + 1 )
-		r = moose.element( name + '/glu' )
-		r.synapse.num = 1 
-		syn = moose.element( r.path + '/synapse' )
-		moose.connect( synInput, 'spikeOut', syn, 'addSpike', 'Single' )
-		syn.weight = 0.2 * i * ( numSyn - 1 - i )
-		syn.delay = i * 1.0e-3
-
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
-
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print('ns = ', ns, ', ndc = ', ndc)
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 36 ) # dend, 5x (shaft+head)
-	assert( ndc == 278 )
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print('done setting path, numPools = ', nmdsolve.numPools)
-        assert( nmdsolve.numPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
+    diffLength = 10e-6 # But we only want diffusion over part of the model.
+    numSyn = 13
+    elec = loadElec()
+    synInput = moose.SpikeGen( '/model/elec/synInput' )
+    synInput.threshold = -1.0
+    synInput.edgeTriggered = 0
+    synInput.Vm( 0 )
+    synInput.refractT = 47e-3
+
+    for i in range( numSyn ):
+        name = '/model/elec/spine_head_14_' + str( i + 1 )
+        r = moose.element( name + '/glu' )
+        r.synapse.num = 1 
+        syn = moose.element( r.path + '/synapse' )
+        moose.connect( synInput, 'spikeOut', syn, 'addSpike', 'Single' )
+        syn.weight = 0.2 * i * ( numSyn - 1 - i )
+        syn.delay = i * 1.0e-3
+
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
+
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 36 ) # dend, 5x (shaft+head)
+    assert( ndc == 278 )
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print('sdc = ', sdc)
-	assert( sdc == 13 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        assert( smstoich.numAllPools == 36 )
-        
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 13 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        print('numAllPools = ', pmstoich.numAllPools)
-        assert( pmstoich.numAllPools == 56 )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        bar = moose.element( '/model/chem/psd/I1_p' )
-        print('PSD: numfoo = ', foo.numData, 'numbar = ', bar.numData)
-        print('PSD: numAllVoxels = ', pmksolve.numAllVoxels)
-
-        # Put in junctions between diffusion solvers
-        nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
-
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/psd/adaptCa', pdc )
-	adaptCa = moose.vec( '/model/chem/psd/adaptCa' )
-	chemCa = moose.vec( '/model/chem/psd/Ca' )
-	print('aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData)
-	assert( len( adaptCa ) == pdc )
-	assert( len( chemCa ) == pdc )
-	for i in range( pdc ):
-		path = '/model/elec/spine_head_14_' + str( i + 1 ) + '/NMDA_Ca_conc'
-		elecCa = moose.element( path )
-		moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-		moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
-	        adaptCa[i].inputOffset = 0.0	# 
-	        adaptCa[i].outputOffset = 0.00008  # 80 nM offset in chem.
-   	        adaptCa[i].scale = 1e-5	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-	#print adaptCa.scale
-        """
-        """
-
-	"""
-	aGluR = moose.Adaptor( '/model/chem/psd/adaptGluR', 5 )
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print(('sdc = ', sdc))
+    assert( sdc == 13 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    assert( smstoich.numAllPools == 36 )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 13 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    print(('numAllPools = ', pmstoich.numAllPools))
+    assert( pmstoich.numAllPools == 56 )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    bar = moose.element( '/model/chem/psd/I1_p' )
+    print(('PSD: numfoo = ', foo.numData, 'numbar = ', bar.numData))
+    print(('PSD: numAllVoxels = ', pmksolve.numAllVoxels))
+
+    # Put in junctions between diffusion solvers
+    nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
+
+    """
+    CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
+    print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
+    CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
+    print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
+    """
+
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/psd/adaptCa', pdc )
+    adaptCa = moose.vec( '/model/chem/psd/adaptCa' )
+    chemCa = moose.vec( '/model/chem/psd/Ca' )
+    print( 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = "
+            , len( chemCa ), ", numData = ", chemCa.numData
+            )
+    assert( len( adaptCa ) == pdc )
+    assert( len( chemCa ) == pdc )
+    for i in range( pdc ):
+        path = '/model/elec/spine_head_14_' + str( i + 1 ) + '/NMDA_Ca_conc'
+        elecCa = moose.element( path )
+        moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+        moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
+        adaptCa[i].inputOffset = 0.0    # 
+        adaptCa[i].outputOffset = 0.00008  # 80 nM offset in chem.
+        adaptCa[i].scale = 1e-5    # 520 to 0.0052 mM
+
+    """
+    aGluR = moose.Adaptor( '/model/chem/psd/adaptGluR', 5 )
     adaptGluR = moose.vec( '/model/chem/psd/adaptGluR' )
-	chemR = moose.vec( '/model/chem/psd/psdGluR' )
-	assert( len( adaptGluR ) == 5 )
-	for i in range( 5 ):
-    	path = '/model/elec/head' + str( i ) + '/gluR'
-		elecR = moose.element( path )
-			moose.connect( adaptGluR[i], 'outputSrc', elecR, 'setGbar', 'Single' )
+    chemR = moose.vec( '/model/chem/psd/psdGluR' )
+    assert( len( adaptGluR ) == 5 )
+    for i in range( 5 ):
+        path = '/model/elec/head' + str( i ) + '/gluR'
+        elecR = moose.element( path )
+            moose.connect( adaptGluR[i], 'outputSrc', elecR, 'setGbar', 'Single' )
     #moose.connect( chemR, 'nOut', adaptGluR, 'input', 'OneToOne' )
-	# Ksolve isn't sending nOut. Not good. So have to use requestOut.
+    # Ksolve isn't sending nOut. Not good. So have to use requestOut.
     moose.connect( adaptGluR, 'requestOut', chemR, 'getN', 'OneToOne' )
     adaptGluR.outputOffset = 1e-7    # pS
     adaptGluR.scale = 1e-6 / 100     # from n to pS
@@ -222,10 +220,10 @@ def makeNeuroMeshModel():
     adaptK = moose.Adaptor( '/model/chem/dend/adaptK' )
     chemK = moose.element( '/model/chem/dend/kChan' )
     elecK = moose.element( '/model/elec/compt/K' )
-	moose.connect( adaptK, 'requestOut', chemK, 'getConc', 'OneToAll' )
-	moose.connect( adaptK, 'outputSrc', elecK, 'setGbar', 'Single' )
-	adaptK.scale = 0.3               # from mM to Siemens
-	"""
+    moose.connect( adaptK, 'requestOut', chemK, 'getConc', 'OneToAll' )
+    moose.connect( adaptK, 'outputSrc', elecK, 'setGbar', 'Single' )
+    adaptK.scale = 0.3               # from mM to Siemens
+    """
 
 def makeElecPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -240,134 +238,134 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head_14_13/NMDA_Ca_conc', 'getCa', 'elec/spine_13Ca' )
 
 def makeChemPlots():
-	spineMesh = moose.element( '/model/chem/spine' )
-	middleSpine = 6
-	# handy lookup function to find which voxel # the spine is on.
-	midSpineVoxel = spineMesh.parentVoxel[middleSpine]
-        print(spineMesh.parentVoxel)
-	graphs = moose.Neutral( '/graphs' )
-	addPlot( '/model/chem/psd/tot_PSD_R[0]', 'getN', 'psd0R' )
-	addPlot( '/model/chem/psd/tot_PSD_R[1]', 'getN', 'psd1R' )
-	addPlot( '/model/chem/psd/tot_PSD_R[2]', 'getN', 'psd2R' )
-	addPlot( '/model/chem/psd/CaM_dash_Ca4[0]', 'getConc', 'psdCaM0' )
-	addPlot( '/model/chem/psd/CaM_dash_Ca4[6]', 'getConc', 'psdCaM6' )
-	addPlot( '/model/chem/psd/CaM_CaN[0]', 'getConc', 'CaM_CaN' )
-	addPlot( '/model/chem/psd/PP1_dash_active[0]', 'getConc', 'PP1_active0' )
-	addPlot( '/model/chem/psd/PP1_dash_active[6]', 'getConc', 'psdPP1_active6' )
-	addPlot( '/model/chem/psd/actCaMKII[6]', 'getConc', 'psdCaMKII6' )
-	addPlot( '/model/chem/spine/actCaMKII[6]', 'getConc', 'spineCaMKII6' )
-	addPlot( '/model/chem/psd/Ca[0]', 'getConc', 'psd0Ca' )
-	addPlot( '/model/chem/psd/Ca[6]', 'getConc', 'psd6Ca' )
-	addPlot( '/model/chem/psd/Ca[12]', 'getConc', 'psd12Ca' )
-
-	addPlot( '/model/chem/spine/Ca[0]', 'getConc', 'spine0Ca' )
-	addPlot( '/model/chem/spine/Ca[6]', 'getConc', 'spine6Ca' )
-	addPlot( '/model/chem/spine/Ca[12]', 'getConc', 'spine12Ca' )
-
-	addPlot( '/model/chem/dend/DEND/Ca[0]', 'getConc', 'dend0Ca' )
-	path = '/model/chem/dend/DEND/Ca['
-	addPlot( path + str( midSpineVoxel ) + ']', 'getConc', 'dendMidCa' )
-	addPlot( path + str( midSpineVoxel+2 ) + ']', 'getConc', 'dendMid2Ca' )
-	addPlot( path + str( midSpineVoxel+4 ) + ']', 'getConc', 'dendMid4Ca' )
-	addPlot( path + str( midSpineVoxel+6 ) + ']', 'getConc', 'dendMid6Ca' )
-	addPlot( '/model/chem/dend/DEND/Ca[144]', 'getConc', 'dend144Ca' )
-
-	#addPlot( '/n/dend/Ca', 'getConc', 'dendCa' )
-	#addPlot( '/n/dend/inact_kinase', 'getConc', 'inactDendKinase' )
-	#addPlot( '/n/psd/psdGluR', 'getN', 'psdGluR' )
-	addPlot( '/model/chem/psd/CaMKII_dash_CaM[6]', 'getConc', 'psdCaM_CaMKII6' )
-	addPlot( '/model/chem/spine/CaMKII_dash_CaM[6]', 'getConc', 'spineCaM_CaMKII6' )
-	addPlot( '/model/chem/spine/NMDAR[6]', 'getConc', 'psd_NMDAR6' )
+    spineMesh = moose.element( '/model/chem/spine' )
+    middleSpine = 6
+    # handy lookup function to find which voxel # the spine is on.
+    midSpineVoxel = spineMesh.parentVoxel[middleSpine]
+    print((spineMesh.parentVoxel))
+    graphs = moose.Neutral( '/graphs' )
+    addPlot( '/model/chem/psd/tot_PSD_R[0]', 'getN', 'psd0R' )
+    addPlot( '/model/chem/psd/tot_PSD_R[1]', 'getN', 'psd1R' )
+    addPlot( '/model/chem/psd/tot_PSD_R[2]', 'getN', 'psd2R' )
+    addPlot( '/model/chem/psd/CaM_dash_Ca4[0]', 'getConc', 'psdCaM0' )
+    addPlot( '/model/chem/psd/CaM_dash_Ca4[6]', 'getConc', 'psdCaM6' )
+    addPlot( '/model/chem/psd/CaM_CaN[0]', 'getConc', 'CaM_CaN' )
+    addPlot( '/model/chem/psd/PP1_dash_active[0]', 'getConc', 'PP1_active0' )
+    addPlot( '/model/chem/psd/PP1_dash_active[6]', 'getConc', 'psdPP1_active6' )
+    addPlot( '/model/chem/psd/actCaMKII[6]', 'getConc', 'psdCaMKII6' )
+    addPlot( '/model/chem/spine/actCaMKII[6]', 'getConc', 'spineCaMKII6' )
+    addPlot( '/model/chem/psd/Ca[0]', 'getConc', 'psd0Ca' )
+    addPlot( '/model/chem/psd/Ca[6]', 'getConc', 'psd6Ca' )
+    addPlot( '/model/chem/psd/Ca[12]', 'getConc', 'psd12Ca' )
+
+    addPlot( '/model/chem/spine/Ca[0]', 'getConc', 'spine0Ca' )
+    addPlot( '/model/chem/spine/Ca[6]', 'getConc', 'spine6Ca' )
+    addPlot( '/model/chem/spine/Ca[12]', 'getConc', 'spine12Ca' )
+
+    addPlot( '/model/chem/dend/DEND/Ca[0]', 'getConc', 'dend0Ca' )
+    path = '/model/chem/dend/DEND/Ca['
+    addPlot( path + str( midSpineVoxel ) + ']', 'getConc', 'dendMidCa' )
+    addPlot( path + str( midSpineVoxel+2 ) + ']', 'getConc', 'dendMid2Ca' )
+    addPlot( path + str( midSpineVoxel+4 ) + ']', 'getConc', 'dendMid4Ca' )
+    addPlot( path + str( midSpineVoxel+6 ) + ']', 'getConc', 'dendMid6Ca' )
+    addPlot( '/model/chem/dend/DEND/Ca[144]', 'getConc', 'dend144Ca' )
+
+    #addPlot( '/n/dend/Ca', 'getConc', 'dendCa' )
+    #addPlot( '/n/dend/inact_kinase', 'getConc', 'inactDendKinase' )
+    #addPlot( '/n/psd/psdGluR', 'getN', 'psdGluR' )
+    addPlot( '/model/chem/psd/CaMKII_dash_CaM[6]', 'getConc', 'psdCaM_CaMKII6' )
+    addPlot( '/model/chem/spine/CaMKII_dash_CaM[6]', 'getConc', 'spineCaM_CaMKII6' )
+    addPlot( '/model/chem/spine/NMDAR[6]', 'getConc', 'psd_NMDAR6' )
 
 
 def testNeuroMeshMultiscale():
-	elecDt = 50e-6
-	chemDt = 1e-2
-	cplotDt = 1e-2
-	eplotDt = 1e-3
-	plotName = 'nm.plot'
-
-	makeNeuroMeshModel()
-	print("after model is completely done")
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print(i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb)
-
-	"""
-	for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if ( i[0].diffConst > 0 ):
-			grandpaname = i.parent[0].parent.name + '/'
-			paname = i.parent[0].name + '/'
-			print grandpaname + paname + i[0].name, i[0].diffConst
-	print 'Neighbors:'
-	for t in moose.element( '/model/chem/spine/ksolve/junction' ).neighbors['masterJunction']:
-		print 'masterJunction <-', t.path
-	for t in moose.wildcardFind( '/model/chem/#/ksolve' ):
-		k = moose.element( t[0] )
-		print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
-	"""
-	"""
+    elecDt = 50e-6
+    chemDt = 1e-2
+    cplotDt = 1e-2
+    eplotDt = 1e-3
+    plotName = 'nm.plot'
+
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
+
+    """
+    for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if ( i[0].diffConst > 0 ):
+            grandpaname = i.parent[0].parent.name + '/'
+            paname = i.parent[0].name + '/'
+            print grandpaname + paname + i[0].name, i[0].diffConst
+    print 'Neighbors:'
+    for t in moose.element( '/model/chem/spine/ksolve/junction' ).neighbors['masterJunction']:
+        print 'masterJunction <-', t.path
+    for t in moose.wildcardFind( '/model/chem/#/ksolve' ):
+        k = moose.element( t[0] )
+        print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
+    """
+    """
         moose.useClock( 4, '/model/chem/dend/dsolve', 'process' )
         moose.useClock( 5, '/model/chem/dend/ksolve', 'process' )
         moose.useClock( 5, '/model/chem/spine/ksolve', 'process' )
         moose.useClock( 5, '/model/chem/psd/ksolve', 'process' )
-	"""
-
-	makeChemPlots()
-	makeElecPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 4, chemDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, cplotDt )
-	moose.setClock( 8, eplotDt )
-	moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
-	moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
-	moose.useClock( 6, '/model/chem/psd/adaptCa', 'process' )
-	moose.useClock( 7, '/graphs/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#', 'process' )
-	#hsolve = moose.HSolve( '/model/elec/hsolve' )
-	#moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	#hsolve.dt = elecDt
-	#hsolve.target = '/model/elec/compt'
-	#moose.reinit()
-	moose.reinit()
-	"""
-	print 'pre'
-	eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'dend'
-	eca = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
-	for i in range( 13 ):
-		print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-
-	print 'PSD'
-	eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'spine'
-	eca = moose.vec( '/model/chem/spine/SPINE/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	"""
-
-	moose.start( 0.5 )
-	dumpPlots( plotName )
-	print('All done')
+    """
+
+    makeChemPlots()
+    makeElecPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 4, chemDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, cplotDt )
+    moose.setClock( 8, eplotDt )
+    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
+    moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
+    moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
+    moose.useClock( 6, '/model/chem/psd/adaptCa', 'process' )
+    moose.useClock( 7, '/graphs/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#', 'process' )
+    #hsolve = moose.HSolve( '/model/elec/hsolve' )
+    #moose.useClock( 1, '/model/elec/hsolve', 'process' )
+    #hsolve.dt = elecDt
+    #hsolve.target = '/model/elec/compt'
+    #moose.reinit()
+    moose.reinit()
+    """
+    print 'pre'
+    eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'dend'
+    eca = moose.vec( '/model/chem/dend/DEND/Ca' )
+    #for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
+    for i in range( 13 ):
+        print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+
+    print 'PSD'
+    eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'spine'
+    eca = moose.vec( '/model/chem/spine/SPINE/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    """
+
+    moose.start( 0.5 )
+    dumpPlots( plotName )
+    print('All done')
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # loadMulti.py ends here.
diff --git a/snippets/MULTI/midchan.py b/snippets/MULTI/midchan.py
index 46890fae..af26757d 100644
--- a/snippets/MULTI/midchan.py
+++ b/snippets/MULTI/midchan.py
@@ -40,179 +40,168 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	moose.setCwe( '/library' )
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    moose.setCwe( '/library' )
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
+    return cellId
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
-	#modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    #print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
+    #modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 def makeNeuroMeshModel():
-	diffLength = 10e-6 # Aim for 2 soma compartments.
-	elec = loadElec()
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
-
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print 'ns = ', ns, ', ndc = ', ndc
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 36 ) # 
-	assert( ndc == 278 ) # 
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print 'done setting path, numPools = ', nmdsolve.numPools
-        assert( nmdsolve.numPools == 1 )
-        assert( nmdsolve.numAllVoxels == ndc )
-        assert( nmstoich.numAllPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
-        
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print 'sdc = ', sdc
-	assert( sdc == 13 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        print 'spine num Pools = ', smstoich.numAllPools
-        assert( smstoich.numAllPools == 3 )
-        assert( smdsolve.numPools == 3 )
-        assert( smdsolve.numAllVoxels == sdc )
+    diffLength = 10e-6 # Aim for 2 soma compartments.
+    elec = loadElec()
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
+
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 36 ) # 
+    assert( ndc == 278 ) # 
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    assert( nmdsolve.numAllVoxels == ndc )
+    assert( nmstoich.numAllPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 13 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        assert( pmstoich.numAllPools == 3 )
-        assert( pmdsolve.numPools == 3 )
-        assert( pmdsolve.numAllVoxels == pdc )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        print 'PSD: numfoo = ', foo.numData
-        print 'PSD: numAllVoxels = ', pmksolve.numAllVoxels
-
-        # Put in junctions between the diffusion solvers
-        nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
-
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-        ##################################################################
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
-	adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
-	chemCa = moose.vec( '/model/chem/spine/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( adaptCa ) == sdc )
-	assert( len( chemCa ) == sdc )
-        for i in range( sdc ):
-            elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
-            #print elecCa
-	    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-	moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 1e-4	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-
-
-        moose.le( '/model/chem/dend/DEND' )
-
-
-        compts = neuroCompt.elecComptList
-        begin = neuroCompt.startVoxelInCompt
-        end = neuroCompt.endVoxelInCompt
-	aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
-	adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
-	chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( chemCa ) == ndc )
-        for i in zip( compts, adaptCa, begin, end ):
-            name = i[0].path + '/Ca_conc'
-            if ( moose.exists( name ) ):
-                elecCa = moose.element( name )
-                #print i[2], i[3], '   ', elecCa
-                #print i[1]
-                moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
-                for j in range( i[2], i[3] ):
-                    moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 20e-6	# 10 arb units to 2 uM.
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print('sdc = ', sdc)
+    assert( sdc == 13 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    print('spine num Pools = ', smstoich.numAllPools)
+    assert( smstoich.numAllPools == 3 )
+    assert( smdsolve.numPools == 3 )
+    assert( smdsolve.numAllVoxels == sdc )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 13 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    assert( pmstoich.numAllPools == 3 )
+    assert( pmdsolve.numPools == 3 )
+    assert( pmdsolve.numAllVoxels == pdc )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    print('PSD: numfoo = ', foo.numData)
+    print('PSD: numAllVoxels = ', pmksolve.numAllVoxels)
+
+    # Put in junctions between the diffusion solvers
+    nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
+
+
+    ##################################################################
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
+    adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
+    chemCa = moose.vec( '/model/chem/spine/Ca' )
+    assert( len( adaptCa ) == sdc )
+    assert( len( chemCa ) == sdc )
+    for i in range( sdc ):
+        elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
+        #print elecCa
+    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+    moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 1e-4    # 520 to 0.0052 mM
+
+
+    moose.le( '/model/chem/dend/DEND' )
+    compts = neuroCompt.elecComptList
+    begin = neuroCompt.startVoxelInCompt
+    end = neuroCompt.endVoxelInCompt
+    aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
+    adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
+    chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    assert( len( chemCa ) == ndc )
+    for i in zip( compts, adaptCa, begin, end ):
+        name = i[0].path + '/Ca_conc'
+        if ( moose.exists( name ) ):
+            elecCa = moose.element( name )
+            #print i[2], i[3], '   ', elecCa
+            #print i[1]
+            moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
+            for j in range( i[2], i[3] ):
+                moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 20e-6    # 10 arb units to 2 uM.
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print "addPlot failed: object is a Neutral: ", objpath
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print "addPlot failed: object not found: ", objpath
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def makeElecPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -225,121 +214,105 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head_14_12/NMDA_Ca_conc', 'getCa', 'elec/spine12Ca' )
 
 def makeChemPlots():
-	graphs = moose.Neutral( '/graphs' )
-	chem = moose.Neutral( '/graphs/chem' )
-	addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
-	addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
-	addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
-	addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
-	addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
-	addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
-	addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
+    graphs = moose.Neutral( '/graphs' )
+    chem = moose.Neutral( '/graphs/chem' )
+    addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
+    addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
+    addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
+    addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
+    addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
+    addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
+    addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
 
 def testNeuroMeshMultiscale():
-	elecDt = 50e-6
-	chemDt = 0.005
-	ePlotDt = 0.5e-3
-	cPlotDt = 0.005
-	plotName = 'nm.plot'
-
-	makeNeuroMeshModel()
-	print "after model is completely done"
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb
-
-	makeChemPlots()
-	makeElecPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 4, chemDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, cPlotDt )
-	moose.setClock( 8, ePlotDt )
-	moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	#moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	#moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
-	moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
-	moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
-	moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
-	moose.useClock( 7, '/graphs/chem/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#', 'process' )
-	#hsolve = moose.HSolve( '/model/elec/hsolve' )
-	#moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	#hsolve.dt = elecDt
-	#hsolve.target = '/model/elec/compt'
-	#moose.reinit()
-        moose.element( '/model/elec/soma' ).inject = 2e-10
-        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
-        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
-        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
-	moose.reinit()
-
-	moose.start( 0.25 )
-#        moose.element( '/model/elec/soma' ).inject = 0
-#	moose.start( 0.25 )
-        plt.ion()
-        fig = plt.figure( figsize=(8,8) )
-        chem = fig.add_subplot( 311 )
-        chem.set_ylim( 0, 0.002 )
-        plt.ylabel( 'Conc (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
-            line1, = chem.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        elec = fig.add_subplot( 312 )
-        plt.ylabel( 'Vm (V)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = elec.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        lenplot = fig.add_subplot( 313 )
-        plt.ylabel( 'Ca (mM )' )
-        plt.xlabel( 'Voxel#)' )
-
-	spineCa = moose.vec( '/model/chem/spine/Ca' )
-	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-        line1, = lenplot.plot( range( len( spineCa ) ), spineCa.conc, label='spine' )
-        line2, = lenplot.plot( range( len( dendCa ) ), dendCa.conc, label='dend' )
-
-        ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConc]') ]
-        line3, = lenplot.plot( range( len( ca ) ), ca, label='elec' )
-
-	spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
-        line4, = lenplot.plot( range( len( spineCaM ) ), spineCaM.conc, label='spineCaM' )
-	psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
-        line5, = lenplot.plot( range( len( psdCaM ) ), psdCaM.conc, label='psdCaM' )
-        plt.legend()
-
-
-        fig.canvas.draw()
-        raw_input()
-                
-        '''
-        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
-            t = numpy.arange( 0, x.vector.size, 1 )
-            pylab.plot( t, x.vector, label=x.name )
-        pylab.legend()
-        pylab.show()
-        '''
-
-	print 'All done'
+    elecDt = 50e-6
+    chemDt = 0.005
+    ePlotDt = 0.5e-3
+    cPlotDt = 0.005
+    plotName = 'nm.plot'
+
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
+
+    makeChemPlots()
+    makeElecPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 4, chemDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, cPlotDt )
+    moose.setClock( 8, ePlotDt )
+    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
+    moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    #moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
+    #moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
+    moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
+    moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
+    moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
+    moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
+    moose.useClock( 7, '/graphs/chem/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#', 'process' )
+    moose.element( '/model/elec/soma' ).inject = 2e-10
+    moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
+    moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
+    moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
+    moose.reinit()
+
+    moose.start( 0.25 )
+    plt.ion()
+    fig = plt.figure( figsize=(8,8) )
+    chem = fig.add_subplot( 311 )
+    chem.set_ylim( 0, 0.002 )
+    plt.ylabel( 'Conc (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
+        line1, = chem.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    elec = fig.add_subplot( 312 )
+    plt.ylabel( 'Vm (V)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = elec.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    lenplot = fig.add_subplot( 313 )
+    plt.ylabel( 'Ca (mM )' )
+    plt.xlabel( 'Voxel#)' )
+
+    spineCa = moose.vec( '/model/chem/spine/Ca' )
+    dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    line1, = lenplot.plot( list(range( len( spineCa ))), spineCa.conc, label='spine' )
+    line2, = lenplot.plot( list(range( len( dendCa ))), dendCa.conc, label='dend' )
+
+    ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConc]') ]
+    line3, = lenplot.plot( list(range( len( ca ))), ca, label='elec' )
+
+    spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
+    line4, = lenplot.plot( list(range( len( spineCaM ))), spineCaM.conc, label='spineCaM' )
+    psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
+    line5, = lenplot.plot( list(range( len( psdCaM ))), psdCaM.conc, label='psdCaM' )
+    plt.legend()
+
+
+    fig.canvas.draw()
+    eval(input())
+    print('All done')
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # minimal.py ends here.
diff --git a/snippets/MULTI/minchan.py b/snippets/MULTI/minchan.py
index 0f654f95..e2c30aff 100644
--- a/snippets/MULTI/minchan.py
+++ b/snippets/MULTI/minchan.py
@@ -36,157 +36,150 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	moose.setCwe( '/library' )
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'mincell2.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    moose.setCwe( '/library' )
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'mincell2.p', '/model/elec', "Neutral" )
+    return cellId
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    #print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 
 def makeNeuroMeshModel():
-	diffLength = 6e-6 # Aim for 2 soma compartments.
-	elec = loadElec()
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
+    diffLength = 6e-6 # Aim for 2 soma compartments.
+    elec = loadElec()
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
 
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print 'ns = ', ns, ', ndc = ', ndc
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 1 ) # soma/dend only
-	assert( ndc == 2 ) # split into 2.
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print 'done setting path, numPools = ', nmdsolve.numPools
-        assert( nmdsolve.numPools == 1 )
-        assert( nmdsolve.numAllVoxels == 2 )
-        assert( nmstoich.numAllPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 1 ) # soma/dend only
+    assert( ndc == 2 ) # split into 2.
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    assert( nmdsolve.numAllVoxels == 2 )
+    assert( nmstoich.numAllPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print 'sdc = ', sdc
-	assert( sdc == 1 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        assert( smstoich.numAllPools == 3 )
-        assert( smdsolve.numPools == 3 )
-        assert( smdsolve.numAllVoxels == 1 )
-        
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 1 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        assert( pmstoich.numAllPools == 3 )
-        assert( pmdsolve.numPools == 3 )
-        assert( pmdsolve.numAllVoxels == 1 )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        print 'PSD: numfoo = ', foo.numData
-        print 'PSD: numAllVoxels = ', pmksolve.numAllVoxels
-
-        # Put in junctions between the diffusion solvers
-        nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print(('sdc = ', sdc))
+    assert( sdc == 1 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    assert( smstoich.numAllPools == 3 )
+    assert( smdsolve.numPools == 3 )
+    assert( smdsolve.numAllVoxels == 1 )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 1 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    assert( pmstoich.numAllPools == 3 )
+    assert( pmdsolve.numPools == 3 )
+    assert( pmdsolve.numAllVoxels == 1 )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    print(('PSD: numfoo = ', foo.numData))
+    print(('PSD: numAllVoxels = ', pmksolve.numAllVoxels))
 
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
+    # Put in junctions between the diffusion solvers
+    nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
 
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', ndc )
-	adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
-	chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-	print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( adaptCa ) == ndc )
-	assert( len( chemCa ) == ndc )
-	path = '/model/elec/soma/Ca_conc'
-	elecCa = moose.element( path )
-        print "=========="
-        print elecCa
-        print adaptCa
-        print chemCa
-	moose.connect( elecCa, 'concOut', adaptCa[0], 'input', 'Single' )
-	moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 1e-3	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-	#print adaptCa.scale
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', ndc )
+    adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
+    chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    print(('aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )))
+    assert( len( adaptCa ) == ndc )
+    assert( len( chemCa ) == ndc )
+    path = '/model/elec/soma/Ca_conc'
+    elecCa = moose.element( path )
+    print("==========")
+    print(elecCa)
+    print(adaptCa)
+    print(chemCa)
+    moose.connect( elecCa, 'concOut', adaptCa[0], 'input', 'Single' )
+    moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 1e-3    # 520 to 0.0052 mM
+    #print adaptCa.outputOffset
+    #print adaptCa.scale
 
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print "addPlot failed: object is a Neutral: ", objpath
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print "addPlot failed: object not found: ", objpath
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def makeElecPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -196,138 +189,128 @@ def makeElecPlots():
     addPlot( '/model/elec/soma/Ca_conc', 'getCa', 'elec/somaCa' )
 
 def makeChemPlots():
-	graphs = moose.Neutral( '/graphs' )
-	chem = moose.Neutral( '/graphs/chem' )
-	addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
-	addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
-	addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
-	addPlot( '/model/chem/spine/Ca', 'getConc', 'chem/spineCa' )
-	addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
+    graphs = moose.Neutral( '/graphs' )
+    chem = moose.Neutral( '/graphs/chem' )
+    addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
+    addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
+    addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
+    addPlot( '/model/chem/spine/Ca', 'getConc', 'chem/spineCa' )
+    addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
 
 def testNeuroMeshMultiscale():
-	elecDt = 50e-6
-	chemDt = 0.01
-	ePlotDt = 0.5e-3
-	cPlotDt = 0.01
-	plotName = 'nm.plot'
-
-	makeNeuroMeshModel()
-	print "after model is completely done"
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb
-
-	"""
-	for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if ( i[0].diffConst > 0 ):
-			grandpaname = i.parent[0].parent.name + '/'
-			paname = i.parent[0].name + '/'
-			print grandpaname + paname + i[0].name, i[0].diffConst
-	print 'Neighbors:'
-	for t in moose.element( '/model/chem/spine/ksolve/junction' ).neighbors['masterJunction']:
-		print 'masterJunction <-', t.path
-	for t in moose.wildcardFind( '/model/chem/#/ksolve' ):
-		k = moose.element( t[0] )
-		print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
-	"""
-        '''
-        moose.useClock( 4, '/model/chem/dend/dsolve', 'process' )
-        moose.useClock( 5, '/model/chem/dend/ksolve', 'process' )
-        moose.useClock( 5, '/model/chem/spine/ksolve', 'process' )
-        moose.useClock( 5, '/model/chem/psd/ksolve', 'process' )
-        '''
+    elecDt = 50e-6
+    chemDt = 0.01
+    ePlotDt = 0.5e-3
+    cPlotDt = 0.01
+    plotName = 'nm.plot'
 
-	makeChemPlots()
-	makeElecPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 4, chemDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, cPlotDt )
-	moose.setClock( 8, ePlotDt )
-	moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	#moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	#moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
-	moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
-	moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
-	moose.useClock( 7, '/graphs/chem/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#', 'process' )
-	#hsolve = moose.HSolve( '/model/elec/hsolve' )
-	#moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	#hsolve.dt = elecDt
-	#hsolve.target = '/model/elec/compt'
-	#moose.reinit()
-        moose.element( '/model/elec/spine_head' ).inject = 5e-12
-        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
-        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
-        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
-	moose.reinit()
-	"""
-	print 'pre'
-	eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'dend'
-	eca = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
-	for i in range( 13 ):
-		print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
 
-	print 'PSD'
-	eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'spine'
-	eca = moose.vec( '/model/chem/spine/SPINE/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	"""
+    """
+    for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if ( i[0].diffConst > 0 ):
+            grandpaname = i.parent[0].parent.name + '/'
+            paname = i.parent[0].name + '/'
+            print grandpaname + paname + i[0].name, i[0].diffConst
+    print 'Neighbors:'
+    for t in moose.element( '/model/chem/spine/ksolve/junction' ).neighbors['masterJunction']:
+        print 'masterJunction <-', t.path
+    for t in moose.wildcardFind( '/model/chem/#/ksolve' ):
+        k = moose.element( t[0] )
+        print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
+    """
+    '''
+    moose.useClock( 4, '/model/chem/dend/dsolve', 'process' )
+    moose.useClock( 5, '/model/chem/dend/ksolve', 'process' )
+    moose.useClock( 5, '/model/chem/spine/ksolve', 'process' )
+    moose.useClock( 5, '/model/chem/psd/ksolve', 'process' )
+    '''
 
-	moose.start( 0.5 )
-        plt.ion()
-        fig = plt.figure( figsize=(8,8) )
-        chem = fig.add_subplot( 211 )
-        chem.set_ylim( 0, 0.004 )
-        plt.ylabel( 'Conc (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
-            line1, = chem.plot( pos, x.vector, label=x.name )
-        plt.legend()
+    makeChemPlots()
+    makeElecPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 4, chemDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, cPlotDt )
+    moose.setClock( 8, ePlotDt )
+    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
+    moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    #moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
+    #moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
+    moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
+    moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
+    moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
+    moose.useClock( 7, '/graphs/chem/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#', 'process' )
+    #hsolve = moose.HSolve( '/model/elec/hsolve' )
+    #moose.useClock( 1, '/model/elec/hsolve', 'process' )
+    #hsolve.dt = elecDt
+    #hsolve.target = '/model/elec/compt'
+    #moose.reinit()
+    moose.element( '/model/elec/spine_head' ).inject = 5e-12
+    moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
+    moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
+    moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
+    moose.reinit()
+    """
+    print 'pre'
+    eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'dend'
+    eca = moose.vec( '/model/chem/dend/DEND/Ca' )
+    #for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
+    for i in range( 13 ):
+        print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
 
-        elec = fig.add_subplot( 212 )
-        plt.ylabel( 'Vm (V)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = elec.plot( pos, x.vector, label=x.name )
-        plt.legend()
+    print 'PSD'
+    eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'spine'
+    eca = moose.vec( '/model/chem/spine/SPINE/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    """
 
-        fig.canvas.draw()
-        raw_input()
-                
-        '''
-        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
-            t = numpy.arange( 0, x.vector.size, 1 )
-            pylab.plot( t, x.vector, label=x.name )
-        pylab.legend()
-        pylab.show()
-        '''
+    moose.start( 0.5 )
+    plt.ion()
+    fig = plt.figure( figsize=(8,8) )
+    chem = fig.add_subplot( 211 )
+    chem.set_ylim( 0, 0.004 )
+    plt.ylabel( 'Conc (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
+        line1, = chem.plot( pos, x.vector, label=x.name )
+    plt.legend()
 
-        pylab.show()
-	print 'All done'
+    elec = fig.add_subplot( 212 )
+    plt.ylabel( 'Vm (V)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = elec.plot( pos, x.vector, label=x.name )
+    plt.legend()
+    fig.canvas.draw()
+    eval(input())
+    pylab.show()
+    print('All done')
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # minimal.py ends here.
diff --git a/snippets/MULTI/minimal.py b/snippets/MULTI/minimal.py
index 5035acdf..b5c018da 100644
--- a/snippets/MULTI/minimal.py
+++ b/snippets/MULTI/minimal.py
@@ -36,138 +36,138 @@ import moose
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'mincell.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'mincell.p', '/model/elec', "Neutral" )
+    return cellId
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    #print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 
 def makeNeuroMeshModel():
-	diffLength = 20e-6 # Aim for just 3 compts.
-	elec = loadElec()
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
+    diffLength = 20e-6 # Aim for just 3 compts.
+    elec = loadElec()
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
 
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print 'ns = ', ns, ', ndc = ', ndc
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 1 ) # dend, 5x (shaft+head)
-	assert( ndc == 1 )
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print 'done setting path, numPools = ', nmdsolve.numPools
-        assert( nmdsolve.numPools == 1 )
-        assert( nmdsolve.numAllVoxels == 1 )
-        assert( nmstoich.numAllPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 1 ) # dend, 5x (shaft+head)
+    assert( ndc == 1 )
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    assert( nmdsolve.numAllVoxels == 1 )
+    assert( nmstoich.numAllPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print 'sdc = ', sdc
-	assert( sdc == 1 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        assert( smstoich.numAllPools == 3 )
-        assert( smdsolve.numPools == 3 )
-        assert( smdsolve.numAllVoxels == 1 )
-        
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 1 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        assert( pmstoich.numAllPools == 3 )
-        assert( pmdsolve.numPools == 3 )
-        assert( pmdsolve.numAllVoxels == 1 )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        print 'PSD: numfoo = ', foo.numData
-        print 'PSD: numAllVoxels = ', pmksolve.numAllVoxels
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print(('sdc = ', sdc))
+    assert( sdc == 1 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    assert( smstoich.numAllPools == 3 )
+    assert( smdsolve.numPools == 3 )
+    assert( smdsolve.numAllVoxels == 1 )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 1 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    assert( pmstoich.numAllPools == 3 )
+    assert( pmdsolve.numPools == 3 )
+    assert( pmdsolve.numAllVoxels == 1 )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    print(('PSD: numfoo = ', foo.numData))
+    print(('PSD: numAllVoxels = ', pmksolve.numAllVoxels))
 
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
+    """
+    CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
+    print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
+    CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
+    print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
+    """
 
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/psd/adaptCa', pdc )
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/psd/adaptCa', pdc )
 
-	adaptCa = moose.vec( '/model/chem/psd/adaptCa' )
-	chemCa = moose.vec( '/model/chem/psd/Ca' )
-	print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData
-	assert( len( adaptCa ) == pdc )
-	assert( len( chemCa ) == pdc )
-	path = '/model/elec/spine_head'
-	elecCa = moose.element( path )
-	moose.connect( elecCa, 'VmOut', adaptCa[0], 'input', 'Single' )
-	#moose.connect( adaptCa, 'outputSrc', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 1e-5	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-	#print adaptCa.scale
+    adaptCa = moose.vec( '/model/chem/psd/adaptCa' )
+    chemCa = moose.vec( '/model/chem/psd/Ca' )
+    print(('aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData))
+    assert( len( adaptCa ) == pdc )
+    assert( len( chemCa ) == pdc )
+    path = '/model/elec/spine_head'
+    elecCa = moose.element( path )
+    moose.connect( elecCa, 'VmOut', adaptCa[0], 'input', 'Single' )
+    #moose.connect( adaptCa, 'outputSrc', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 1e-5    # 520 to 0.0052 mM
+    #print adaptCa.outputOffset
+    #print adaptCa.scale
 
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print "addPlot failed: object is a Neutral: ", objpath
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print "addPlot failed: object not found: ", objpath
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def makeElecPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -176,135 +176,127 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head', 'getVm', 'elec/spineVm' )
 
 def makeChemPlots():
-	graphs = moose.Neutral( '/graphs' )
-	chem = moose.Neutral( '/graphs/chem' )
-	addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
-	addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
-	addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
-	addPlot( '/model/chem/spine/Ca', 'getConc', 'chem/spineCa' )
-	addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
+    graphs = moose.Neutral( '/graphs' )
+    chem = moose.Neutral( '/graphs/chem' )
+    addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
+    addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
+    addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
+    addPlot( '/model/chem/spine/Ca', 'getConc', 'chem/spineCa' )
+    addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
 
 def testNeuroMeshMultiscale():
-	elecDt = 50e-6
-	chemDt = 1e-1
-	plotDt = 1e-1
-	plotName = 'nm.plot'
+    elecDt = 50e-6
+    chemDt = 1e-1
+    plotDt = 1e-1
+    plotName = 'nm.plot'
 
-	makeNeuroMeshModel()
-	print "after model is completely done"
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
 
-	"""
-	for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if ( i[0].diffConst > 0 ):
-			grandpaname = i.parent[0].parent.name + '/'
-			paname = i.parent[0].name + '/'
-			print grandpaname + paname + i[0].name, i[0].diffConst
-	print 'Neighbors:'
-	for t in moose.element( '/model/chem/spine/ksolve/junction' ).neighbors['masterJunction']:
-		print 'masterJunction <-', t.path
-	for t in moose.wildcardFind( '/model/chem/#/ksolve' ):
-		k = moose.element( t[0] )
-		print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
-	"""
-        '''
-        moose.useClock( 4, '/model/chem/dend/dsolve', 'process' )
-        moose.useClock( 5, '/model/chem/dend/ksolve', 'process' )
-        moose.useClock( 5, '/model/chem/spine/ksolve', 'process' )
-        moose.useClock( 5, '/model/chem/psd/ksolve', 'process' )
-        '''
+    """
+    for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if ( i[0].diffConst > 0 ):
+            grandpaname = i.parent[0].parent.name + '/'
+            paname = i.parent[0].name + '/'
+            print grandpaname + paname + i[0].name, i[0].diffConst
+    print 'Neighbors:'
+    for t in moose.element( '/model/chem/spine/ksolve/junction' ).neighbors['masterJunction']:
+        print 'masterJunction <-', t.path
+    for t in moose.wildcardFind( '/model/chem/#/ksolve' ):
+        k = moose.element( t[0] )
+        print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
+    """
 
-	makeChemPlots()
-	makeElecPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 4, chemDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, plotDt )
-	moose.setClock( 8, plotDt )
-	moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	#moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	#moose.useClock( 6, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 7, '/graphs/chem/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#', 'process' )
-	moose.useClock( 5, '/model/chem/#/dsolve', 'process' )
-	moose.useClock( 6, '/model/chem/#/ksolve', 'process' )
-	#hsolve = moose.HSolve( '/model/elec/hsolve' )
-	#moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	#hsolve.dt = elecDt
-	#hsolve.target = '/model/elec/compt'
-	#moose.reinit()
-        moose.element( '/model/elec/spine_head' ).inject = 1e-9
-        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
-        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
-        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
-	moose.reinit()
-	"""
-	print 'pre'
-	eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'dend'
-	eca = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
-	for i in range( 13 ):
-		print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    '''
+    moose.useClock( 4, '/model/chem/dend/dsolve', 'process' )
+    moose.useClock( 5, '/model/chem/dend/ksolve', 'process' )
+    moose.useClock( 5, '/model/chem/spine/ksolve', 'process' )
+    moose.useClock( 5, '/model/chem/psd/ksolve', 'process' )
+    '''
 
-	print 'PSD'
-	eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'spine'
-	eca = moose.vec( '/model/chem/spine/SPINE/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	"""
+    makeChemPlots()
+    makeElecPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 4, chemDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, plotDt )
+    moose.setClock( 8, plotDt )
+    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
+    moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    #moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
+    #moose.useClock( 6, '/model/chem/##[ISA=Adaptor]', 'process' )
+    moose.useClock( 7, '/graphs/chem/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#', 'process' )
+    moose.useClock( 5, '/model/chem/#/dsolve', 'process' )
+    moose.useClock( 6, '/model/chem/#/ksolve', 'process' )
+    #hsolve = moose.HSolve( '/model/elec/hsolve' )
+    #moose.useClock( 1, '/model/elec/hsolve', 'process' )
+    #hsolve.dt = elecDt
+    #hsolve.target = '/model/elec/compt'
+    #moose.reinit()
+    moose.element( '/model/elec/spine_head' ).inject = 1e-9
+    moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
+    moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
+    moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
+    moose.reinit()
+    """
+    print 'pre'
+    eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'dend'
+    eca = moose.vec( '/model/chem/dend/DEND/Ca' )
+    #for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
+    for i in range( 13 ):
+        print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
 
-	moose.start( 0.5 )
-        plt.ion()
-        fig = plt.figure( figsize=(8,8) )
-        chem = fig.add_subplot( 211 )
-        chem.set_ylim( 0, 0.004 )
-        plt.ylabel( 'Conc (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
-            pos = numpy.arange( 0, len(x.vector), 1 )
-            line1, = chem.plot( pos, x.vector, label=x.name )
-        plt.legend()
+    print 'PSD'
+    eca = moose.vec( '/model/chem/psd/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'spine'
+    eca = moose.vec( '/model/chem/spine/SPINE/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    """
 
-        elec = fig.add_subplot( 212 )
-        plt.ylabel( 'Vm (V)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
-            pos = numpy.arange( 0, len(x.vector), 1 )
-            line1, = elec.plot( pos, x.vector, label=x.name )
-        plt.legend()
+    moose.start( 0.5 )
+    plt.ion()
+    fig = plt.figure( figsize=(8,8) )
+    chem = fig.add_subplot( 211 )
+    chem.set_ylim( 0, 0.004 )
+    plt.ylabel( 'Conc (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
+        pos = numpy.arange( 0, len(x.vector), 1 )
+        line1, = chem.plot( pos, x.vector, label=x.name )
+    plt.legend()
 
-        fig.canvas.draw()
-        raw_input()
-                
-        '''
-        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
-            t = numpy.arange( 0, x.vector.size, 1 )
-            pylab.plot( t, x.vector, label=x.name )
-        pylab.legend()
-        pylab.show()
-        '''
+    elec = fig.add_subplot( 212 )
+    plt.ylabel( 'Vm (V)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
+        pos = numpy.arange( 0, len(x.vector), 1 )
+        line1, = elec.plot( pos, x.vector, label=x.name )
+    plt.legend()
 
-	print 'All done'
+    fig.canvas.draw()
+    eval(input())
+    print('All done')
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # minimal.py ends here.
diff --git a/snippets/MULTI/multi1.py b/snippets/MULTI/multi1.py
index f4fc54ef..4f60c8d7 100644
--- a/snippets/MULTI/multi1.py
+++ b/snippets/MULTI/multi1.py
@@ -29,7 +29,6 @@
 # Code:
 
 import sys
-sys.path.append('../../python')
 import os
 os.environ['NUMPTHREADS'] = '1'
 import math
@@ -41,179 +40,165 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	moose.setCwe( '/library' )
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    moose.setCwe( '/library' )
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
+    return cellId
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
-	#modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    #print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
+    #modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 def makeNeuroMeshModel():
-	diffLength = 10e-6 # Aim for 2 soma compartments.
-	elec = loadElec()
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
-
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print 'ns = ', ns, ', ndc = ', ndc
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 36 ) # 
-	assert( ndc == 278 ) # 
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print 'done setting path, numPools = ', nmdsolve.numPools
-        assert( nmdsolve.numPools == 1 )
-        assert( nmdsolve.numAllVoxels == ndc )
-        assert( nmstoich.numAllPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
+    diffLength = 10e-6 # Aim for 2 soma compartments.
+    elec = loadElec()
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
+
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 36 ) # 
+    assert( ndc == 278 ) # 
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    assert( nmdsolve.numAllVoxels == ndc )
+    assert( nmstoich.numAllPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print 'sdc = ', sdc
-	assert( sdc == 13 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        print 'spine num Pools = ', smstoich.numAllPools
-        assert( smstoich.numAllPools == 3 )
-        assert( smdsolve.numPools == 3 )
-        assert( smdsolve.numAllVoxels == sdc )
-        
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 13 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        assert( pmstoich.numAllPools == 3 )
-        assert( pmdsolve.numPools == 3 )
-        assert( pmdsolve.numAllVoxels == pdc )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        print 'PSD: numfoo = ', foo.numData
-        print 'PSD: numAllVoxels = ', pmksolve.numAllVoxels
-
-        # Put in junctions between the diffusion solvers
-        nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
-
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-        ##################################################################
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
-	adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
-	chemCa = moose.vec( '/model/chem/spine/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( adaptCa ) == sdc )
-	assert( len( chemCa ) == sdc )
-        for i in range( sdc ):
-            elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
-            #print elecCa
-	    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-	moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 1e-4	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-
-
-        moose.le( '/model/chem/dend/DEND' )
-
-
-        compts = neuroCompt.elecComptList
-        begin = neuroCompt.startVoxelInCompt
-        end = neuroCompt.endVoxelInCompt
-	aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
-	adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
-	chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( chemCa ) == ndc )
-        for i in zip( compts, adaptCa, begin, end ):
-            name = i[0].path + '/Ca_conc'
-            if ( moose.exists( name ) ):
-                elecCa = moose.element( name )
-                #print i[2], i[3], '   ', elecCa
-                #print i[1]
-                moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
-                for j in range( i[2], i[3] ):
-                    moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 20e-6	# 10 arb units to 2 uM.
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print(('sdc = ', sdc))
+    assert( sdc == 13 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    print(('spine num Pools = ', smstoich.numAllPools))
+    assert( smstoich.numAllPools == 3 )
+    assert( smdsolve.numPools == 3 )
+    assert( smdsolve.numAllVoxels == sdc )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 13 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    assert( pmstoich.numAllPools == 3 )
+    assert( pmdsolve.numPools == 3 )
+    assert( pmdsolve.numAllVoxels == pdc )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    print(('PSD: numfoo = ', foo.numData))
+    print(('PSD: numAllVoxels = ', pmksolve.numAllVoxels))
+
+    # Put in junctions between the diffusion solvers
+    nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
+
+    ##################################################################
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
+    adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
+    chemCa = moose.vec( '/model/chem/spine/Ca' )
+    assert( len( adaptCa ) == sdc )
+    assert( len( chemCa ) == sdc )
+    for i in range( sdc ):
+        elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
+    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+    moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 1e-4    # 520 to 0.0052 mM
+
+    moose.le( '/model/chem/dend/DEND' )
+    compts = neuroCompt.elecComptList
+    begin = neuroCompt.startVoxelInCompt
+    end = neuroCompt.endVoxelInCompt
+    aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
+    adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
+    chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    assert( len( chemCa ) == ndc )
+    for i in zip( compts, adaptCa, begin, end ):
+        name = i[0].path + '/Ca_conc'
+        if ( moose.exists( name ) ):
+            elecCa = moose.element( name )
+            #print i[2], i[3], '   ', elecCa
+            #print i[1]
+            moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
+            for j in range( i[2], i[3] ):
+                moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 20e-6    # 10 arb units to 2 uM.
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print "addPlot failed: object is a Neutral: ", objpath
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print "addPlot failed: object not found: ", objpath
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def makeCaPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -230,68 +215,68 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head_14_4', 'getVm', 'elec/spineVm' )
 
 def makeChemPlots():
-	graphs = moose.Neutral( '/graphs' )
-	chem = moose.Neutral( '/graphs/chem' )
-	addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
-	addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
-	addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
-	addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
-	addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
-	addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
-	addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
+    graphs = moose.Neutral( '/graphs' )
+    chem = moose.Neutral( '/graphs/chem' )
+    addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
+    addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
+    addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
+    addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
+    addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
+    addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
+    addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
 
 def makeGraphics():
-        plt.ion()
-        fig = plt.figure( figsize=(10,16) )
-        chem = fig.add_subplot( 411 )
-        chem.set_ylim( 0, 0.006 )
-        plt.ylabel( 'Conc (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        plt.legend()
-
-        elec = fig.add_subplot( 412 )
-        plt.ylabel( 'Vm (V)' )
-        plt.xlabel( 'time (seconds)' )
-        plt.legend()
-
-        ca = fig.add_subplot( 413 )
-        plt.ylabel( '[Ca] (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        plt.legend()
-
-        lenplot = fig.add_subplot( 414 )
-        plt.ylabel( 'Ca (mM )' )
-        plt.xlabel( 'Voxel#)' )
-        plt.legend()
-	spineCa = moose.vec( '/model/chem/spine/Ca' )
-	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-        line1, = lenplot.plot( range( len( spineCa ) ), spineCa.conc, label='spine' )
-        line2, = lenplot.plot( range( len( dendCa ) ), dendCa.conc, label='dend' )
-
-        Ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
-        line3, = lenplot.plot( range( len( Ca ) ), Ca, label='elec' )
-
-	spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
-        line4, = lenplot.plot( range( len( spineCaM ) ), spineCaM.conc, label='spineCaM' )
-	psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
-        line5, = lenplot.plot( range( len( psdCaM ) ), psdCaM.conc, label='psdCaM' )
-        lenplot.set_ylim( 0, 0.01 )
-        fig.canvas.draw()
-        return ( chem, elec, ca, lenplot, fig, line1, line2, line3, line4, line5 )
+    plt.ion()
+    fig = plt.figure( figsize=(10,16) )
+    chem = fig.add_subplot( 411 )
+    chem.set_ylim( 0, 0.006 )
+    plt.ylabel( 'Conc (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    plt.legend()
+
+    elec = fig.add_subplot( 412 )
+    plt.ylabel( 'Vm (V)' )
+    plt.xlabel( 'time (seconds)' )
+    plt.legend()
+
+    ca = fig.add_subplot( 413 )
+    plt.ylabel( '[Ca] (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    plt.legend()
+
+    lenplot = fig.add_subplot( 414 )
+    plt.ylabel( 'Ca (mM )' )
+    plt.xlabel( 'Voxel#)' )
+    plt.legend()
+    spineCa = moose.vec( '/model/chem/spine/Ca' )
+    dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    line1, = lenplot.plot( list(range( len( spineCa ))), spineCa.conc, label='spine' )
+    line2, = lenplot.plot( list(range( len( dendCa ))), dendCa.conc, label='dend' )
+
+    Ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
+    line3, = lenplot.plot( list(range( len( Ca ))), Ca, label='elec' )
+
+    spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
+    line4, = lenplot.plot( list(range( len( spineCaM ))), spineCaM.conc, label='spineCaM' )
+    psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
+    line5, = lenplot.plot( list(range( len( psdCaM ))), psdCaM.conc, label='psdCaM' )
+    lenplot.set_ylim( 0, 0.01 )
+    fig.canvas.draw()
+    return ( chem, elec, ca, lenplot, fig, line1, line2, line3, line4, line5 )
 
 def updateGraphics( plotlist ):
-	spineCa = moose.vec( '/model/chem/spine/Ca' )
-	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-        plotlist[5].set_ydata( spineCa.conc )
-        plotlist[6].set_ydata( dendCa.conc )
-
-        ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
-        plotlist[7].set_ydata( ca )
-	spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
-        plotlist[8].set_ydata( spineCaM.conc )
-	psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
-        plotlist[9].set_ydata( psdCaM.conc )
-        plotlist[4].canvas.draw()
+    spineCa = moose.vec( '/model/chem/spine/Ca' )
+    dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    plotlist[5].set_ydata( spineCa.conc )
+    plotlist[6].set_ydata( dendCa.conc )
+
+    ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
+    plotlist[7].set_ydata( ca )
+    spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
+    plotlist[8].set_ydata( spineCaM.conc )
+    psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
+    plotlist[9].set_ydata( psdCaM.conc )
+    plotlist[4].canvas.draw()
 
 def finalizeGraphics( plotlist, cPlotDt, ePlotDt ):
         for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
@@ -306,59 +291,49 @@ def finalizeGraphics( plotlist, cPlotDt, ePlotDt ):
             pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
             line1, = plotlist[2].plot( pos, x.vector, label=x.name )
         plotlist[4].canvas.draw()
-        raw_input()
+        eval(input())
 
 def testNeuroMeshMultiscale():
-        runtime = 0.5
-	#elecDt = 0.2e-6
-	elecDt = 10e-6
-	chemDt = 0.0025
-	ePlotDt = 0.5e-3
-	cPlotDt = 0.0025
-	plotName = 'nm.plot'
-
-	makeNeuroMeshModel()
-	print "after model is completely done"
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb
-
-	makeChemPlots()
-	makeElecPlots()
-	makeCaPlots()
-        for i in range (10):
-	    moose.setClock( i, elecDt )
-        for i in range ( 10, 20 ):
-	    moose.setClock( i, chemDt )
-	moose.setClock( 8, ePlotDt )
-	moose.setClock( 18, cPlotDt )
-	moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
-	moose.useClock( 18, '/graphs/chem/#', 'process' )
-	hsolve = moose.HSolve( '/model/elec/hsolve' )
-	hsolve.dt = elecDt
-	hsolve.target = '/model/elec/compt'
-        plotlist = makeGraphics()
-	moose.reinit()
-        moose.element( '/model/elec/soma' ).inject = 2e-10
-        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
-        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
-        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
-	moose.reinit()
-
-        numDivs = 200
-        partialRuntime = runtime / numDivs
-        for i in range( numDivs ):
-	    moose.start( partialRuntime )
-            updateGraphics( plotlist )
-#        moose.element( '/model/elec/soma' ).inject = 0
-#	moose.start( 0.25 )
-        finalizeGraphics( plotlist, cPlotDt, ePlotDt )
+    runtime = 0.5
+    #elecDt = 0.2e-6
+    elecDt = 10e-6
+    chemDt = 0.0025
+    ePlotDt = 0.5e-3
+    cPlotDt = 0.0025
+    plotName = 'nm.plot'
+
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
+
+    makeChemPlots()
+    makeElecPlots()
+    makeCaPlots()
+    hsolve = moose.HSolve( '/model/elec/hsolve' )
+    hsolve.dt = elecDt
+    hsolve.target = '/model/elec/compt'
+    plotlist = makeGraphics()
+    moose.reinit()
+    moose.element( '/model/elec/soma' ).inject = 2e-10
+    moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
+    moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
+    moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
+    moose.reinit()
+
+    numDivs = 200
+    partialRuntime = runtime / numDivs
+    for i in range( numDivs ):
+        moose.start( partialRuntime )
+    updateGraphics( plotlist )
+    finalizeGraphics( plotlist, cPlotDt, ePlotDt )
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # minimal.py ends here.
diff --git a/snippets/MULTI/multi1_ee.py b/snippets/MULTI/multi1_ee.py
index 3f3dc43d..e37a2e17 100644
--- a/snippets/MULTI/multi1_ee.py
+++ b/snippets/MULTI/multi1_ee.py
@@ -29,9 +29,7 @@
 # Code:
 
 import sys
-sys.path.append('../../python')
 import os
-os.environ['NUMPTHREADS'] = '1'
 import math
 import numpy
 import matplotlib.pyplot as plt
@@ -41,179 +39,161 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	moose.setCwe( '/library' )
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    moose.setCwe( '/library' )
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
+    return cellId
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
-	#modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    modelId = moose.loadModel( 'minimal.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 def makeNeuroMeshModel():
-	diffLength = 10e-6 # Aim for 2 soma compartments.
-	elec = loadElec()
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
-
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print 'ns = ', ns, ', ndc = ', ndc
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 36 ) # 
-	assert( ndc == 278 ) # 
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print 'done setting path, numPools = ', nmdsolve.numPools
-        assert( nmdsolve.numPools == 1 )
-        assert( nmdsolve.numAllVoxels == ndc )
-        assert( nmstoich.numAllPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
-        
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print 'sdc = ', sdc
-	assert( sdc == 13 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        print 'spine num Pools = ', smstoich.numAllPools
-        assert( smstoich.numAllPools == 3 )
-        assert( smdsolve.numPools == 3 )
-        assert( smdsolve.numAllVoxels == sdc )
+    diffLength = 10e-6 # Aim for 2 soma compartments.
+    elec = loadElec()
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
+
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 36 ) # 
+    assert( ndc == 278 ) # 
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    assert( nmdsolve.numAllVoxels == ndc )
+    assert( nmstoich.numAllPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 13 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        assert( pmstoich.numAllPools == 3 )
-        assert( pmdsolve.numPools == 3 )
-        assert( pmdsolve.numAllVoxels == pdc )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        print 'PSD: numfoo = ', foo.numData
-        print 'PSD: numAllVoxels = ', pmksolve.numAllVoxels
-
-        # Put in junctions between the diffusion solvers
-        nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
-
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-        ##################################################################
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
-	adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
-	chemCa = moose.vec( '/model/chem/spine/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( adaptCa ) == sdc )
-	assert( len( chemCa ) == sdc )
-        for i in range( sdc ):
-            elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
-            #print elecCa
-	    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-	moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 1e-4	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-
-
-        moose.le( '/model/chem/dend/DEND' )
-
-
-        compts = neuroCompt.elecComptList
-        begin = neuroCompt.startVoxelInCompt
-        end = neuroCompt.endVoxelInCompt
-	aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
-	adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
-	chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( chemCa ) == ndc )
-        for i in zip( compts, adaptCa, begin, end ):
-            name = i[0].path + '/Ca_conc'
-            if ( moose.exists( name ) ):
-                elecCa = moose.element( name )
-                #print i[2], i[3], '   ', elecCa
-                #print i[1]
-                moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
-                for j in range( i[2], i[3] ):
-                    moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 20e-6	# 10 arb units to 2 uM.
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print(('sdc = ', sdc))
+    assert( sdc == 13 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    print(('spine num Pools = ', smstoich.numAllPools))
+    assert( smstoich.numAllPools == 3 )
+    assert( smdsolve.numPools == 3 )
+    assert( smdsolve.numAllVoxels == sdc )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 13 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    assert( pmstoich.numAllPools == 3 )
+    assert( pmdsolve.numPools == 3 )
+    assert( pmdsolve.numAllVoxels == pdc )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    print(('PSD: numfoo = ', foo.numData))
+    print(('PSD: numAllVoxels = ', pmksolve.numAllVoxels))
+
+    # Put in junctions between the diffusion solvers
+    nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
+
+    ##################################################################
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
+    adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
+    chemCa = moose.vec( '/model/chem/spine/Ca' )
+    assert( len( adaptCa ) == sdc )
+    assert( len( chemCa ) == sdc )
+    for i in range( sdc ):
+        elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
+        #print elecCa
+        moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+    moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 1e-4    # 520 to 0.0052 mM
+    moose.le( '/model/chem/dend/DEND' )
+    compts = neuroCompt.elecComptList
+    begin = neuroCompt.startVoxelInCompt
+    end = neuroCompt.endVoxelInCompt
+    aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
+    adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
+    chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    assert( len( chemCa ) == ndc )
+    for i in zip( compts, adaptCa, begin, end ):
+        name = i[0].path + '/Ca_conc'
+        if ( moose.exists( name ) ):
+            elecCa = moose.element( name )
+            moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
+            for j in range( i[2], i[3] ):
+                moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 20e-6    # 10 arb units to 2 uM.
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print "addPlot failed: object is a Neutral: ", objpath
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print "addPlot failed: object not found: ", objpath
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def makeCaPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -230,137 +210,135 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head_14_4', 'getVm', 'elec/spineVm' )
 
 def makeChemPlots():
-	graphs = moose.Neutral( '/graphs' )
-	chem = moose.Neutral( '/graphs/chem' )
-	addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
-	addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
-	addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
-	addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
-	addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
-	addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
-	addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
+    graphs = moose.Neutral( '/graphs' )
+    chem = moose.Neutral( '/graphs/chem' )
+    addPlot( '/model/chem/psd/Ca_CaM', 'getConc', 'chem/psdCaCam' )
+    addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
+    addPlot( '/model/chem/spine/Ca_CaM', 'getConc', 'chem/spineCaCam' )
+    addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
+    addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
+    addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
+    addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
 
 def makeGraphics( cPlotDt, ePlotDt ):
-        plt.ion()
-        fig = plt.figure( figsize=(10,16) )
-        chem = fig.add_subplot( 411 )
-        chem.set_ylim( 0, 0.006 )
-        plt.ylabel( 'Conc (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
-            line1, = chem.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        elec = fig.add_subplot( 412 )
-        plt.ylabel( 'Vm (V)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = elec.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        ca = fig.add_subplot( 413 )
-        plt.ylabel( '[Ca] (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/ca/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = ca.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        lenplot = fig.add_subplot( 414 )
-        plt.ylabel( 'Ca (mM )' )
-        plt.xlabel( 'Voxel#)' )
-
-	spineCa = moose.vec( '/model/chem/spine/Ca' )
-	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-        line1, = lenplot.plot( range( len( spineCa ) ), spineCa.conc, label='spine' )
-        line2, = lenplot.plot( range( len( dendCa ) ), dendCa.conc, label='dend' )
-
-        ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
-        line3, = lenplot.plot( range( len( ca ) ), ca, label='elec' )
-
-	spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
-        line4, = lenplot.plot( range( len( spineCaM ) ), spineCaM.conc, label='spineCaM' )
-	psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
-        line5, = lenplot.plot( range( len( psdCaM ) ), psdCaM.conc, label='psdCaM' )
-        plt.legend()
-
-
-        fig.canvas.draw()
-        raw_input()
+    plt.ion()
+    fig = plt.figure( figsize=(10,16) )
+    chem = fig.add_subplot( 411 )
+    chem.set_ylim( 0, 0.006 )
+    plt.ylabel( 'Conc (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
+        line1, = chem.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    elec = fig.add_subplot( 412 )
+    plt.ylabel( 'Vm (V)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = elec.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    ca = fig.add_subplot( 413 )
+    plt.ylabel( '[Ca] (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/ca/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = ca.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    lenplot = fig.add_subplot( 414 )
+    plt.ylabel( 'Ca (mM )' )
+    plt.xlabel( 'Voxel#)' )
+
+    spineCa = moose.vec( '/model/chem/spine/Ca' )
+    dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    line1, = lenplot.plot( list(range( len( spineCa ))), spineCa.conc, label='spine' )
+    line2, = lenplot.plot( list(range( len( dendCa ))), dendCa.conc, label='dend' )
+
+    ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
+    line3, = lenplot.plot( list(range( len( ca ))), ca, label='elec' )
+
+    spineCaM = moose.vec( '/model/chem/spine/Ca_CaM' )
+    line4, = lenplot.plot( list(range( len( spineCaM ))), spineCaM.conc, label='spineCaM' )
+    psdCaM = moose.vec( '/model/chem/psd/Ca_CaM' )
+    line5, = lenplot.plot( list(range( len( psdCaM ))), psdCaM.conc, label='psdCaM' )
+    plt.legend()
+
+
+    fig.canvas.draw()
+    eval(input())
                 
-        '''
-        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
-            t = numpy.arange( 0, x.vector.size, 1 )
-            pylab.plot( t, x.vector, label=x.name )
-        pylab.legend()
-        pylab.show()
-        '''
+    '''
+    for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
+        t = numpy.arange( 0, x.vector.size, 1 )
+        pylab.plot( t, x.vector, label=x.name )
+    pylab.legend()
+    pylab.show()
+    '''
 
-	print 'All done'
+    print('All done')
 
 def testNeuroMeshMultiscale():
-        runtime = 0.5
-	elecDt = 0.2e-6
-	chemDt = 0.005
-	ePlotDt = 0.5e-3
-	cPlotDt = 0.005
-	plotName = 'nm.plot'
-
-	makeNeuroMeshModel()
-	print "after model is completely done"
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb
-
-	makeChemPlots()
-	makeElecPlots()
-	makeCaPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 4, chemDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, cPlotDt )
-	moose.setClock( 8, ePlotDt )
-	moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	#moose.useClock( 2, '/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	#moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	#moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
-	moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
-	moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
-	moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
-	moose.useClock( 7, '/graphs/chem/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
-        '''
-	hsolve = moose.HSolve( '/model/elec/hsolve' )
-	moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	hsolve.dt = elecDt
-	hsolve.target = '/model/elec/compt'
-        '''
-	moose.reinit()
-        moose.element( '/model/elec/soma' ).inject = 2e-10
-        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
-        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
-        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
-	moose.reinit()
-
-	moose.start( runtime )
-#        moose.element( '/model/elec/soma' ).inject = 0
-#	moose.start( 0.25 )
-        makeGraphics( cPlotDt, ePlotDt )
+    runtime = 0.5
+    elecDt = 0.2e-6
+    chemDt = 0.005
+    ePlotDt = 0.5e-3
+    cPlotDt = 0.005
+    plotName = 'nm.plot'
+
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
+
+    makeChemPlots()
+    makeElecPlots()
+    makeCaPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 4, chemDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, cPlotDt )
+    moose.setClock( 8, ePlotDt )
+    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
+    moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    #moose.useClock( 2, '/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    #moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
+    #moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
+    moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
+    moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
+    moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
+    moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
+    moose.useClock( 7, '/graphs/chem/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
+    '''
+    hsolve = moose.HSolve( '/model/elec/hsolve' )
+    moose.useClock( 1, '/model/elec/hsolve', 'process' )
+    hsolve.dt = elecDt
+    hsolve.target = '/model/elec/compt'
+    '''
+    moose.reinit()
+    moose.element( '/model/elec/soma' ).inject = 2e-10
+    moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
+    moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
+    moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
+    moose.reinit()
+
+    moose.start( runtime )
+    makeGraphics( cPlotDt, ePlotDt )
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # minimal.py ends here.
diff --git a/snippets/MULTI/multi2.py b/snippets/MULTI/multi2.py
index 373e25a7..cae95880 100644
--- a/snippets/MULTI/multi2.py
+++ b/snippets/MULTI/multi2.py
@@ -44,180 +44,165 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	moose.setCwe( '/library' )
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    moose.setCwe( '/library' )
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
+    return cellId
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	modelId = moose.loadModel( 'separate_compts.g', '/model/chem', 'ee' )
-	#modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    #print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    modelId = moose.loadModel( 'separate_compts.g', '/model/chem', 'ee' )
+    #modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 def makeNeuroMeshModel():
-	diffLength = 10e-6 # Aim for 2 soma compartments.
-	elec = loadElec()
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
-
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print 'ns = ', ns, ', ndc = ', ndc
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 36 ) # 
-	assert( ndc == 278 ) # 
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print 'done setting path, numPools = ', nmdsolve.numPools
-        assert( nmdsolve.numPools == 1 )
-        assert( nmdsolve.numAllVoxels == ndc )
-        assert( nmstoich.numAllPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
-        
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print 'sdc = ', sdc
-	assert( sdc == 13 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        print 'spine num Pools = ', smstoich.numAllPools, smdsolve.numPools
-        assert( smstoich.numAllPools == 35 )
-        assert( smdsolve.numPools == 30 )
-        assert( smdsolve.numAllVoxels == sdc )
+    diffLength = 10e-6 # Aim for 2 soma compartments.
+    elec = loadElec()
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
+
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 36 ) # 
+    assert( ndc == 278 ) # 
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    assert( nmdsolve.numAllVoxels == ndc )
+    assert( nmstoich.numAllPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 13 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        print 'psd num Pools = ', pmstoich.numAllPools, pmdsolve.numPools
-        assert( pmstoich.numAllPools == 55 )
-        assert( pmdsolve.numPools == 48 )
-        assert( pmdsolve.numAllVoxels == pdc )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        print 'PSD: numfoo = ', foo.numData
-        print 'PSD: numAllVoxels = ', pmksolve.numAllVoxels
-
-        # Put in junctions between the diffusion solvers
-        nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
-
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-        ##################################################################
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
-	adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
-	chemCa = moose.vec( '/model/chem/spine/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( adaptCa ) == sdc )
-	assert( len( chemCa ) == sdc )
-        for i in range( sdc ):
-            elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
-            #print elecCa
-	    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-	moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 5e-3	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-
-
-        moose.le( '/model/chem/dend/DEND' )
-
-
-        compts = neuroCompt.elecComptList
-        begin = neuroCompt.startVoxelInCompt
-        end = neuroCompt.endVoxelInCompt
-	aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
-	adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
-	chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( chemCa ) == ndc )
-        for i in zip( compts, adaptCa, begin, end ):
-            name = i[0].path + '/Ca_conc'
-            if ( moose.exists( name ) ):
-                elecCa = moose.element( name )
-                #print i[2], i[3], '   ', elecCa
-                #print i[1]
-                moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
-                for j in range( i[2], i[3] ):
-                    moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 20e-6	# 10 arb units to 2 uM.
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print(('sdc = ', sdc))
+    assert( sdc == 13 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    print(('spine num Pools = ', smstoich.numAllPools, smdsolve.numPools))
+    assert( smstoich.numAllPools == 35 )
+    assert( smdsolve.numPools == 30 )
+    assert( smdsolve.numAllVoxels == sdc )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 13 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    print(('psd num Pools = ', pmstoich.numAllPools, pmdsolve.numPools))
+    assert( pmstoich.numAllPools == 55 )
+    assert( pmdsolve.numPools == 48 )
+    assert( pmdsolve.numAllVoxels == pdc )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    print(('PSD: numfoo = ', foo.numData))
+    print(('PSD: numAllVoxels = ', pmksolve.numAllVoxels))
+
+    # Put in junctions between the diffusion solvers
+    nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
+
+    ##################################################################
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
+    adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
+    chemCa = moose.vec( '/model/chem/spine/Ca' )
+    #print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
+    assert( len( adaptCa ) == sdc )
+    assert( len( chemCa ) == sdc )
+    for i in range( sdc ):
+        elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
+    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+    moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 5e-3    # 520 to 0.0052 mM
+
+    moose.le( '/model/chem/dend/DEND' )
+    compts = neuroCompt.elecComptList
+    begin = neuroCompt.startVoxelInCompt
+    end = neuroCompt.endVoxelInCompt
+    aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
+    adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
+    chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    assert( len( chemCa ) == ndc )
+    for i in zip( compts, adaptCa, begin, end ):
+        name = i[0].path + '/Ca_conc'
+        if ( moose.exists( name ) ):
+            elecCa = moose.element( name )
+            moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
+            for j in range( i[2], i[3] ):
+                moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 20e-6    # 10 arb units to 2 uM.
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print "addPlot failed: object is a Neutral: ", objpath
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print "addPlot failed: object not found: ", objpath
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def makeCaPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -234,146 +219,117 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head_14_4', 'getVm', 'elec/spineVm' )
 
 def makeChemPlots():
-	graphs = moose.Neutral( '/graphs' )
-	chem = moose.Neutral( '/graphs/chem' )
-	addPlot( '/model/chem/psd/CaM_dash_Ca4', 'getConc', 'chem/psdCaCam' )
-	addPlot( '/model/chem/psd/actCaMKII', 'getConc', 'chem/psdActCaMKII' )
-	addPlot( '/model/chem/spine/CaM_dash_Ca4', 'getConc', 'chem/spineCaCam' )
-	addPlot( '/model/chem/spine/CaM_dash_Ca4[12]', 'getConc', 'chem/spine12CaCam' )
-	addPlot( '/model/chem/spine/actCaMKII', 'getConc', 'chem/spineActCaMKII' )
-	addPlot( '/model/chem/spine/actCaMKII[11]', 'getConc', 'chem/spine12ActCaMKII' )
-	addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
-	addPlot( '/model/chem/psd/Ca[11]', 'getConc', 'chem/psd12Ca' )
-	addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
-	addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
-	#addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
-	#addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
+    graphs = moose.Neutral( '/graphs' )
+    chem = moose.Neutral( '/graphs/chem' )
+    addPlot( '/model/chem/psd/CaM_dash_Ca4', 'getConc', 'chem/psdCaCam' )
+    addPlot( '/model/chem/psd/actCaMKII', 'getConc', 'chem/psdActCaMKII' )
+    addPlot( '/model/chem/spine/CaM_dash_Ca4', 'getConc', 'chem/spineCaCam' )
+    addPlot( '/model/chem/spine/CaM_dash_Ca4[12]', 'getConc', 'chem/spine12CaCam' )
+    addPlot( '/model/chem/spine/actCaMKII', 'getConc', 'chem/spineActCaMKII' )
+    addPlot( '/model/chem/spine/actCaMKII[11]', 'getConc', 'chem/spine12ActCaMKII' )
+    addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
+    addPlot( '/model/chem/psd/Ca[11]', 'getConc', 'chem/psd12Ca' )
+    addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
+    addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
+    #addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
+    #addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
 
 def makeGraphics( cPlotDt, ePlotDt ):
-        plt.ion()
-        fig = plt.figure( figsize=(10,16) )
-        chem = fig.add_subplot( 411 )
-        chem.set_ylim( 0, 0.006 )
-        plt.ylabel( 'Conc (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
-            line1, = chem.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        elec = fig.add_subplot( 412 )
-        plt.ylabel( 'Vm (V)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = elec.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        ca = fig.add_subplot( 413 )
-        plt.ylabel( '[Ca] (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/ca/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = ca.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        lenplot = fig.add_subplot( 414 )
-        plt.ylabel( 'Ca (mM )' )
-        plt.xlabel( 'Voxel#)' )
-
-	spineCa = moose.vec( '/model/chem/spine/Ca' )
-	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-        line1, = lenplot.plot( range( len( spineCa ) ), spineCa.conc, label='spine' )
-        line2, = lenplot.plot( range( len( dendCa ) ), dendCa.conc, label='dend' )
-
-        ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
-        line3, = lenplot.plot( range( len( ca ) ), ca, label='elec' )
-
-	spineCaM = moose.vec( '/model/chem/spine/CaM_dash_Ca4' )
-        line4, = lenplot.plot( range( len( spineCaM ) ), spineCaM.conc, label='spineCaM' )
-	psdCaM = moose.vec( '/model/chem/psd/CaM_dash_Ca4' )
-        line5, = lenplot.plot( range( len( psdCaM ) ), psdCaM.conc, label='psdCaM' )
-        plt.legend()
-
-
-        fig.canvas.draw()
-        raw_input()
-                
-        '''
-        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
-            t = numpy.arange( 0, x.vector.size, 1 )
-            pylab.plot( t, x.vector, label=x.name )
-        pylab.legend()
-        pylab.show()
-        '''
-
-	print 'All done'
+    plt.ion()
+    fig = plt.figure( figsize=(10,16) )
+    chem = fig.add_subplot( 411 )
+    chem.set_ylim( 0, 0.006 )
+    plt.ylabel( 'Conc (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
+        line1, = chem.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    elec = fig.add_subplot( 412 )
+    plt.ylabel( 'Vm (V)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = elec.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    ca = fig.add_subplot( 413 )
+    plt.ylabel( '[Ca] (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/ca/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = ca.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    lenplot = fig.add_subplot( 414 )
+    plt.ylabel( 'Ca (mM )' )
+    plt.xlabel( 'Voxel#)' )
+
+    spineCa = moose.vec( '/model/chem/spine/Ca' )
+    dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    line1, = lenplot.plot( list(range( len( spineCa ))), spineCa.conc, label='spine' )
+    line2, = lenplot.plot( list(range( len( dendCa ))), dendCa.conc, label='dend' )
+
+    ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
+    line3, = lenplot.plot( list(range( len( ca ))), ca, label='elec' )
+
+    spineCaM = moose.vec( '/model/chem/spine/CaM_dash_Ca4' )
+    line4, = lenplot.plot( list(range( len( spineCaM ))), spineCaM.conc, label='spineCaM' )
+    psdCaM = moose.vec( '/model/chem/psd/CaM_dash_Ca4' )
+    line5, = lenplot.plot( list(range( len( psdCaM ))), psdCaM.conc, label='psdCaM' )
+    plt.legend()
+
+    fig.canvas.draw()
+    eval(input())
+    print('All done')
 
 def testNeuroMeshMultiscale():
-        useHsolve = 0
-        runtime = 0.5
-	elecDt = 10e-6
-	chemDt = 0.005
-	ePlotDt = 0.5e-3
-	cPlotDt = 0.005
-	plotName = 'nm.plot'
-
-	makeNeuroMeshModel()
-	print "after model is completely done"
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb
-
-	makeChemPlots()
-	makeElecPlots()
-	makeCaPlots()
-        for i in range( 10 ):
-            moose.setClock( i, elecDt )
-        for i in range( 10, 20 ):
-            moose.setClock( i, chemDt )
-	moose.setClock( 8, ePlotDt )
-	moose.setClock( 18, cPlotDt )
-        if useHsolve:
-	    hsolve = moose.HSolve( '/model/elec/hsolve' )
-	    #moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	    hsolve.dt = elecDt
-	    hsolve.target = '/model/elec/compt'
-	    moose.reinit()
-        #soma = moose.element( '/model/elec/soma' )
-        '''
-        else:
-	    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
-	    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	#moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	#moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
-	moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
-	moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
-	moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
-        '''
-
-	moose.useClock( 18, '/graphs/chem/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
-        moose.element( '/model/elec/soma' ).inject = 2e-10
-        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
-        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
-        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
-	moose.reinit()
-
-	moose.start( runtime )
-#        moose.element( '/model/elec/soma' ).inject = 0
-#	moose.start( 0.25 )
-        makeGraphics( cPlotDt, ePlotDt )
-
+    useHsolve = 0
+    runtime = 0.5
+    elecDt = 10e-6
+    chemDt = 0.005
+    ePlotDt = 0.5e-3
+    cPlotDt = 0.005
+    plotName = 'nm.plot'
+
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
+
+    makeChemPlots()
+    makeElecPlots()
+    makeCaPlots()
+    for i in range( 10 ):
+        moose.setClock( i, elecDt )
+    for i in range( 10, 20 ):
+        moose.setClock( i, chemDt )
+    moose.setClock( 8, ePlotDt )
+    moose.setClock( 18, cPlotDt )
+    if useHsolve:
+        hsolve = moose.HSolve( '/model/elec/hsolve' )
+    #moose.useClock( 1, '/model/elec/hsolve', 'process' )
+    hsolve.dt = elecDt
+    hsolve.target = '/model/elec/compt'
+    moose.reinit()
+    #soma = moose.element( '/model/elec/soma' )
+    moose.useClock( 18, '/graphs/chem/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
+    moose.element( '/model/elec/soma' ).inject = 2e-10
+    moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
+    moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
+    moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
+    moose.reinit()
+
+    moose.start( runtime )
+    makeGraphics( cPlotDt, ePlotDt )
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # minimal.py ends here.
diff --git a/snippets/MULTI/multi3.py b/snippets/MULTI/multi3.py
index 005738ce..d6cc945f 100644
--- a/snippets/MULTI/multi3.py
+++ b/snippets/MULTI/multi3.py
@@ -32,7 +32,6 @@
 # Code:
 
 import sys
-sys.path.append('../../python')
 import os
 os.environ['NUMPTHREADS'] = '1'
 import math
@@ -44,184 +43,184 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	moose.setCwe( '/library' )
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    moose.setCwe( '/library' )
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "Neutral" )
+    return cellId
 
 def loadChem( diffLength ):
-	chem = moose.Neutral( '/model/chem' )
-	neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
-	neuroCompt.separateSpines = 1
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
-	#print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	#modelId = moose.loadModel( 'separate_compts.g', '/model/chem', 'ee' )
-	modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
-        neuroCompt.name = 'dend'
-        spineCompt.name = 'spine'
-        psdCompt.name = 'psd'
+    chem = moose.Neutral( '/model/chem' )
+    neuroCompt = moose.NeuroMesh( '/model/chem/kinetics' )
+    neuroCompt.separateSpines = 1
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/chem/compartment_1' )
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/chem/compartment_2' )
+    #print 'Meshvolume[neuro, spine, psd] = ', neuroCompt.mesh[0].volume, spineCompt.mesh[0].volume, psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    #modelId = moose.loadModel( 'separate_compts.g', '/model/chem', 'ee' )
+    modelId = moose.loadModel( 'psd_merged31d.g', '/model/chem', 'ee' )
+    neuroCompt.name = 'dend'
+    spineCompt.name = 'spine'
+    psdCompt.name = 'psd'
 
 def makeNeuroMeshModel():
-	diffLength = 10e-6 # Aim for 2 soma compartments.
-	elec = loadElec()
-	loadChem( diffLength )
-        neuroCompt = moose.element( '/model/chem/dend' )
-	neuroCompt.diffLength = diffLength
-	neuroCompt.cellPortion( elec, '/model/elec/#' )
-	for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if (x.diffConst > 0):
-			x.diffConst = 1e-11
-	for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-		x.diffConst = 1e-10
-
-	# Put in dend solvers
-	ns = neuroCompt.numSegments
-	ndc = neuroCompt.numDiffCompts
-        print 'ns = ', ns, ', ndc = ', ndc
-        assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
-	assert( ns == 36 ) # 
-	assert( ndc == 278 ) # 
-	nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
-	nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
-        nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
-        nmstoich.compartment = neuroCompt
-        nmstoich.ksolve = nmksolve
-        nmstoich.dsolve = nmdsolve
-        nmstoich.path = "/model/chem/dend/##"
-        print 'done setting path, numPools = ', nmdsolve.numPools
-        assert( nmdsolve.numPools == 1 )
-        assert( nmdsolve.numAllVoxels == ndc )
-        assert( nmstoich.numAllPools == 1 )
-	# oddly, numLocalFields does not work.
-	ca = moose.element( '/model/chem/dend/DEND/Ca' )
-	assert( ca.numData == ndc )
+    diffLength = 10e-6 # Aim for 2 soma compartments.
+    elec = loadElec()
+    loadChem( diffLength )
+    neuroCompt = moose.element( '/model/chem/dend' )
+    neuroCompt.diffLength = diffLength
+    neuroCompt.cellPortion( elec, '/model/elec/#' )
+    for x in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if (x.diffConst > 0):
+            x.diffConst = 1e-11
+    for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+        x.diffConst = 1e-10
+
+    # Put in dend solvers
+    ns = neuroCompt.numSegments
+    ndc = neuroCompt.numDiffCompts
+    print(('ns = ', ns, ', ndc = ', ndc))
+    assert( neuroCompt.numDiffCompts == neuroCompt.mesh.num )
+    assert( ns == 36 ) # 
+    assert( ndc == 278 ) # 
+    nmksolve = moose.Ksolve( '/model/chem/dend/ksolve' )
+    nmdsolve = moose.Dsolve( '/model/chem/dend/dsolve' )
+    nmstoich = moose.Stoich( '/model/chem/dend/stoich' )
+    nmstoich.compartment = neuroCompt
+    nmstoich.ksolve = nmksolve
+    nmstoich.dsolve = nmdsolve
+    nmstoich.path = "/model/chem/dend/##"
+    print(('done setting path, numPools = ', nmdsolve.numPools))
+    assert( nmdsolve.numPools == 1 )
+    assert( nmdsolve.numAllVoxels == ndc )
+    assert( nmstoich.numAllPools == 1 )
+    # oddly, numLocalFields does not work.
+    ca = moose.element( '/model/chem/dend/DEND/Ca' )
+    assert( ca.numData == ndc )
         
-        # Put in spine solvers. Note that these get info from the neuroCompt
-        spineCompt = moose.element( '/model/chem/spine' )
-	sdc = spineCompt.mesh.num
-        print 'sdc = ', sdc
-	assert( sdc == 13 )
-	smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
-	smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
-        smstoich = moose.Stoich( '/model/chem/spine/stoich' )
-        smstoich.compartment = spineCompt
-        smstoich.ksolve = smksolve
-        smstoich.dsolve = smdsolve
-        smstoich.path = "/model/chem/spine/##"
-        print 'spine num Pools = ', smstoich.numAllPools, 'dsolve n = ', smdsolve.numPools
-        assert( smstoich.numAllPools == 36 )
-        assert( smdsolve.numPools == 31 )
-        assert( smdsolve.numAllVoxels == sdc )
-        
-        # Put in PSD solvers. Note that these get info from the neuroCompt
-        psdCompt = moose.element( '/model/chem/psd' )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 13 )
-	pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
-	pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
-        pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
-        pmstoich.compartment = psdCompt
-        pmstoich.ksolve = pmksolve
-        pmstoich.dsolve = pmdsolve
-        pmstoich.path = "/model/chem/psd/##"
-        print 'psd num Pools = ', pmstoich.numAllPools
-        assert( pmstoich.numAllPools == 56 )
-        assert( pmdsolve.numPools == 49 )
-        assert( pmdsolve.numAllVoxels == pdc )
-        foo = moose.element( '/model/chem/psd/Ca' )
-        print 'PSD: numfoo = ', foo.numData
-        print 'PSD: numAllVoxels = ', pmksolve.numAllVoxels
-
-        # Put in junctions between the diffusion solvers
-        nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
-
-        # Put in cross-compartment reactions between ksolvers
-        nmstoich.buildXreacs( smstoich )
-        smstoich.buildXreacs( pmstoich )
-
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-        ##################################################################
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
-	adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
-	chemCa = moose.vec( '/model/chem/spine/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( adaptCa ) == sdc )
-	assert( len( chemCa ) == sdc )
-        for i in range( sdc ):
-            elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
-            #print elecCa
-	    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-	moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 5e-3	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-
-
-        moose.le( '/model/chem/dend/DEND' )
-
-
-        compts = neuroCompt.elecComptList
-        begin = neuroCompt.startVoxelInCompt
-        end = neuroCompt.endVoxelInCompt
-	aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
-	adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
-	chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-	#print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
-	assert( len( chemCa ) == ndc )
-        for i in zip( compts, adaptCa, begin, end ):
-            name = i[0].path + '/Ca_conc'
-            if ( moose.exists( name ) ):
-                elecCa = moose.element( name )
-                #print i[2], i[3], '   ', elecCa
-                #print i[1]
-                moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
-                for j in range( i[2], i[3] ):
-                    moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.00008	# 80 nM offset in chem.
-   	adaptCa.scale = 20e-6	# 10 arb units to 2 uM.
+    # Put in spine solvers. Note that these get info from the neuroCompt
+    spineCompt = moose.element( '/model/chem/spine' )
+    sdc = spineCompt.mesh.num
+    print(('sdc = ', sdc))
+    assert( sdc == 13 )
+    smksolve = moose.Ksolve( '/model/chem/spine/ksolve' )
+    smdsolve = moose.Dsolve( '/model/chem/spine/dsolve' )
+    smstoich = moose.Stoich( '/model/chem/spine/stoich' )
+    smstoich.compartment = spineCompt
+    smstoich.ksolve = smksolve
+    smstoich.dsolve = smdsolve
+    smstoich.path = "/model/chem/spine/##"
+    print(('spine num Pools = ', smstoich.numAllPools, 'dsolve n = ', smdsolve.numPools))
+    assert( smstoich.numAllPools == 36 )
+    assert( smdsolve.numPools == 31 )
+    assert( smdsolve.numAllVoxels == sdc )
+    
+    # Put in PSD solvers. Note that these get info from the neuroCompt
+    psdCompt = moose.element( '/model/chem/psd' )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 13 )
+    pmksolve = moose.Ksolve( '/model/chem/psd/ksolve' )
+    pmdsolve = moose.Dsolve( '/model/chem/psd/dsolve' )
+    pmstoich = moose.Stoich( '/model/chem/psd/stoich' )
+    pmstoich.compartment = psdCompt
+    pmstoich.ksolve = pmksolve
+    pmstoich.dsolve = pmdsolve
+    pmstoich.path = "/model/chem/psd/##"
+    print(('psd num Pools = ', pmstoich.numAllPools))
+    assert( pmstoich.numAllPools == 56 )
+    assert( pmdsolve.numPools == 49 )
+    assert( pmdsolve.numAllVoxels == pdc )
+    foo = moose.element( '/model/chem/psd/Ca' )
+    print(('PSD: numfoo = ', foo.numData))
+    print(('PSD: numAllVoxels = ', pmksolve.numAllVoxels))
+
+    # Put in junctions between the diffusion solvers
+    nmdsolve.buildNeuroMeshJunctions( smdsolve, pmdsolve )
+
+    # Put in cross-compartment reactions between ksolvers
+    nmstoich.buildXreacs( smstoich )
+    smstoich.buildXreacs( pmstoich )
+
+    """
+    CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
+    print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
+    CaNspine = moose.vec( '/model/chem/spine/SPINE/CaN_BULK/CaN' )
+    print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
+    """
+
+    ##################################################################
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/spine/adaptCa', sdc )
+    adaptCa = moose.vec( '/model/chem/spine/adaptCa' )
+    chemCa = moose.vec( '/model/chem/spine/Ca' )
+    #print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
+    assert( len( adaptCa ) == sdc )
+    assert( len( chemCa ) == sdc )
+    for i in range( sdc ):
+        elecCa = moose.element( '/model/elec/spine_head_14_' + str(i+1) + '/NMDA_Ca_conc' )
+        #print elecCa
+    moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+    moose.connect( adaptCa, 'output', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 5e-3    # 520 to 0.0052 mM
+    #print adaptCa.outputOffset
+
+
+    moose.le( '/model/chem/dend/DEND' )
+
+
+    compts = neuroCompt.elecComptList
+    begin = neuroCompt.startVoxelInCompt
+    end = neuroCompt.endVoxelInCompt
+    aCa = moose.Adaptor( '/model/chem/dend/DEND/adaptCa', len( compts))
+    adaptCa = moose.vec( '/model/chem/dend/DEND/adaptCa' )
+    chemCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    #print 'aCa = ', aCa, ' foo = ', foo, "len( ChemCa ) = ", len( chemCa ), ", numData = ", chemCa.numData, "len( adaptCa ) = ", len( adaptCa )
+    assert( len( chemCa ) == ndc )
+    for i in zip( compts, adaptCa, begin, end ):
+        name = i[0].path + '/Ca_conc'
+        if ( moose.exists( name ) ):
+            elecCa = moose.element( name )
+            #print i[2], i[3], '   ', elecCa
+            #print i[1]
+            moose.connect( elecCa, 'concOut', i[1], 'input', 'Single' ) 
+            for j in range( i[2], i[3] ):
+                moose.connect( i[1], 'output', chemCa[j], 'setConc', 'Single' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.00008    # 80 nM offset in chem.
+    adaptCa.scale = 20e-6    # 10 arb units to 2 uM.
 
 def addPlot( objpath, field, plot ):
-	#assert moose.exists( objpath )
-	if moose.exists( objpath ):
-		tab = moose.Table( '/graphs/' + plot )
-		obj = moose.element( objpath )
-		if obj.className == 'Neutral':
-			print "addPlot failed: object is a Neutral: ", objpath
-			return moose.element( '/' )
-		else:
-			#print "object was found: ", objpath, obj.className
-			moose.connect( tab, 'requestOut', obj, field )
-			return tab
-	else:
-		print "addPlot failed: object not found: ", objpath
-		return moose.element( '/' )
+    #assert moose.exists( objpath )
+    if moose.exists( objpath ):
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        if obj.className == 'Neutral':
+            print(("addPlot failed: object is a Neutral: ", objpath))
+            return moose.element( '/' )
+        else:
+            #print "object was found: ", objpath, obj.className
+            moose.connect( tab, 'requestOut', obj, field )
+            return tab
+    else:
+        print(("addPlot failed: object not found: ", objpath))
+        return moose.element( '/' )
 
 def makeCaPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -238,148 +237,144 @@ def makeElecPlots():
     addPlot( '/model/elec/spine_head_14_4', 'getVm', 'elec/spineVm' )
 
 def makeChemPlots():
-	graphs = moose.Neutral( '/graphs' )
-	chem = moose.Neutral( '/graphs/chem' )
-	addPlot( '/model/chem/psd/CaM_dash_Ca4', 'getConc', 'chem/psdCaCam' )
-	addPlot( '/model/chem/psd/actCaMKII', 'getConc', 'chem/psdActCaMKII' )
-	addPlot( '/model/chem/spine/CaM_dash_Ca4', 'getConc', 'chem/spineCaCam' )
-	addPlot( '/model/chem/spine/CaM_dash_Ca4[12]', 'getConc', 'chem/spine12CaCam' )
-	addPlot( '/model/chem/spine/actCaMKII', 'getConc', 'chem/spineActCaMKII' )
-	addPlot( '/model/chem/spine/actCaMKII[11]', 'getConc', 'chem/spine12ActCaMKII' )
-	addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
-	addPlot( '/model/chem/psd/Ca[11]', 'getConc', 'chem/psd12Ca' )
-	addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
-	addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
-	#addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
-	#addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
+    graphs = moose.Neutral( '/graphs' )
+    chem = moose.Neutral( '/graphs/chem' )
+    addPlot( '/model/chem/psd/CaM_dash_Ca4', 'getConc', 'chem/psdCaCam' )
+    addPlot( '/model/chem/psd/actCaMKII', 'getConc', 'chem/psdActCaMKII' )
+    addPlot( '/model/chem/spine/CaM_dash_Ca4', 'getConc', 'chem/spineCaCam' )
+    addPlot( '/model/chem/spine/CaM_dash_Ca4[12]', 'getConc', 'chem/spine12CaCam' )
+    addPlot( '/model/chem/spine/actCaMKII', 'getConc', 'chem/spineActCaMKII' )
+    addPlot( '/model/chem/spine/actCaMKII[11]', 'getConc', 'chem/spine12ActCaMKII' )
+    addPlot( '/model/chem/psd/Ca', 'getConc', 'chem/psdCa' )
+    addPlot( '/model/chem/psd/Ca[11]', 'getConc', 'chem/psd12Ca' )
+    addPlot( '/model/chem/spine/Ca[3]', 'getConc', 'chem/spine4Ca' )
+    addPlot( '/model/chem/spine/Ca[11]', 'getConc', 'chem/spine12Ca' )
+    #addPlot( '/model/chem/dend/DEND/Ca', 'getConc', 'chem/dendCa' )
+    #addPlot( '/model/chem/dend/DEND/Ca[20]', 'getConc', 'chem/dendCa20' )
 
 def makeGraphics( cPlotDt, ePlotDt ):
-        plt.ion()
-        fig = plt.figure( figsize=(10,16) )
-        chem = fig.add_subplot( 411 )
-        chem.set_ylim( 0, 0.006 )
-        plt.ylabel( 'Conc (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
-            line1, = chem.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        elec = fig.add_subplot( 412 )
-        plt.ylabel( 'Vm (V)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = elec.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        ca = fig.add_subplot( 413 )
-        plt.ylabel( '[Ca] (mM)' )
-        plt.xlabel( 'time (seconds)' )
-        for x in moose.wildcardFind( '/graphs/ca/#[ISA=Table]' ):
-            pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
-            line1, = ca.plot( pos, x.vector, label=x.name )
-        plt.legend()
-
-        lenplot = fig.add_subplot( 414 )
-        plt.ylabel( 'Ca (mM )' )
-        plt.xlabel( 'Voxel#)' )
-
-	spineCa = moose.vec( '/model/chem/spine/Ca' )
-	dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
-        line1, = lenplot.plot( range( len( spineCa ) ), spineCa.conc, label='spine' )
-        line2, = lenplot.plot( range( len( dendCa ) ), dendCa.conc, label='dend' )
-
-        ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
-        line3, = lenplot.plot( range( len( ca ) ), ca, label='elec' )
-
-	spineCaM = moose.vec( '/model/chem/spine/CaM_dash_Ca4' )
-        line4, = lenplot.plot( range( len( spineCaM ) ), spineCaM.conc, label='spineCaM' )
-	psdCaM = moose.vec( '/model/chem/psd/CaM_dash_Ca4' )
-        line5, = lenplot.plot( range( len( psdCaM ) ), psdCaM.conc, label='psdCaM' )
-        plt.legend()
-
-
-        fig.canvas.draw()
-        raw_input()
+    plt.ion()
+    fig = plt.figure( figsize=(10,16) )
+    chem = fig.add_subplot( 411 )
+    chem.set_ylim( 0, 0.006 )
+    plt.ylabel( 'Conc (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/chem/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * cPlotDt
+        line1, = chem.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    elec = fig.add_subplot( 412 )
+    plt.ylabel( 'Vm (V)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/elec/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = elec.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    ca = fig.add_subplot( 413 )
+    plt.ylabel( '[Ca] (mM)' )
+    plt.xlabel( 'time (seconds)' )
+    for x in moose.wildcardFind( '/graphs/ca/#[ISA=Table]' ):
+        pos = numpy.arange( 0, x.vector.size, 1 ) * ePlotDt
+        line1, = ca.plot( pos, x.vector, label=x.name )
+    plt.legend()
+
+    lenplot = fig.add_subplot( 414 )
+    plt.ylabel( 'Ca (mM )' )
+    plt.xlabel( 'Voxel#)' )
+
+    spineCa = moose.vec( '/model/chem/spine/Ca' )
+    dendCa = moose.vec( '/model/chem/dend/DEND/Ca' )
+    line1, = lenplot.plot( list(range( len( spineCa ))), spineCa.conc, label='spine' )
+    line2, = lenplot.plot( list(range( len( dendCa ))), dendCa.conc, label='dend' )
+
+    ca = [ x.Ca * 0.0001 for x in moose.wildcardFind( '/model/elec/##[ISA=CaConcBase]') ]
+    line3, = lenplot.plot( list(range( len( ca ))), ca, label='elec' )
+
+    spineCaM = moose.vec( '/model/chem/spine/CaM_dash_Ca4' )
+    line4, = lenplot.plot( list(range( len( spineCaM ))), spineCaM.conc, label='spineCaM' )
+    psdCaM = moose.vec( '/model/chem/psd/CaM_dash_Ca4' )
+    line5, = lenplot.plot( list(range( len( psdCaM ))), psdCaM.conc, label='psdCaM' )
+    plt.legend()
+
+
+    fig.canvas.draw()
+    eval(input())
                 
-        '''
-        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
-            t = numpy.arange( 0, x.vector.size, 1 )
-            pylab.plot( t, x.vector, label=x.name )
-        pylab.legend()
-        pylab.show()
-        '''
+    '''
+    for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
+        t = numpy.arange( 0, x.vector.size, 1 )
+        pylab.plot( t, x.vector, label=x.name )
+    pylab.legend()
+    pylab.show()
+    '''
 
-	print 'All done'
+    print('All done')
 
 def testNeuroMeshMultiscale():
-        useHsolve = 1
-        runtime = 0.5
-        if useHsolve:
-	    elecDt = 50e-6
-        else:
-	    elecDt = 10e-6
-	chemDt = 0.005
-	ePlotDt = 0.5e-3
-	cPlotDt = 0.005
-	plotName = 'nm.plot'
-
-	makeNeuroMeshModel()
-	print "after model is completely done"
-	for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
-		print i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb
-
-	makeChemPlots()
-	makeElecPlots()
-	makeCaPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 4, chemDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, cPlotDt )
-	moose.setClock( 8, ePlotDt )
-        if useHsolve:
-	    hsolve = moose.HSolve( '/model/elec/hsolve' )
-	    moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	    hsolve.dt = elecDt
-	    hsolve.target = '/model/elec/compt'
-	    moose.reinit()
-        else:
-	    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	    moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
-	    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	#moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	#moose.useClock( 4, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
-	moose.useClock( 4, '/model/chem/#/ksolve', 'init' )
-	moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
-	moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
-	moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
-	moose.useClock( 7, '/graphs/chem/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
-        moose.element( '/model/elec/soma' ).inject = 2e-10
-        moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
-        moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
-        moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
-	moose.reinit()
-
-	moose.start( runtime )
-#        moose.element( '/model/elec/soma' ).inject = 0
-#	moose.start( 0.25 )
-        makeGraphics( cPlotDt, ePlotDt )
+    useHsolve = 1
+    runtime = 0.5
+    if useHsolve:
+        elecDt = 50e-6
+    else:
+        elecDt = 10e-6
+    chemDt = 0.005
+    ePlotDt = 0.5e-3
+    cPlotDt = 0.005
+    plotName = 'nm.plot'
+    makeNeuroMeshModel()
+    print("after model is completely done")
+    for i in moose.wildcardFind( '/model/chem/#/#/#/transloc#' ):
+        print((i[0].name, i[0].Kf, i[0].Kb, i[0].kf, i[0].kb))
+
+    makeChemPlots()
+    makeElecPlots()
+    makeCaPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 4, chemDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, cPlotDt )
+    moose.setClock( 8, ePlotDt )
+    if useHsolve:
+        hsolve = moose.HSolve( '/model/elec/hsolve' )
+        moose.useClock( 1, '/model/elec/hsolve', 'process' )
+        hsolve.dt = elecDt
+        hsolve.target = '/model/elec/compt'
+        moose.reinit()
+    else:
+        moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+        moose.useClock( 1, '/model/elec/##[ISA=Compartment]', 'process' )
+        moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+
+        moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+        moose.useClock( 2, '/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+
+    moose.useClock( 4, '/model/chem/#/dsolve', 'process' )
+    moose.useClock( 4, '/model/chem/#/ksolve', 'init' )
+    moose.useClock( 5, '/model/chem/#/ksolve', 'process' )
+    moose.useClock( 6, '/model/chem/spine/adaptCa', 'process' )
+    moose.useClock( 6, '/model/chem/dend/DEND/adaptCa', 'process' )
+    moose.useClock( 7, '/graphs/chem/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#,/graphs/ca/#', 'process' )
+    moose.element( '/model/elec/soma' ).inject = 2e-10
+    moose.element( '/model/chem/psd/Ca' ).concInit = 0.001
+    moose.element( '/model/chem/spine/Ca' ).concInit = 0.002
+    moose.element( '/model/chem/dend/DEND/Ca' ).concInit = 0.003
+    moose.reinit()
+
+    moose.start( runtime )
+    makeGraphics( cPlotDt, ePlotDt )
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # minimal.py ends here.
diff --git a/snippets/MULTI/proto18.py b/snippets/MULTI/proto18.py
index 06057af6..05ba3d54 100644
--- a/snippets/MULTI/proto18.py
+++ b/snippets/MULTI/proto18.py
@@ -4,7 +4,7 @@
 #** The 1991 Traub set of voltage and concentration dependent channels
 #** Implemented as tabchannels by : Dave Beeman
 #**      R.D.Traub, R. K. S. Wong, R. Miles, and H. Michelson
-#**	Journal of Neurophysiology, Vol. 66, p. 635 (1991)
+#**    Journal of Neurophysiology, Vol. 66, p. 635 (1991)
 #**
 #** This file depends on functions and constants defined in defaults.g
 #** As it is also intended as an example of the use of the tabchannel
@@ -52,61 +52,61 @@ SOMA_A = 3.320e-9       #// soma area in square meters
 #//========================================================================
 
 def make_Ca():
-	if moose.exists( 'Ca' ):
-		return
-	Ca = moose.HHChannel( 'Ca' )
-	Ca.Ek = ECA
-	Ca.Gbar = 40 * SOMA_A
-	Ca.Gk = 0
-	Ca.Xpower = 2
-	Ca.Ypower = 1
-	Ca.Zpower = 0
-
-	xgate = moose.element( 'Ca/gateX' )
-	xA = numpy.array( [ 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389, -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3, 3000, -0.1, 0.05 ] )
-#	xgate.min = -0.1
-#	xgate.max = 0.05
-#	xgate.divs = 3000
+    if moose.exists( 'Ca' ):
+        return
+    Ca = moose.HHChannel( 'Ca' )
+    Ca.Ek = ECA
+    Ca.Gbar = 40 * SOMA_A
+    Ca.Gk = 0
+    Ca.Xpower = 2
+    Ca.Ypower = 1
+    Ca.Zpower = 0
+
+    xgate = moose.element( 'Ca/gateX' )
+    xA = numpy.array( [ 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389, -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3, 3000, -0.1, 0.05 ] )
+#    xgate.min = -0.1
+#    xgate.max = 0.05
+#    xgate.divs = 3000
 #// Converting Traub's expressions for the gCa/s alpha and beta functions
 #// to SI units and entering the A, B, C, D and F parameters, we get:
-#	xgate.alpha( 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389 )
-#	xgate.beta( -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3 )
-	#xgate.setupAlpha( xA )
-	xgate.alphaParms = xA
+#    xgate.alpha( 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389 )
+#    xgate.beta( -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3 )
+    #xgate.setupAlpha( xA )
+    xgate.alphaParms = xA
 
 
 #  The Y gate (gCa/r) is not quite of this form.  For V > EREST_ACT, alpha =
 #  5*{exp({-50*(V - EREST_ACT)})}.  Otherwise, alpha = 5.  Over the entire
 #  range, alpha + beta = 5.  To create the Y_A and Y_B tables, we use some
 #  of the pieces of the setupalpha function.
-	ygate = moose.element( 'Ca/gateY' )
-	ygate.min = -0.1
-	ygate.max = 0.05
-	ygate.divs = 3000
-	yA = numpy.zeros( (ygate.divs + 1), dtype=float)
-	yB = numpy.zeros( (ygate.divs + 1), dtype=float)
+    ygate = moose.element( 'Ca/gateY' )
+    ygate.min = -0.1
+    ygate.max = 0.05
+    ygate.divs = 3000
+    yA = numpy.zeros( (ygate.divs + 1), dtype=float)
+    yB = numpy.zeros( (ygate.divs + 1), dtype=float)
 
 
 #Fill the Y_A table with alpha values and the Y_B table with (alpha+beta)
-	dx = (ygate.max - ygate.min)/ygate.divs
-	x = ygate.min
-	for i in range( ygate.divs + 1 ):
-		if ( x > EREST_ACT):
-			yA[i] = 5.0 * math.exp( -50 * (x - EREST_ACT) )
-		else:
-			yA[i] = 5.0
-		yB[i] = 5.0
-		x += dx
-	ygate.tableA = yA
-	ygate.tableB = yB
+    dx = (ygate.max - ygate.min)/ygate.divs
+    x = ygate.min
+    for i in range( ygate.divs + 1 ):
+        if ( x > EREST_ACT):
+            yA[i] = 5.0 * math.exp( -50 * (x - EREST_ACT) )
+        else:
+            yA[i] = 5.0
+        yB[i] = 5.0
+        x += dx
+    ygate.tableA = yA
+    ygate.tableB = yB
 # Tell the cell reader that the current from this channel must be fed into
 # the Ca_conc pool of calcium.
-	addmsg1 = moose.Mstring( '/library/Ca/addmsg1' )
-	addmsg1.value = '.	IkOut	../Ca_conc	current'
+    addmsg1 = moose.Mstring( '/library/Ca/addmsg1' )
+    addmsg1.value = '.    IkOut    ../Ca_conc    current'
 # in some compartments, whe have an NMDA_Ca_conc object to put the current
 # into.
-	addmsg2 = moose.Mstring( '/library/Ca/addmsg2' )
-	addmsg2.value = '.	IkOut	../NMDA_Ca_conc	current'
+    addmsg2 = moose.Mstring( '/library/Ca/addmsg2' )
+    addmsg2.value = '.    IkOut    ../NMDA_Ca_conc    current'
 # As we typically use the cell reader to create copies of these prototype
 #elements in one or more compartments, we need some way to be sure that the
 #needed messages are established.  Although the cell reader has enough
@@ -153,12 +153,12 @@ def make_Ca():
 #//========================================================================
 
 def make_Ca_conc():
-	if moose.exists( 'Ca_conc' ):
-		return
-	conc = moose.CaConc( 'Ca_conc' )
-	conc.tau = 0.013333  # sec
-	conc.B  = 17.402e12 # Curr to conc conversion for soma
-	conc.Ca_base = 0.0
+    if moose.exists( 'Ca_conc' ):
+        return
+    conc = moose.CaConc( 'Ca_conc' )
+    conc.tau = 0.013333  # sec
+    conc.B  = 17.402e12 # Curr to conc conversion for soma
+    conc.Ca_base = 0.0
 
 #This Ca_concen element should receive a message from any calcium channels
 # with the current going through the channel. Here we have this specified
@@ -176,38 +176,38 @@ def make_Ca_conc():
 #  functions of concentration, instead of voltage.
 
 def make_K_AHP():
-	if moose.exists( 'K_AHP' ):
-		return
-
-	K_AHP = moose.HHChannel( 'K_AHP' )
-	K_AHP.Ek = EK	#			V
-	K_AHP.Gbar = 8 * SOMA_A #	S
-	K_AHP.Gk = 0	#	S
-	K_AHP.Xpower = 0
-	K_AHP.Ypower = 0
-	K_AHP.Zpower = 1
-
-	zgate = moose.element( 'K_AHP/gateZ' )
-	xmax = 500.0
-	zgate.min = 0
-	zgate.max = xmax
-	zgate.divs = 3000
-	zA = numpy.zeros( (zgate.divs + 1), dtype=float)
-	zB = numpy.zeros( (zgate.divs + 1), dtype=float)
-	dx = (zgate.max - zgate.min)/zgate.divs
-	x = zgate.min
-	for i in range( zgate.divs + 1 ):
-		if (x < (xmax / 2.0 )):
-			zA[i] = 0.02*x
-		else:
-			zA[i] = 10.0
-		zB[i] = zA[i] + 1.0
-		x = x + dx
-
-	zgate.tableA = zA
-	zgate.tableB = zB
-	addmsg1 = moose.Mstring( '/library/K_AHP/addmsg1' )
-	addmsg1.value = '../Ca_conc	concOut	. concen'
+    if moose.exists( 'K_AHP' ):
+        return
+
+    K_AHP = moose.HHChannel( 'K_AHP' )
+    K_AHP.Ek = EK    #            V
+    K_AHP.Gbar = 8 * SOMA_A #    S
+    K_AHP.Gk = 0    #    S
+    K_AHP.Xpower = 0
+    K_AHP.Ypower = 0
+    K_AHP.Zpower = 1
+
+    zgate = moose.element( 'K_AHP/gateZ' )
+    xmax = 500.0
+    zgate.min = 0
+    zgate.max = xmax
+    zgate.divs = 3000
+    zA = numpy.zeros( (zgate.divs + 1), dtype=float)
+    zB = numpy.zeros( (zgate.divs + 1), dtype=float)
+    dx = (zgate.max - zgate.min)/zgate.divs
+    x = zgate.min
+    for i in range( zgate.divs + 1 ):
+        if (x < (xmax / 2.0 )):
+            zA[i] = 0.02*x
+        else:
+            zA[i] = 10.0
+        zB[i] = zA[i] + 1.0
+        x = x + dx
+
+    zgate.tableA = zA
+    zgate.tableB = zB
+    addmsg1 = moose.Mstring( '/library/K_AHP/addmsg1' )
+    addmsg1.value = '../Ca_conc    concOut    . concen'
 # Use an added field to tell the cell reader to set up a message from the
 # Ca_Conc with concentration info, to the current K_AHP object.
 
@@ -228,71 +228,71 @@ def make_K_AHP():
 #the multiplicative Ca-dependent factor in the conductance.
 
 def make_K_C():
-	if moose.exists( 'K_C'):
-		return
-
-	K_C = moose.HHChannel( 'K_C' )
-	K_C.Ek = EK					#	V
-	K_C.Gbar = 100.0 * SOMA_A 	#	S
-	K_C.Gk = 0					#	S
-	K_C.Xpower = 1
-	K_C.Zpower = 1
-	K_C.instant = 4				# Flag: 0x100 means Z gate is instant.
-
-	# Now make a X-table for the voltage-dependent activation parameter.
-	xgate = moose.element( 'K_C/gateX' )
-	xgate.min = -0.1
-	xgate.max = 0.05
-	xgate.divs = 3000
-	xA = numpy.zeros( (xgate.divs + 1), dtype=float)
-	xB = numpy.zeros( (xgate.divs + 1), dtype=float)
-	dx = (xgate.max - xgate.min)/xgate.divs
-	x = xgate.min
-	for i in range( xgate.divs + 1 ):
-		alpha = 0.0
-		beta = 0.0
-		if (x < EREST_ACT + 0.05):
-			alpha = math.exp( 53.872 * (x - EREST_ACT) - 0.66835 ) / 0.018975
-			beta = 2000* (math.exp ( (EREST_ACT + 0.0065 - x)/0.027)) - alpha
-		else:
-			alpha = 2000 * math.exp( ( EREST_ACT + 0.0065 - x)/0.027 )
-			beta = 0.0
-		xA[i] = alpha
-		xB[i] = alpha + beta
-		x = x + dx
-	xgate.tableA = xA
-	xgate.tableB = xB
+    if moose.exists( 'K_C'):
+        return
+
+    K_C = moose.HHChannel( 'K_C' )
+    K_C.Ek = EK                    #    V
+    K_C.Gbar = 100.0 * SOMA_A     #    S
+    K_C.Gk = 0                    #    S
+    K_C.Xpower = 1
+    K_C.Zpower = 1
+    K_C.instant = 4                # Flag: 0x100 means Z gate is instant.
+
+    # Now make a X-table for the voltage-dependent activation parameter.
+    xgate = moose.element( 'K_C/gateX' )
+    xgate.min = -0.1
+    xgate.max = 0.05
+    xgate.divs = 3000
+    xA = numpy.zeros( (xgate.divs + 1), dtype=float)
+    xB = numpy.zeros( (xgate.divs + 1), dtype=float)
+    dx = (xgate.max - xgate.min)/xgate.divs
+    x = xgate.min
+    for i in range( xgate.divs + 1 ):
+        alpha = 0.0
+        beta = 0.0
+        if (x < EREST_ACT + 0.05):
+            alpha = math.exp( 53.872 * (x - EREST_ACT) - 0.66835 ) / 0.018975
+            beta = 2000* (math.exp ( (EREST_ACT + 0.0065 - x)/0.027)) - alpha
+        else:
+            alpha = 2000 * math.exp( ( EREST_ACT + 0.0065 - x)/0.027 )
+            beta = 0.0
+        xA[i] = alpha
+        xB[i] = alpha + beta
+        x = x + dx
+    xgate.tableA = xA
+    xgate.tableB = xB
 
 # Create a table for the function of concentration, allowing a
 # concentration range of 0 to 1000, with 50 divisions.  This is done
 # using the Z gate, which can receive a CONCEN message.  By using
 # the "instant" flag, the A and B tables are evaluated as lookup tables,
 #  rather than being used in a differential equation.
-	zgate = moose.element( 'K_C/gateZ' )
-	zgate.min = 0.0
-	xmax = 500.0
-	zgate.max = xmax
-	zgate.divs = 3000
-	zA = numpy.zeros( (zgate.divs + 1), dtype=float)
-	zB = numpy.zeros( (zgate.divs + 1), dtype=float)
-	dx = ( zgate.max -  zgate.min)/ zgate.divs
-	x = zgate.min
-	for i in range( xgate.divs + 1 ):
-		if ( x < ( xmax / 4.0 ) ):
-			zA[i] = x * 4.0 / xmax
-		else:
-			zA[i] = 1.0
-		zB[i] = 1.0
-		x += dx
-	zgate.tableA = zA
-	zgate.tableB = zB
+    zgate = moose.element( 'K_C/gateZ' )
+    zgate.min = 0.0
+    xmax = 500.0
+    zgate.max = xmax
+    zgate.divs = 3000
+    zA = numpy.zeros( (zgate.divs + 1), dtype=float)
+    zB = numpy.zeros( (zgate.divs + 1), dtype=float)
+    dx = ( zgate.max -  zgate.min)/ zgate.divs
+    x = zgate.min
+    for i in range( xgate.divs + 1 ):
+        if ( x < ( xmax / 4.0 ) ):
+            zA[i] = x * 4.0 / xmax
+        else:
+            zA[i] = 1.0
+        zB[i] = 1.0
+        x += dx
+    zgate.tableA = zA
+    zgate.tableB = zB
 
 # Now we need to provide for messages that link to external elements.
 # The message that sends the Ca concentration to the Z gate tables is stored
 # in an added field of the channel, so that it may be found by the cell
 # reader.
-	addmsg1 = moose.Mstring( '/library/K_C/addmsg1' )
-	addmsg1.value = '../Ca_conc	concOut	. concen'
+    addmsg1 = moose.Mstring( '/library/K_C/addmsg1' )
+    addmsg1.value = '../Ca_conc    concOut    . concen'
 
 
 # The remaining channels are straightforward tabchannel implementations
@@ -301,133 +301,133 @@ def make_K_C():
 #/                Tabchannel Na Hippocampal cell channel
 #/========================================================================
 def make_Na():
-	if moose.exists( 'Na' ):
-		return
-	Na = moose.HHChannel( 'Na' )
-	Na.Ek = ENA				#	V
-	Na.Gbar = 300 * SOMA_A	#	S
-	Na.Gk = 0				#	S
-	Na.Xpower = 2
-	Na.Ypower = 1
-	Na.Zpower = 0
-
-	xgate = moose.element( 'Na/gateX' )
-	xA = numpy.array( [ 320e3 * (0.0131 + EREST_ACT),
-		-320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004, 
-		-280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, 
-		-1.0 * (0.0401 + EREST_ACT), 5.0e-3, 
-		3000, -0.1, 0.05 ] )
-	xgate.alphaParms = xA
-
-
-	#xgate.alpha( 320e3 * (0.0131 + EREST_ACT), -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004 )
-	#xgate.beta( -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 5.0e-3 )
-
-	ygate = moose.element( 'Na/gateY' )
-	yA = numpy.array( [ 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018,
-		4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3, 
-		3000, -0.1, 0.05 ] )
-	ygate.alphaParms = yA
-
-	#ygate.alpha( 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018 )
-	#ygate.beta( 4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3 )
+    if moose.exists( 'Na' ):
+        return
+    Na = moose.HHChannel( 'Na' )
+    Na.Ek = ENA                #    V
+    Na.Gbar = 300 * SOMA_A    #    S
+    Na.Gk = 0                #    S
+    Na.Xpower = 2
+    Na.Ypower = 1
+    Na.Zpower = 0
+
+    xgate = moose.element( 'Na/gateX' )
+    xA = numpy.array( [ 320e3 * (0.0131 + EREST_ACT),
+        -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004, 
+        -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, 
+        -1.0 * (0.0401 + EREST_ACT), 5.0e-3, 
+        3000, -0.1, 0.05 ] )
+    xgate.alphaParms = xA
+
+
+    #xgate.alpha( 320e3 * (0.0131 + EREST_ACT), -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004 )
+    #xgate.beta( -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 5.0e-3 )
+
+    ygate = moose.element( 'Na/gateY' )
+    yA = numpy.array( [ 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018,
+        4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3, 
+        3000, -0.1, 0.05 ] )
+    ygate.alphaParms = yA
+
+    #ygate.alpha( 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018 )
+    #ygate.beta( 4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3 )
 
 #========================================================================
 #                Tabchannel K(DR) Hippocampal cell channel
 #========================================================================
 def make_K_DR():
-	if moose.exists( 'K_DR' ):
-		return
-	K_DR = moose.HHChannel( 'K_DR' )
-	K_DR.Ek = EK				#	V
-	K_DR.Gbar = 150 * SOMA_A	#	S
-	K_DR.Gk = 0				#	S
-	K_DR.Xpower = 1
-	K_DR.Ypower = 0
-	K_DR.Zpower = 0
-
-	xgate = moose.element( 'K_DR/gateX' )
-	xA = numpy.array( [ 16e3 * (0.0351 + EREST_ACT), 
-		-16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005,
-		250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04,
-		3000, -0.1, 0.05 ] )
-	xgate.alphaParms = xA
-	#xgate.alpha( 16e3 * (0.0351 + EREST_ACT), -16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005 )
-	#xgate.beta( 250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04 )
+    if moose.exists( 'K_DR' ):
+        return
+    K_DR = moose.HHChannel( 'K_DR' )
+    K_DR.Ek = EK                #    V
+    K_DR.Gbar = 150 * SOMA_A    #    S
+    K_DR.Gk = 0                #    S
+    K_DR.Xpower = 1
+    K_DR.Ypower = 0
+    K_DR.Zpower = 0
+
+    xgate = moose.element( 'K_DR/gateX' )
+    xA = numpy.array( [ 16e3 * (0.0351 + EREST_ACT), 
+        -16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005,
+        250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04,
+        3000, -0.1, 0.05 ] )
+    xgate.alphaParms = xA
+    #xgate.alpha( 16e3 * (0.0351 + EREST_ACT), -16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005 )
+    #xgate.beta( 250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04 )
 
 #========================================================================
 #                Tabchannel K(A) Hippocampal cell channel
 #========================================================================
 def make_K_A():
-	if moose.exists( 'K_A' ):
-		return
-	K_A = moose.HHChannel( 'K_A' )
-	K_A.Ek = EK				#	V
-	K_A.Gbar = 50 * SOMA_A	#	S
-	K_A.Gk = 0				#	S
-	K_A.Xpower = 1
-	K_A.Ypower = 1
-	K_A.Zpower = 0
-
-	xgate = moose.element( 'K_A/gateX' )
-	xA = numpy.array( [ 20e3 * (0.0131 + EREST_ACT), 
-		-20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01,
-		-17.5e3 * (0.0401 + EREST_ACT), 
-		17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01,
-		3000, -0.1, 0.05 ] )
-	xgate.alphaParms = xA
-	# xgate.alpha( 20e3 * (0.0131 + EREST_ACT), -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01 )
-	# xgate.beta( -17.5e3 * (0.0401 + EREST_ACT), 17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01 )
-
-	ygate = moose.element( 'K_A/gateY' )
-	yA = numpy.array( [ 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018,
-		50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005,
-		3000, -0.1, 0.05 ] )
-	ygate.alphaParms = yA
-	# ygate.alpha( 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018 )
-	# ygate.beta( 50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005 )
+    if moose.exists( 'K_A' ):
+        return
+    K_A = moose.HHChannel( 'K_A' )
+    K_A.Ek = EK                #    V
+    K_A.Gbar = 50 * SOMA_A    #    S
+    K_A.Gk = 0                #    S
+    K_A.Xpower = 1
+    K_A.Ypower = 1
+    K_A.Zpower = 0
+
+    xgate = moose.element( 'K_A/gateX' )
+    xA = numpy.array( [ 20e3 * (0.0131 + EREST_ACT), 
+        -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01,
+        -17.5e3 * (0.0401 + EREST_ACT), 
+        17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01,
+        3000, -0.1, 0.05 ] )
+    xgate.alphaParms = xA
+    # xgate.alpha( 20e3 * (0.0131 + EREST_ACT), -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01 )
+    # xgate.beta( -17.5e3 * (0.0401 + EREST_ACT), 17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01 )
+
+    ygate = moose.element( 'K_A/gateY' )
+    yA = numpy.array( [ 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018,
+        50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005,
+        3000, -0.1, 0.05 ] )
+    ygate.alphaParms = yA
+    # ygate.alpha( 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018 )
+    # ygate.beta( 50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005 )
 #========================================================================
 #                SynChan: Glu receptor
 #========================================================================
 
 def make_glu():
-	if moose.exists( 'glu' ):
-		return
-	glu = moose.SynChan( 'glu' )
-	glu.Ek = 0.0
-	glu.tau1 = 2.0e-3
-	glu.tau2 = 9.0e-3
-	glu.Gbar = 40 * SOMA_A
+    if moose.exists( 'glu' ):
+        return
+    glu = moose.SynChan( 'glu' )
+    glu.Ek = 0.0
+    glu.tau1 = 2.0e-3
+    glu.tau2 = 9.0e-3
+    glu.Gbar = 40 * SOMA_A
 
 #========================================================================
 #                SynChan: NMDA receptor
 #========================================================================
 
 def make_NMDA():
-	if moose.exists( 'NMDA' ):
-		return
-	NMDA = moose.SynChan( 'NMDA' )
-	NMDA.Ek = 0.0
-	NMDA.tau1 = 20.0e-3
-	NMDA.tau2 = 20.0e-3
-	NMDA.Gbar = 5 * SOMA_A
-
-	block = moose.MgBlock( '/library/NMDA/block' )
-	block.CMg = 1.2		#	[Mg] in mM
-	block.Zk = 2
-	block.KMg_A = 1.0/0.28
-	block.KMg_B = 1.0/62
-
-	moose.connect( NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
-	addmsg1 = moose.Mstring( '/library/NMDA/addmsg1' )
-	addmsg1.value = '.. channel	./block	channel'
-	#Here we want to also tell the cell reader to _remove_ the original
-	#Gk, Ek term going from the channel to the compartment, as this is
-	# now handled by the MgBlock.
-	#addmsg2 = moose.Mstring( 'NMDA/addmsg2'
-	#addmsg2.value = 'DropMsg	..	channel'
-	addmsg3 = moose.Mstring( '/library/NMDA/addmsg3' )
-	addmsg3.value = '.. VmOut	.	Vm'
+    if moose.exists( 'NMDA' ):
+        return
+    NMDA = moose.SynChan( 'NMDA' )
+    NMDA.Ek = 0.0
+    NMDA.tau1 = 20.0e-3
+    NMDA.tau2 = 20.0e-3
+    NMDA.Gbar = 5 * SOMA_A
+
+    block = moose.MgBlock( '/library/NMDA/block' )
+    block.CMg = 1.2        #    [Mg] in mM
+    block.Zk = 2
+    block.KMg_A = 1.0/0.28
+    block.KMg_B = 1.0/62
+
+    moose.connect( NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
+    addmsg1 = moose.Mstring( '/library/NMDA/addmsg1' )
+    addmsg1.value = '.. channel    ./block    channel'
+    #Here we want to also tell the cell reader to _remove_ the original
+    #Gk, Ek term going from the channel to the compartment, as this is
+    # now handled by the MgBlock.
+    #addmsg2 = moose.Mstring( 'NMDA/addmsg2'
+    #addmsg2.value = 'DropMsg    ..    channel'
+    addmsg3 = moose.Mstring( '/library/NMDA/addmsg3' )
+    addmsg3.value = '.. VmOut    .    Vm'
 
 
 #addfield NMDA addmsg1
@@ -448,37 +448,37 @@ def make_NMDA():
 #========================================================================
 
 def make_Ca_NMDA():
-	if moose.exists( 'Ca_NMDA' ):
-		return
-	Ca_NMDA = moose.SynChan( 'Ca_NMDA' )
-	Ca_NMDA.Ek = ECA
-	Ca_NMDA.tau1 = 20.0e-3
-	Ca_NMDA.tau2 = 20.0e-3
-	Ca_NMDA.Gbar = 5 * SOMA_A
-
-	block = moose.MgBlock( '/library/Ca_NMDA/block' )
-	block.CMg = 1.2		#	[Mg] in mM
-	block.Zk = 2
-	block.KMg_A = 1.0/0.28
-	block.KMg_B = 1.0/62
-
-	moose.connect( Ca_NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
-	addmsg1 = moose.Mstring( '/library/Ca_NMDA/addmsg1' )
-	addmsg1.value = '.. VmOut	./block	Vm'
-	addmsg2 = moose.Mstring( '/library/Ca_NMDA/addmsg2' )
-	addmsg2.value = './block	IkOut ../NMDA_Ca_conc current'
-	# The original model has the Ca current also coming here.
+    if moose.exists( 'Ca_NMDA' ):
+        return
+    Ca_NMDA = moose.SynChan( 'Ca_NMDA' )
+    Ca_NMDA.Ek = ECA
+    Ca_NMDA.tau1 = 20.0e-3
+    Ca_NMDA.tau2 = 20.0e-3
+    Ca_NMDA.Gbar = 5 * SOMA_A
+
+    block = moose.MgBlock( '/library/Ca_NMDA/block' )
+    block.CMg = 1.2        #    [Mg] in mM
+    block.Zk = 2
+    block.KMg_A = 1.0/0.28
+    block.KMg_B = 1.0/62
+
+    moose.connect( Ca_NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
+    addmsg1 = moose.Mstring( '/library/Ca_NMDA/addmsg1' )
+    addmsg1.value = '.. VmOut    ./block    Vm'
+    addmsg2 = moose.Mstring( '/library/Ca_NMDA/addmsg2' )
+    addmsg2.value = './block    IkOut ../NMDA_Ca_conc current'
+    # The original model has the Ca current also coming here.
 
 #========================================================================
 # Ca pool for influx through Ca_NMDA
 #========================================================================
 def make_NMDA_Ca_conc():
-	if moose.exists( 'NMDA_Ca_conc' ):
-		return
-	NMDA_Ca_conc = moose.CaConc( 'NMDA_Ca_conc' )
-	NMDA_Ca_conc.tau = 0.004   	# sec. Faster in spine than dend
-	NMDA_Ca_conc.B = 17.402e12	# overridden by cellreader.
-	NMDA_Ca_conc.Ca_base = 0.0
+    if moose.exists( 'NMDA_Ca_conc' ):
+        return
+    NMDA_Ca_conc = moose.CaConc( 'NMDA_Ca_conc' )
+    NMDA_Ca_conc.tau = 0.004       # sec. Faster in spine than dend
+    NMDA_Ca_conc.B = 17.402e12    # overridden by cellreader.
+    NMDA_Ca_conc.Ca_base = 0.0
 
 # This pool used to set up Ca info coming to it. Now we insist that the
 # originating channel should specify the deferred message.
@@ -489,9 +489,9 @@ def make_NMDA_Ca_conc():
 
 #//addmsg axon/spike axon BUFFER name
 def make_axon():
-	if moose.exists( 'axon' ):
-		return
-	axon = moose.SpikeGen( 'axon' )
-	axon.threshold = -40e-3 			#	V
-	axon.abs_refract = 10e-3			# 	sec
+    if moose.exists( 'axon' ):
+        return
+    axon = moose.SpikeGen( 'axon' )
+    axon.threshold = -40e-3             #    V
+    axon.abs_refract = 10e-3            #     sec
 
diff --git a/snippets/MULTI/runcell18.py b/snippets/MULTI/runcell18.py
index 3007dd72..cbe5037c 100644
--- a/snippets/MULTI/runcell18.py
+++ b/snippets/MULTI/runcell18.py
@@ -6,10 +6,10 @@ import moose
 import proto18
 
 def dumpPlots( fname ):
-	if ( os.path.exists( fname ) ):
-		os.remove( fname )
-	tab.xplot( fname, 'soma.Vm' )
-	catab.xplot( fname, 'soma.Ca' )
+    if ( os.path.exists( fname ) ):
+        os.remove( fname )
+    tab.xplot( fname, 'soma.Vm' )
+    catab.xplot( fname, 'soma.Ca' )
 
 library = moose.Neutral( '/library' )
 moose.setCwe( '/library' )
@@ -38,7 +38,7 @@ soma.inject = 2e-10
 moose.connect( tab, 'requestOut', soma, 'getVm' )
 capool = moose.element( '/cell/soma/Ca_conc' )
 moose.connect( catab, 'requestOut', capool, 'getCa' )
-print 1
+print((1))
 dt = 50e-6
 moose.setClock( 0, dt )
 moose.setClock( 1, dt )
@@ -49,12 +49,12 @@ moose.useClock( 1, '/cell/##[ISA=Compartment]', 'process' )
 moose.useClock( 2, '/cell/##[ISA!=Compartment]', 'process' )
 moose.useClock( 3, '/graphs/soma,/graphs/ca', 'process' )
 
-print 2
+print((2))
 moose.reinit()
-print 3
+print((3))
 moose.start( 0.1 )
 dumpPlots( '50usec.plot' )
-print 4
+print((4))
 moose.reinit()
 hsolve = moose.HSolve( '/cell/hsolve' )
 moose.useClock( 1, '/cell/hsolve', 'process' )
@@ -62,10 +62,10 @@ hsolve.dt = dt
 hsolve.target = '/cell/soma'
 moose.reinit()
 moose.reinit()
-print 5
+print((5))
 moose.start( 0.1 )
-print 6
+print((6))
 
 dumpPlots( 'h50usec.plot' )
 
-print 7
+print((7))
diff --git a/snippets/MULTI/x_compt.py b/snippets/MULTI/x_compt.py
index 1aeba1f2..62c20560 100644
--- a/snippets/MULTI/x_compt.py
+++ b/snippets/MULTI/x_compt.py
@@ -44,23 +44,23 @@ import proto18
 EREST_ACT = -70e-3
 
 def loadElec():
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	proto18.make_Ca()
-	proto18.make_Ca_conc()
-	proto18.make_K_AHP()
-	proto18.make_K_C()
-	proto18.make_Na()
-	proto18.make_K_DR()
-	proto18.make_K_A()
-	proto18.make_glu()
-	proto18.make_NMDA()
-	proto18.make_Ca_NMDA()
-	proto18.make_NMDA_Ca_conc()
-	proto18.make_axon()
-	model = moose.Neutral( '/model' )
-	cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "hsolve" )
-	return cellId
+    library = moose.Neutral( '/library' )
+    moose.setCwe( '/library' )
+    proto18.make_Ca()
+    proto18.make_Ca_conc()
+    proto18.make_K_AHP()
+    proto18.make_K_C()
+    proto18.make_Na()
+    proto18.make_K_DR()
+    proto18.make_K_A()
+    proto18.make_glu()
+    proto18.make_NMDA()
+    proto18.make_Ca_NMDA()
+    proto18.make_NMDA_Ca_conc()
+    proto18.make_axon()
+    model = moose.Neutral( '/model' )
+    cellId = moose.loadModel( 'ca1_asym.p', '/model/elec', "hsolve" )
+    return cellId
 
 def addPlot( objpath, field, plot ):
     assert moose.exists( objpath )
@@ -79,169 +79,169 @@ def dumpPlots( fname ):
         moose.element( x[0] ).xplot( fname, x[0].name + '_e' )
 
 def moveCompt( path, oldParent, newParent ):
-	meshEntries = moose.element( newParent.path + '/mesh' )
-	# Set up vol messaging from new compts to all their child objects.
-	for x in moose.wildcardFind( path + '/##[ISA=PoolBase]' ):
-		moose.connect( meshEntries, 'mesh', x, 'mesh', 'OneToOne' )
-	orig = moose.element( path )
-	moose.move( orig, newParent )
-	moose.delete( moose.vec( oldParent.path ) )
-	chem = moose.element( '/model/chem' )
-	moose.move( newParent, chem )
+    meshEntries = moose.element( newParent.path + '/mesh' )
+    # Set up vol messaging from new compts to all their child objects.
+    for x in moose.wildcardFind( path + '/##[ISA=PoolBase]' ):
+        moose.connect( meshEntries, 'mesh', x, 'mesh', 'OneToOne' )
+    orig = moose.element( path )
+    moose.move( orig, newParent )
+    moose.delete( moose.vec( oldParent.path ) )
+    chem = moose.element( '/model/chem' )
+    moose.move( newParent, chem )
 
 def loadChem( neuroCompt, spineCompt, psdCompt ):
-	# We need the compartments to come in with a volume of 1 to match the
-	# original CubeMesh.
-	assert( neuroCompt.volume == 1.0 )
-	assert( spineCompt.volume == 1.0 )
-	assert( psdCompt.volume == 1.0 )
-	assert( neuroCompt.mesh.num == 1 )
-	#print 'volume = ', neuroCompt.mesh[0].volume
-	#assert( neuroCompt.mesh[0].volume == 1.0 ) 
-	#an unfortunate mismatch
-	# So we'll have to resize the volumes of the current compartments to the
-	# new ones.
-
-	modelId = moose.loadModel( 'x_compt.g', '/model', 'ee' )
-	chem = moose.element( '/model/model' )
-	chem.name = 'chem'
-	oldN = moose.element( '/model/chem/compartment_1' )
-	oldS = moose.element( '/model/chem/compartment_2' )
-	oldP = moose.element( '/model/chem/kinetics' )
-	oldN.volume = neuroCompt.mesh[0].volume
-	oldS.volume = spineCompt.mesh[0].volume
-	oldP.volume = psdCompt.mesh[0].volume
-	moveCompt( '/model/chem/kinetics/DEND', oldN, neuroCompt )
-	moveCompt( '/model/chem/kinetics/SPINE', oldS, spineCompt )
-	moveCompt( '/model/chem/kinetics/PSD', oldP, psdCompt )
+    # We need the compartments to come in with a volume of 1 to match the
+    # original CubeMesh.
+    assert( neuroCompt.volume == 1.0 )
+    assert( spineCompt.volume == 1.0 )
+    assert( psdCompt.volume == 1.0 )
+    assert( neuroCompt.mesh.num == 1 )
+    #print 'volume = ', neuroCompt.mesh[0].volume
+    #assert( neuroCompt.mesh[0].volume == 1.0 ) 
+    #an unfortunate mismatch
+    # So we'll have to resize the volumes of the current compartments to the
+    # new ones.
+
+    modelId = moose.loadModel( 'x_compt.g', '/model', 'ee' )
+    chem = moose.element( '/model/model' )
+    chem.name = 'chem'
+    oldN = moose.element( '/model/chem/compartment_1' )
+    oldS = moose.element( '/model/chem/compartment_2' )
+    oldP = moose.element( '/model/chem/kinetics' )
+    oldN.volume = neuroCompt.mesh[0].volume
+    oldS.volume = spineCompt.mesh[0].volume
+    oldP.volume = psdCompt.mesh[0].volume
+    moveCompt( '/model/chem/kinetics/DEND', oldN, neuroCompt )
+    moveCompt( '/model/chem/kinetics/SPINE', oldS, spineCompt )
+    moveCompt( '/model/chem/kinetics/PSD', oldP, psdCompt )
 
 def makeNeuroMeshModel():
-	diffLength = 20e-6 # But we only want diffusion over part of the model.
-	numSyn = 13
-	elec = loadElec()
-	synInput = moose.SpikeGen( '/model/elec/synInput' )
-	synInput.threshold = -1.0
-	synInput.edgeTriggered = 0
-	synInput.Vm( 0 )
-	synInput.refractT = 47e-3
-
-	for i in range( numSyn ):
-		name = '/model/elec/spine_head_14_' + str( i + 1 )
-		r = moose.element( name + '/glu' )
-		r.synapse.num = 1 
-		syn = moose.element( r.path + '/synapse' )
-		moose.connect( synInput, 'spikeOut', syn, 'addSpike', 'Single' )
-		syn.weight = 0.2 * i * ( numSyn - 1 - i )
-		syn.delay = i * 1.0e-3
-
-	neuroCompt = moose.NeuroMesh( '/model/neuroMesh' )
-	#print 'neuroMeshvolume = ', neuroCompt.mesh[0].volume
-	neuroCompt.separateSpines = 1
-	neuroCompt.diffLength = diffLength
-	neuroCompt.geometryPolicy = 'cylinder'
-	spineCompt = moose.SpineMesh( '/model/spineMesh' )
-	#print 'spineMeshvolume = ', spineCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
-	psdCompt = moose.PsdMesh( '/model/psdMesh' )
-	#print 'psdMeshvolume = ', psdCompt.mesh[0].volume
-	moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
-	loadChem( neuroCompt, spineCompt, psdCompt )
-	#for x in moose.wildcardFind( '/model/chem/##/Ca' ):
-	#	x.diffConst = 1e-11
-
-	# Put in the solvers, see how they fare.
-	nmksolve = moose.GslStoich( '/model/chem/neuroMesh/ksolve' )
-	nmksolve.path = '/model/chem/neuroMesh/##'
-	nmksolve.compartment = moose.element( '/model/chem/neuroMesh' )
-	nmksolve.method = 'rk5'
-	nm = moose.element( '/model/chem/neuroMesh/mesh' )
-	moose.connect( nm, 'remesh', nmksolve, 'remesh' )
+    diffLength = 20e-6 # But we only want diffusion over part of the model.
+    numSyn = 13
+    elec = loadElec()
+    synInput = moose.SpikeGen( '/model/elec/synInput' )
+    synInput.threshold = -1.0
+    synInput.edgeTriggered = 0
+    synInput.Vm( 0 )
+    synInput.refractT = 47e-3
+
+    for i in range( numSyn ):
+        name = '/model/elec/spine_head_14_' + str( i + 1 )
+        r = moose.element( name + '/glu' )
+        r.synapse.num = 1 
+        syn = moose.element( r.path + '/synapse' )
+        moose.connect( synInput, 'spikeOut', syn, 'addSpike', 'Single' )
+        syn.weight = 0.2 * i * ( numSyn - 1 - i )
+        syn.delay = i * 1.0e-3
+
+    neuroCompt = moose.NeuroMesh( '/model/neuroMesh' )
+    #print 'neuroMeshvolume = ', neuroCompt.mesh[0].volume
+    neuroCompt.separateSpines = 1
+    neuroCompt.diffLength = diffLength
+    neuroCompt.geometryPolicy = 'cylinder'
+    spineCompt = moose.SpineMesh( '/model/spineMesh' )
+    #print 'spineMeshvolume = ', spineCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'spineListOut', spineCompt, 'spineList', 'OneToOne' )
+    psdCompt = moose.PsdMesh( '/model/psdMesh' )
+    #print 'psdMeshvolume = ', psdCompt.mesh[0].volume
+    moose.connect( neuroCompt, 'psdListOut', psdCompt, 'psdList', 'OneToOne' )
+    loadChem( neuroCompt, spineCompt, psdCompt )
+    #for x in moose.wildcardFind( '/model/chem/##/Ca' ):
+    #    x.diffConst = 1e-11
+
+    # Put in the solvers, see how they fare.
+    nmksolve = moose.GslStoich( '/model/chem/neuroMesh/ksolve' )
+    nmksolve.path = '/model/chem/neuroMesh/##'
+    nmksolve.compartment = moose.element( '/model/chem/neuroMesh' )
+    nmksolve.method = 'rk5'
+    nm = moose.element( '/model/chem/neuroMesh/mesh' )
+    moose.connect( nm, 'remesh', nmksolve, 'remesh' )
     #print "neuron: nv=", nmksolve.numLocalVoxels, ", nav=", nmksolve.numAllVoxels, nmksolve.numVarPools, nmksolve.numAllPools
 
     #print 'setting up smksolve'
-	smksolve = moose.GslStoich( '/model/chem/spineMesh/ksolve' )
-	smksolve.path = '/model/chem/spineMesh/##'
-	smksolve.compartment = moose.element( '/model/chem/spineMesh' )
-	smksolve.method = 'rk5'
-	sm = moose.element( '/model/chem/spineMesh/mesh' )
-	moose.connect( sm, 'remesh', smksolve, 'remesh' )
-	#print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
-	#
-	#print 'setting up pmksolve'
-	pmksolve = moose.GslStoich( '/model/chem/psdMesh/ksolve' )
-	pmksolve.path = '/model/chem/psdMesh/##'
-	pmksolve.compartment = moose.element( '/model/chem/psdMesh' )
-	pmksolve.method = 'rk5'
-	pm = moose.element( '/model/chem/psdMesh/mesh' )
-	moose.connect( pm, 'remesh', pmksolve, 'remesh' )
-	#print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
-	#
-	#print 'neuroMeshvolume = ', neuroCompt.mesh[0].volume
-
-	#print 'Assigning the cell model'
-	# Now to set up the model.
-	#neuroCompt.cell = elec
-	neuroCompt.cellPortion( elec, '/model/elec/lat_14_#,/model/elec/spine_neck#,/model/elec/spine_head#' )
-	ns = neuroCompt.numSegments
-	#assert( ns == 11 ) # dend, 5x (shaft+head)
-	ndc = neuroCompt.numDiffCompts
-	assert( ndc == 13 )
-	ndc = neuroCompt.mesh.num
-	assert( ndc == 13 )
-
-	sdc = spineCompt.mesh.num
-	assert( sdc == 13 )
-	pdc = psdCompt.mesh.num
-	assert( pdc == 13 )
-	#print 'mesh nums ( neuro, spine, psd ) = ', ndc, sdc, pdc, ', numSeg = ', ns
-
-	mesh = moose.vec( '/model/chem/neuroMesh/mesh' )
-	#for i in range( ndc ):
-	#	print 's[', i, '] = ', mesh[i].volume
-	mesh2 = moose.vec( '/model/chem/spineMesh/mesh' )
-#	for i in range( sdc ):
-#		print 's[', i, '] = ', mesh2[i].volume
-	#print 'numPSD = ', moose.element( '/model/chem/psdMesh/mesh' ).localNumField
-	mesh = moose.vec( '/model/chem/psdMesh/mesh' )
-	#print 'psd mesh.volume = ', mesh.volume
-	#for i in range( pdc ):
-	#	print 's[', i, '] = ', mesh[i].volume
-	#
-	# We need to use the spine solver as the master for the purposes of
-	# these calculations. This will handle the diffusion calculations
-	# between head and dendrite, and between head and PSD.
-	smksolve.addJunction( nmksolve )
-	#print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
-	smksolve.addJunction( pmksolve )
-	#print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
-
-	# oddly, numLocalFields does not work.
-	#moose.le( '/model/chem/neuroMesh' )
-	ca = moose.element( '/model/chem/neuroMesh/DEND/Ca' )
-	assert( ca.lastDimension == ndc )
-	"""
-	CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
-	print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
-	CaNspine = moose.vec( '/model/chem/spineMesh/SPINE/CaN_BULK/CaN' )
-	print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
-	"""
-
-	# set up adaptors
-	aCa = moose.Adaptor( '/model/chem/psdMesh/adaptCa', pdc )
-	adaptCa = moose.vec( '/model/chem/psdMesh/adaptCa' )
-	chemCa = moose.vec( '/model/chem/psdMesh/PSD/Ca' )
-	assert( len( adaptCa ) == pdc )
-	assert( len( chemCa ) == pdc )
-	for i in range( pdc ):
-		path = '/model/elec/spine_head_14_' + str( i + 1 ) + '/NMDA_Ca_conc'
-		elecCa = moose.element( path )
-		moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
-	moose.connect( adaptCa, 'outputSrc', chemCa, 'setConc', 'OneToOne' )
-	adaptCa.inputOffset = 0.0	# 
-	adaptCa.outputOffset = 0.000	# 100 nM offset in chem.
-   	adaptCa.scale = 1e-5	# 520 to 0.0052 mM
-	#print adaptCa.outputOffset
-	#print adaptCa.scale
+    smksolve = moose.GslStoich( '/model/chem/spineMesh/ksolve' )
+    smksolve.path = '/model/chem/spineMesh/##'
+    smksolve.compartment = moose.element( '/model/chem/spineMesh' )
+    smksolve.method = 'rk5'
+    sm = moose.element( '/model/chem/spineMesh/mesh' )
+    moose.connect( sm, 'remesh', smksolve, 'remesh' )
+    #print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
+    #
+    #print 'setting up pmksolve'
+    pmksolve = moose.GslStoich( '/model/chem/psdMesh/ksolve' )
+    pmksolve.path = '/model/chem/psdMesh/##'
+    pmksolve.compartment = moose.element( '/model/chem/psdMesh' )
+    pmksolve.method = 'rk5'
+    pm = moose.element( '/model/chem/psdMesh/mesh' )
+    moose.connect( pm, 'remesh', pmksolve, 'remesh' )
+    #print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
+    #
+    #print 'neuroMeshvolume = ', neuroCompt.mesh[0].volume
+
+    #print 'Assigning the cell model'
+    # Now to set up the model.
+    #neuroCompt.cell = elec
+    neuroCompt.cellPortion( elec, '/model/elec/lat_14_#,/model/elec/spine_neck#,/model/elec/spine_head#' )
+    ns = neuroCompt.numSegments
+    #assert( ns == 11 ) # dend, 5x (shaft+head)
+    ndc = neuroCompt.numDiffCompts
+    assert( ndc == 13 )
+    ndc = neuroCompt.mesh.num
+    assert( ndc == 13 )
+
+    sdc = spineCompt.mesh.num
+    assert( sdc == 13 )
+    pdc = psdCompt.mesh.num
+    assert( pdc == 13 )
+    #print 'mesh nums ( neuro, spine, psd ) = ', ndc, sdc, pdc, ', numSeg = ', ns
+
+    mesh = moose.vec( '/model/chem/neuroMesh/mesh' )
+    #for i in range( ndc ):
+    #    print 's[', i, '] = ', mesh[i].volume
+    mesh2 = moose.vec( '/model/chem/spineMesh/mesh' )
+#    for i in range( sdc ):
+#        print 's[', i, '] = ', mesh2[i].volume
+    #print 'numPSD = ', moose.element( '/model/chem/psdMesh/mesh' ).localNumField
+    mesh = moose.vec( '/model/chem/psdMesh/mesh' )
+    #print 'psd mesh.volume = ', mesh.volume
+    #for i in range( pdc ):
+    #    print 's[', i, '] = ', mesh[i].volume
+    #
+    # We need to use the spine solver as the master for the purposes of
+    # these calculations. This will handle the diffusion calculations
+    # between head and dendrite, and between head and PSD.
+    smksolve.addJunction( nmksolve )
+    #print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
+    smksolve.addJunction( pmksolve )
+    #print "psd: nv=", pmksolve.numLocalVoxels, ", nav=", pmksolve.numAllVoxels, pmksolve.numVarPools, pmksolve.numAllPools
+
+    # oddly, numLocalFields does not work.
+    #moose.le( '/model/chem/neuroMesh' )
+    ca = moose.element( '/model/chem/neuroMesh/DEND/Ca' )
+    assert( ca.lastDimension == ndc )
+    """
+    CaNpsd = moose.vec( '/model/chem/psdMesh/PSD/PP1_PSD/CaN' )
+    print 'numCaN in PSD = ', CaNpsd.nInit, ', vol = ', CaNpsd.volume
+    CaNspine = moose.vec( '/model/chem/spineMesh/SPINE/CaN_BULK/CaN' )
+    print 'numCaN in spine = ', CaNspine.nInit, ', vol = ', CaNspine.volume
+    """
+
+    # set up adaptors
+    aCa = moose.Adaptor( '/model/chem/psdMesh/adaptCa', pdc )
+    adaptCa = moose.vec( '/model/chem/psdMesh/adaptCa' )
+    chemCa = moose.vec( '/model/chem/psdMesh/PSD/Ca' )
+    assert( len( adaptCa ) == pdc )
+    assert( len( chemCa ) == pdc )
+    for i in range( pdc ):
+        path = '/model/elec/spine_head_14_' + str( i + 1 ) + '/NMDA_Ca_conc'
+        elecCa = moose.element( path )
+        moose.connect( elecCa, 'concOut', adaptCa[i], 'input', 'Single' )
+    moose.connect( adaptCa, 'outputSrc', chemCa, 'setConc', 'OneToOne' )
+    adaptCa.inputOffset = 0.0    # 
+    adaptCa.outputOffset = 0.000    # 100 nM offset in chem.
+    adaptCa.scale = 1e-5    # 520 to 0.0052 mM
+    #print adaptCa.outputOffset
+    #print adaptCa.scale
 
 def makeElecPlots():
     graphs = moose.Neutral( '/graphs' )
@@ -294,83 +294,83 @@ def makeChemPlots():
     addPlot( '/model/chem/spineMesh/SPINE/bar[6]', 'getConc', 'bar6' )
 
 def testNeuroMeshMultiscale():
-	elecDt = 50e-6
-	chemDt = 1e-4
-	plotDt = 5e-4
-	plotName = 'x_compt.plot'
-
-	makeNeuroMeshModel()
-	"""
-	for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
-		if ( i[0].diffConst > 0 ):
-			grandpaname = i.parent[0].parent.name + '/'
-			paname = i.parent[0].name + '/'
-			print grandpaname + paname + i[0].name, i[0].diffConst
-	"""
-	"""
-	moose.le( '/model/chem/spineMesh/ksolve' )
-	print 'Neighbors:'
-	for t in moose.element( '/model/chem/spineMesh/ksolve/junction' ).neighbors['masterJunction']:
-		print 'masterJunction <-', t.path
-	for t in moose.wildcardFind( '/model/chem/#Mesh/ksolve' ):
-		k = moose.element( t[0] )
-		print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
-	"""
-
-	makeChemPlots()
-	makeElecPlots()
-	moose.setClock( 0, elecDt )
-	moose.setClock( 1, elecDt )
-	moose.setClock( 2, elecDt )
-	moose.setClock( 5, chemDt )
-	moose.setClock( 6, chemDt )
-	moose.setClock( 7, plotDt )
-	moose.setClock( 8, plotDt )
-	moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
-	moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
-	moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
-	moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
-	moose.useClock( 6, '/model/chem/##[ISA=Adaptor]', 'process' )
-	moose.useClock( 7, '/graphs/#', 'process' )
-	moose.useClock( 8, '/graphs/elec/#', 'process' )
-	moose.useClock( 5, '/model/chem/#Mesh/ksolve', 'init' )
-	moose.useClock( 6, '/model/chem/#Mesh/ksolve', 'process' )
-	hsolve = moose.HSolve( '/model/elec/hsolve' )
-	moose.useClock( 1, '/model/elec/hsolve', 'process' )
-	hsolve.dt = elecDt
-	hsolve.target = '/model/elec/compt'
-	moose.reinit()
-	moose.reinit()
-	"""
-	print 'pre'
-	eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'dend'
-	eca = moose.vec( '/model/chem/neuroMesh/DEND/Ca' )
-	for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
-		print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-
-	print 'PSD'
-	eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	print 'spine'
-	eca = moose.vec( '/model/chem/spineMesh/SPINE/CaM/Ca' )
-	for i in range( 3 ):
-		print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
-	"""
-
-	moose.start( 0.5 )
-	dumpPlots( plotName )
-	print 'All done'
+    elecDt = 50e-6
+    chemDt = 1e-4
+    plotDt = 5e-4
+    plotName = 'x_compt.plot'
+
+    makeNeuroMeshModel()
+    """
+    for i in moose.wildcardFind( '/model/chem/##[ISA=PoolBase]' ):
+        if ( i[0].diffConst > 0 ):
+            grandpaname = i.parent[0].parent.name + '/'
+            paname = i.parent[0].name + '/'
+            print grandpaname + paname + i[0].name, i[0].diffConst
+    """
+    """
+    moose.le( '/model/chem/spineMesh/ksolve' )
+    print 'Neighbors:'
+    for t in moose.element( '/model/chem/spineMesh/ksolve/junction' ).neighbors['masterJunction']:
+        print 'masterJunction <-', t.path
+    for t in moose.wildcardFind( '/model/chem/#Mesh/ksolve' ):
+        k = moose.element( t[0] )
+        print k.path + ' localVoxels=', k.numLocalVoxels, ', allVoxels= ', k.numAllVoxels
+    """
+
+    makeChemPlots()
+    makeElecPlots()
+    moose.setClock( 0, elecDt )
+    moose.setClock( 1, elecDt )
+    moose.setClock( 2, elecDt )
+    moose.setClock( 5, chemDt )
+    moose.setClock( 6, chemDt )
+    moose.setClock( 7, plotDt )
+    moose.setClock( 8, plotDt )
+    moose.useClock( 0, '/model/elec/##[ISA=Compartment]', 'init' )
+    moose.useClock( 1, '/model/elec/##[ISA=SpikeGen]', 'process' )
+    moose.useClock( 2, '/model/elec/##[ISA=ChanBase],/model/##[ISA=SynBase],/model/##[ISA=CaConc]','process')
+    moose.useClock( 5, '/model/chem/##[ISA=PoolBase],/model/##[ISA=ReacBase],/model/##[ISA=EnzBase]', 'process' )
+    moose.useClock( 6, '/model/chem/##[ISA=Adaptor]', 'process' )
+    moose.useClock( 7, '/graphs/#', 'process' )
+    moose.useClock( 8, '/graphs/elec/#', 'process' )
+    moose.useClock( 5, '/model/chem/#Mesh/ksolve', 'init' )
+    moose.useClock( 6, '/model/chem/#Mesh/ksolve', 'process' )
+    hsolve = moose.HSolve( '/model/elec/hsolve' )
+    moose.useClock( 1, '/model/elec/hsolve', 'process' )
+    hsolve.dt = elecDt
+    hsolve.target = '/model/elec/compt'
+    moose.reinit()
+    moose.reinit()
+    """
+    print 'pre'
+    eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'dend'
+    eca = moose.vec( '/model/chem/neuroMesh/DEND/Ca' )
+    for i in ( 0, 1, 2, 30, 60, 90, 120, 144 ):
+        print i, eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+
+    print 'PSD'
+    eca = moose.vec( '/model/chem/psdMesh/PSD/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    print 'spine'
+    eca = moose.vec( '/model/chem/spineMesh/SPINE/CaM/Ca' )
+    for i in range( 3 ):
+        print eca[i].concInit, eca[i].conc, eca[i].nInit, eca[i].n, eca[i].volume
+    """
+
+    moose.start( 0.5 )
+    dumpPlots( plotName )
+    print('All done')
 
 
 def main():
-	testNeuroMeshMultiscale()
+    testNeuroMeshMultiscale()
 
 if __name__ == '__main__':
-	main()
+    main()
 
 # 
 # loadMulti.py ends here.
diff --git a/snippets/RandSpikeStats.py b/snippets/RandSpikeStats.py
index cea9c032..9be0ffa8 100644
--- a/snippets/RandSpikeStats.py
+++ b/snippets/RandSpikeStats.py
@@ -102,4 +102,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/STDP.py b/snippets/STDP.py
index ba01a96d..bd16f32d 100644
--- a/snippets/STDP.py
+++ b/snippets/STDP.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -157,7 +157,7 @@ def main():
     t_extent = 20e-3 # s
     # dt = tpost - tpre
     # negative dt corresponds to post before pre
-    print '-----------------------------------------------'
+    print('-----------------------------------------------')
     for deltat in arange(t_extent,0.0,-ddt):
         reset_settle()
         # post neuron spike
@@ -167,9 +167,9 @@ def main():
         make_neuron_spike(0)
         moose.start(1e-3)
         dw = ( syn.synapse[0].weight - weight ) / weight
-        print 'post before pre, dt = %1.3f s, dw/w = %1.3f'%(-deltat,dw)
+        print(('post before pre, dt = %1.3f s, dw/w = %1.3f'%(-deltat,dw)))
         dwlist_neg.append(dw)
-    print '-----------------------------------------------'
+    print('-----------------------------------------------')
     # positive dt corresponds to pre before post
     dwlist_pos = []
     for deltat in arange(ddt,t_extent+ddt,ddt):
@@ -181,9 +181,9 @@ def main():
         make_neuron_spike(1)
         moose.start(1e-3)
         dw = ( syn.synapse[0].weight - weight ) / weight
-        print 'pre before post, dt = %1.3f s, dw/w = %1.3f'%(deltat,dw)
+        print(('pre before post, dt = %1.3f s, dw/w = %1.3f'%(deltat,dw)))
         dwlist_pos.append(dw)
-    print '-----------------------------------------------'
+    print('-----------------------------------------------')
 
     # ###########################################
     # Plot the simulated Vm-s and STDP curve
diff --git a/snippets/bidirectionalPlasticity.py b/snippets/bidirectionalPlasticity.py
index 11d6b5ee..1101807e 100644
--- a/snippets/bidirectionalPlasticity.py
+++ b/snippets/bidirectionalPlasticity.py
@@ -49,13 +49,13 @@ def main():
     modelId = moose.loadModel( './stargazin_synapse.g', 'model', method )
     moose.start( 1000.0 ) # Run the model for 1000 seconds.
     Ca = moose.element( '/model/kinetics/BULK/Ca' )
-    Ca.concInit = 2.0e-3 	# Calcium stimulus for turnon
+    Ca.concInit = 2.0e-3         # Calcium stimulus for turnon
     moose.start( 20.0 ) # Run the model for 100 seconds.
-    Ca.concInit = 0.08e-3	# Calcium back to baseline
+    Ca.concInit = 0.08e-3        # Calcium back to baseline
     moose.start( 1000.0 ) # Let system settle for 1000 sec
-    Ca.concInit = 0.2e-3	# 	Calcium turnoff stimulus
+    Ca.concInit = 0.2e-3        #         Calcium turnoff stimulus
     moose.start( 2000.0 ) # Run the model for 1000 seconds for turnoff
-    Ca.concInit = 0.08e-3	# Calcium back to baseline
+    Ca.concInit = 0.08e-3        # Calcium back to baseline
     moose.start( 2000.0 ) # Let system settle for 2000 sec
 
     displayPlots()
@@ -63,4 +63,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/changeFuncExpression.py b/snippets/changeFuncExpression.py
index 13e9b6cf..0e6dd09a 100644
--- a/snippets/changeFuncExpression.py
+++ b/snippets/changeFuncExpression.py
@@ -23,29 +23,29 @@ import moose
 useY = False
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compartment = moose.CubeMesh( '/model/compartment' )
-		compartment.volume = 1e-15
-		# the mesh is created automatically by the compartment
-		mesh = moose.element( '/model/compartment/mesh' ) 
-
-		# create molecules and reactions
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compartment = moose.CubeMesh( '/model/compartment' )
+                compartment.volume = 1e-15
+                # the mesh is created automatically by the compartment
+                mesh = moose.element( '/model/compartment/mesh' ) 
+
+                # create molecules and reactions
                 # a <----> b
                 # b + 10c ---func---> d
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		c = moose.Pool( '/model/compartment/c' )
-		d = moose.BufPool( '/model/compartment/d' )
-		reac = moose.Reac( '/model/compartment/reac' )
+                a = moose.Pool( '/model/compartment/a' )
+                b = moose.Pool( '/model/compartment/b' )
+                c = moose.Pool( '/model/compartment/c' )
+                d = moose.BufPool( '/model/compartment/d' )
+                reac = moose.Reac( '/model/compartment/reac' )
                 func = moose.Function( '/model/compartment/d/func' )
                 func.numVars = 2
                 #func.x.num = 2
 
-		# connect them up for reactions
+                # connect them up for reactions
 
-		moose.connect( reac, 'sub', a, 'reac' )
-		moose.connect( reac, 'prd', b, 'reac' )
+                moose.connect( reac, 'sub', a, 'reac' )
+                moose.connect( reac, 'prd', b, 'reac' )
                 if useY:
                     moose.connect( func, 'requestOut', b, 'getN' )
                     moose.connect( func, 'requestOut', c, 'getN' )
@@ -59,72 +59,72 @@ def makeModel():
                 else:
                     func.expr = "x0 + 10*x1"
 
-		# connect them up to the compartment for volumes
-		#for x in ( a, b, c, cplx1, cplx2 ):
-		#			moose.connect( x, 'mesh', mesh, 'mesh' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 0.5
-		c.concInit = 0.1
-		reac.Kf = 0.001
-		reac.Kb = 0.01
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/concA' )
-		outputB = moose.Table2 ( '/model/graphs/concB' )
-		outputC = moose.Table2 ( '/model/graphs/concC' )
-		outputD = moose.Table2 ( '/model/graphs/concD' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
-		moose.connect( outputC, 'requestOut', c, 'getConc' );
-		moose.connect( outputD, 'requestOut', d, 'getConc' );
+                # connect them up to the compartment for volumes
+                #for x in ( a, b, c, cplx1, cplx2 ):
+                #                        moose.connect( x, 'mesh', mesh, 'mesh' )
+
+                # Assign parameters
+                a.concInit = 1
+                b.concInit = 0.5
+                c.concInit = 0.1
+                reac.Kf = 0.001
+                reac.Kb = 0.01
+
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2 ( '/model/graphs/concA' )
+                outputB = moose.Table2 ( '/model/graphs/concB' )
+                outputC = moose.Table2 ( '/model/graphs/concC' )
+                outputD = moose.Table2 ( '/model/graphs/concD' )
+
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getConc' );
+                moose.connect( outputB, 'requestOut', b, 'getConc' );
+                moose.connect( outputC, 'requestOut', c, 'getConc' );
+                moose.connect( outputD, 'requestOut', d, 'getConc' );
 
 def displayPlots():
-		for x in moose.wildcardFind( '/model/graphs/conc#' ):
-				t = numpy.arange( 0, x.vector.size, 1 ) #sec
-				pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
+                for x in moose.wildcardFind( '/model/graphs/conc#' ):
+                                t = numpy.arange( 0, x.vector.size, 1 ) #sec
+                                pylab.plot( t, x.vector, label=x.name )
+                pylab.legend()
+                pylab.show()
 
 def main():
-		makeModel()
+                makeModel()
                 '''
                 '''
-		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = moose.element( '/model/compartment' )
-		stoich.ksolve = ksolve
-		stoich.path = "/model/compartment/##"
-		#solver.method = "rk5"
-		#mesh = moose.element( "/model/compartment/mesh" )
-		#moose.connect( mesh, "remesh", solver, "remesh" )
+                ksolve = moose.Ksolve( '/model/compartment/ksolve' )
+                stoich = moose.Stoich( '/model/compartment/stoich' )
+                stoich.compartment = moose.element( '/model/compartment' )
+                stoich.ksolve = ksolve
+                stoich.path = "/model/compartment/##"
+                #solver.method = "rk5"
+                #mesh = moose.element( "/model/compartment/mesh" )
+                #moose.connect( mesh, "remesh", solver, "remesh" )
                 '''
-		moose.setClock( 5, 1.0 ) # clock for the solver
-		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
+                moose.setClock( 5, 1.0 ) # clock for the solver
+                moose.useClock( 5, '/model/compartment/ksolve', 'process' )
                 '''
 
-		moose.reinit()
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                moose.reinit()
+                moose.start( 100.0 ) # Run the model for 100 seconds.
                 func = moose.element( '/model/compartment/d/func' )
                 if useY:
                     func.expr = "-y0 + 10*y1"
                 else:
                     func.expr = "-x0 + 10*x1"
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                moose.start( 100.0 ) # Run the model for 100 seconds.
                 #moose.showfields( '/model/compartment/d' )
                 #moose.showfields( '/model/compartment/d/func' )
-                print func.x.value
-                print moose.element( '/model/compartment/b' ).n
+                print((func.x.value))
+                print((moose.element( '/model/compartment/b' ).n))
 
-		# Iterate through all plots, dump their contents to data.plot.
-		displayPlots()
+                # Iterate through all plots, dump their contents to data.plot.
+                displayPlots()
 
-		quit()
+                quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/chemDoseResponse.py b/snippets/chemDoseResponse.py
index c3b77370..42aa297e 100644
--- a/snippets/chemDoseResponse.py
+++ b/snippets/chemDoseResponse.py
@@ -183,4 +183,4 @@ def makeModel():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/compartment_net.py b/snippets/compartment_net.py
index 8d66b306..58b32e9f 100644
--- a/snippets/compartment_net.py
+++ b/snippets/compartment_net.py
@@ -67,10 +67,10 @@ def create_population(container, size):
 
     """
     path = container.path
-    print path, size, type(path)
+    print((path, size, type(path)))
     comps = create_1comp_neuron('{}/neuron'.format(path), number=size)
     synpath = path+'/synchan'
-    print synpath, size, type(size)
+    print((synpath, size, type(size)))
     synchan = moose.vec(synpath, n=size, dtype='SynChan')
     synchan.Gbar = 1e-8
     synchan.tau1 = 2e-3
@@ -109,14 +109,14 @@ def make_synapses(spikegen, synhandler, connprob=1.0, delay=5e-3):
         sh.synapse.vec.delay = 5e-3
         for ii, syn in enumerate(sh.synapse):
             msg = moose.connect(spikegen[ii], 'spikeOut', syn, 'addSpike')
-            print 'Connected', spikegen[ii].path, 'to', syn.path, 'on', sh.path
+            print(('Connected', spikegen[ii].path, 'to', syn.path, 'on', sh.path))
             
 def create_network(size=2):
     """Create a network containing two neuronal populations, pop_A and
     pop_B and connect them up"""
     net = moose.Neutral('network')
     pop_a = create_population(moose.Neutral('/network/pop_A'), size)
-    print pop_a
+    print(pop_a)
     pop_b = create_population(moose.Neutral('/network/pop_B'), size)
     make_synapses(pop_a['spikegen'], pop_b['synhandler'])
     pulse = moose.PulseGen('pulse')
@@ -156,7 +156,7 @@ if __name__ == '__main__':
     moose.start(simtime)
     plt.subplot(221)
     for oid in vm_a.vec:
-        print oid, oid.vector.shape
+        print((oid, oid.vector.shape))
         plt.plot(oid.vector, label=oid.path)
     plt.legend()
     plt.subplot(223)
diff --git a/snippets/compartment_net_no_array.py b/snippets/compartment_net_no_array.py
index a67f2714..47beb305 100644
--- a/snippets/compartment_net_no_array.py
+++ b/snippets/compartment_net_no_array.py
@@ -338,14 +338,14 @@ def assign_clocks(model_container_list, simdt, plotdt):
     global inited
     # `inited` is for avoiding double scheduling of the same object
     if not inited:
-        print 'SimDt=%g, PlotDt=%g' % (simdt, plotdt)
+        print(('SimDt=%g, PlotDt=%g' % (simdt, plotdt)))
         moose.setClock(0, simdt)
         moose.setClock(1, simdt)
         moose.setClock(2, simdt)
         moose.setClock(3, simdt)
         moose.setClock(4, plotdt)
         for path in model_container_list:
-            print 'Scheduling elements under:', path
+            print(('Scheduling elements under:', path))
             moose.useClock(0, '%s/##[TYPE=Compartment]' % (path), 'init')
             moose.useClock(1, '%s/##[TYPE=Compartment]' % (path), 'process')
             moose.useClock(2, '%s/##[TYPE=SynChan],%s/##[TYPE=HHChannel]' % (path, path), 'process')
diff --git a/snippets/compartmental_neuron.py b/snippets/compartmental_neuron.py
index 86ba70fd..33a5db56 100644
--- a/snippets/compartmental_neuron.py
+++ b/snippets/compartmental_neuron.py
@@ -52,7 +52,7 @@ compartment and the membrane voltage in both compartments are recorded
 and saved into a csv file.
 
 """
-from __future__ import print_function
+
 import sys
 import numpy as np
 import moose
diff --git a/snippets/convert_Genesis2Sbml.py b/snippets/convert_Genesis2Sbml.py
index 8f42aee8..c675521b 100644
--- a/snippets/convert_Genesis2Sbml.py
+++ b/snippets/convert_Genesis2Sbml.py
@@ -48,17 +48,17 @@
 import moose
 from moose.SBML import *
 def main():
-	"""This example illustrates loading a kinetic model defined in Genesis format
-	into Moose using loadModel function and using writeSBML function
-	one can save the model into SBML format. \n
-	Moose needs to be compiled with libsbml
+        """This example illustrates loading a kinetic model defined in Genesis format
+        into Moose using loadModel function and using writeSBML function
+        one can save the model into SBML format. \n
+        libsbml should be installed 
 """
-	#This command loads the file into the path '/Kholodenko'
-	moose.loadModel('../genesis/Kholodenko.g','/Kholodenko')
-	
-	#Writes model to xml file
-	written = mooseWriteSBML('/Kholodenko','../genesis/Kholodenko_tosbml.xml')
-	print written
+        #This command loads the file into the path '/Kholodenko'
+        moose.loadModel('../genesis/Kholodenko.g','/Kholodenko')
+        
+        #Writes model to xml file
+        written = mooseWriteSBML('/Kholodenko','../genesis/Kholodenko_tosbml.xml')
+        print(written)
 
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/crossComptNeuroMesh.py b/snippets/crossComptNeuroMesh.py
index 189cc3be..24883b8b 100644
--- a/snippets/crossComptNeuroMesh.py
+++ b/snippets/crossComptNeuroMesh.py
@@ -12,8 +12,11 @@ import math
 import pylab
 import numpy
 import matplotlib.pyplot as plt
+import sys
 import moose
 
+print(( '[INFO] Using moose from %s' % moose.__file__ ))
+
 def makeCompt( name, parent, dx, dy, dia ):
     RM = 1.0
     RA = 1.0
@@ -67,40 +70,40 @@ def makeNeuron( numSeg ):
 def makeModel():
                 numSeg = 5
                 diffConst = 0.0
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compt0 = moose.NeuroMesh( '/model/compt0' )
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compt0 = moose.NeuroMesh( '/model/compt0' )
                 compt0.separateSpines = 1
                 compt0.geometryPolicy = 'cylinder'
-		compt1 = moose.SpineMesh( '/model/compt1' )
+                compt1 = moose.SpineMesh( '/model/compt1' )
                 moose.connect( compt0, 'spineListOut', compt1, 'spineList', 'OneToOne' )
-		compt2 = moose.PsdMesh( '/model/compt2' )
+                compt2 = moose.PsdMesh( '/model/compt2' )
                 moose.connect( compt0, 'psdListOut', compt2, 'psdList', 'OneToOne' )
 
-		# create molecules and reactions
-		a = moose.Pool( '/model/compt0/a' )
-		b = moose.Pool( '/model/compt1/b' )
-		c = moose.Pool( '/model/compt2/c' )
-		reac0 = moose.Reac( '/model/compt0/reac0' )
-		reac1 = moose.Reac( '/model/compt1/reac1' )
-
-		# connect them up for reactions
-		moose.connect( reac0, 'sub', a, 'reac' )
-		moose.connect( reac0, 'prd', b, 'reac' )
-		moose.connect( reac1, 'sub', b, 'reac' )
-		moose.connect( reac1, 'prd', c, 'reac' )
-
-		# Assign parameters
-		a.diffConst = diffConst
-		b.diffConst = diffConst
-		c.diffConst = diffConst
-		a.concInit = 1
-		b.concInit = 12.1
-		c.concInit = 1
-		reac0.Kf = 1
-		reac0.Kb = 1
-		reac1.Kf = 1
-		reac1.Kb = 1
+                # create molecules and reactions
+                a = moose.Pool( '/model/compt0/a' )
+                b = moose.Pool( '/model/compt1/b' )
+                c = moose.Pool( '/model/compt2/c' )
+                reac0 = moose.Reac( '/model/compt0/reac0' )
+                reac1 = moose.Reac( '/model/compt1/reac1' )
+
+                # connect them up for reactions
+                moose.connect( reac0, 'sub', a, 'reac' )
+                moose.connect( reac0, 'prd', b, 'reac' )
+                moose.connect( reac1, 'sub', b, 'reac' )
+                moose.connect( reac1, 'prd', c, 'reac' )
+
+                # Assign parameters
+                a.diffConst = diffConst
+                b.diffConst = diffConst
+                c.diffConst = diffConst
+                a.concInit = 1
+                b.concInit = 12.1
+                c.concInit = 1
+                reac0.Kf = 1
+                reac0.Kb = 1
+                reac1.Kf = 1
+                reac1.Kb = 1
 
                 # Create a 'neuron' with a dozen spiny compartments.
                 elec = makeNeuron( numSeg )
@@ -143,25 +146,25 @@ def makeModel():
                 stoich2.filterXreacs()
 
 
-                print a.vec.volume, b.vec.volume, c.vec.volume
-		a.vec.concInit = range( numSeg + 1, 0, -1 )
-		b.vec.concInit = [5.0 * ( 1 + x ) for x in range( numSeg )]
-		c.vec.concInit = range( 1, numSeg + 1 )
-                print a.vec.concInit, b.vec.concInit, c.vec.concInit
+                print((a.vec.volume, b.vec.volume, c.vec.volume))
+                a.vec.concInit = list(range( numSeg + 1, 0, -1))
+                b.vec.concInit = [5.0 * ( 1 + x ) for x in range( numSeg )]
+                c.vec.concInit = list(range( 1, numSeg + 1))
+                print((a.vec.concInit, b.vec.concInit, c.vec.concInit))
 
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/concA' )
-		outputB = moose.Table2 ( '/model/graphs/concB' )
-		outputC = moose.Table2 ( '/model/graphs/concC' )
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2 ( '/model/graphs/concA' )
+                outputB = moose.Table2 ( '/model/graphs/concB' )
+                outputC = moose.Table2 ( '/model/graphs/concC' )
 
-		# connect up the tables
+                # connect up the tables
                 a1 = moose.element( '/model/compt0/a[' + str( numSeg )+ ']')
                 b1 = moose.element( '/model/compt1/b[' +str(numSeg - 1)+']')
                 c1 = moose.element( '/model/compt2/c[' +str(numSeg - 1)+']')
-		moose.connect( outputA, 'requestOut', a1, 'getConc' );
-		moose.connect( outputB, 'requestOut', b1, 'getConc' );
-		moose.connect( outputC, 'requestOut', c1, 'getConc' );
+                moose.connect( outputA, 'requestOut', a1, 'getConc' );
+                moose.connect( outputB, 'requestOut', b1, 'getConc' );
+                moose.connect( outputC, 'requestOut', c1, 'getConc' );
 
 
 def main():
@@ -232,10 +235,13 @@ def display():
         line4, = timeseries.plot( t, x.vector, label=x.name )
     plt.legend()
     fig.canvas.draw()
+    outfile = '%s.png' % sys.argv[0] 
+    # print( "Hit 'enter' to exit" )
+    # raw_input()
+    plt.savefig( outfile )
+    print(('[INFO] Results are saved to %s' % outfile ))
 
-    print( "Hit 'enter' to exit" )
-    raw_input()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/crossComptOscillator.py b/snippets/crossComptOscillator.py
index cc812bc5..0357c9cc 100644
--- a/snippets/crossComptOscillator.py
+++ b/snippets/crossComptOscillator.py
@@ -7,6 +7,8 @@
 ## See the file COPYING.LIB for the full notice.
 #########################################################################
 
+from __future__ import print_function
+
 import moose
 import pylab
 import numpy
@@ -26,10 +28,10 @@ def main():
         """
         # the kkit reader doesn't know how to do multicompt solver setup.
         solver = "ee"  
-	mfile = '../genesis/OSC_diff_vols.g'
-	runtime = 3000.0
+        mfile = '../genesis/OSC_diff_vols.g'
+        runtime = 3000.0
         simDt = 1.0
-	modelId = moose.loadModel( mfile, 'model', solver )
+        modelId = moose.loadModel( mfile, 'model', solver )
         #moose.delete( '/model/kinetics/A/Stot' )
         compt0 = moose.element( '/model/kinetics' )
         compt1 = moose.element( '/model/compartment_1' )
@@ -52,37 +54,37 @@ def main():
         stoich1.ksolve = ksolve1
         stoich1.path = '/model/compartment_1/##'
         #stoich0.buildXreacs( stoich1 )
-        print ksolve0.numLocalVoxels, ksolve0.numPools, stoich0.numAllPools
+        print(ksolve0.numLocalVoxels, ksolve0.numPools, stoich0.numAllPools)
         assert( ksolve0.numLocalVoxels == 1 )
         assert( ksolve0.numPools == 7 )
         assert( stoich0.numVarPools == 5 )
         assert( stoich0.numBufPools == 1 )
         assert( stoich0.numProxyPools == 1 )
         assert( stoich0.numAllPools == 7 )
-        print len( stoich0.proxyPools[stoich1] ),
-        print len( stoich1.proxyPools[stoich0] )
+        print(len( stoich0.proxyPools[stoich1] ), end=' ')
+        print(len( stoich1.proxyPools[stoich0] ))
         assert( len( stoich0.proxyPools[stoich1] ) == 1 )
         assert( len( stoich1.proxyPools[stoich0] ) == 1 )
-        print ksolve1.numLocalVoxels, ksolve1.numPools, stoich1.numAllPools
+        print(ksolve1.numLocalVoxels, ksolve1.numPools, stoich1.numAllPools)
         assert( ksolve1.numLocalVoxels == 1 )
         assert( ksolve1.numPools == 6 )
         assert( stoich1.numAllPools == 6 )
         stoich0.buildXreacs( stoich1 )
-        print moose.element( '/model/kinetics/endo' )
-        print moose.element( '/model/compartment_1/exo' )
+        print(moose.element( '/model/kinetics/endo' ))
+        print(moose.element( '/model/compartment_1/exo' ))
         moose.le( '/model/compartment_1' )
-	moose.reinit()
-	moose.start( runtime ) 
+        moose.reinit()
+        moose.start( runtime ) 
 
-	# Display all plots.
-	for x in moose.wildcardFind( '/model/#graphs/conc#/#' ):
+        # Display all plots.
+        for x in moose.wildcardFind( '/model/#graphs/conc#/#' ):
             t = numpy.arange( 0, x.vector.size, 1 ) * simDt
             pylab.plot( t, x.vector, label=x.name )
         pylab.legend()
         pylab.show()
 
-	#quit()
+        #quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/crossComptSimpleReac.py b/snippets/crossComptSimpleReac.py
index 82571b30..d76ce919 100644
--- a/snippets/crossComptSimpleReac.py
+++ b/snippets/crossComptSimpleReac.py
@@ -15,14 +15,14 @@ import numpy
 import moose
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compt0 = moose.CubeMesh( '/model/compt0' )
-		compt0.volume = 1e-15
-		compt1 = moose.CubeMesh( '/model/compt1' )
-		compt1.volume = 1e-16
-		compt2 = moose.CubeMesh( '/model/compt2' )
-		compt2.volume = 1e-17
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compt0 = moose.CubeMesh( '/model/compt0' )
+                compt0.volume = 1e-15
+                compt1 = moose.CubeMesh( '/model/compt1' )
+                compt1.volume = 1e-16
+                compt2 = moose.CubeMesh( '/model/compt2' )
+                compt2.volume = 1e-17
 
                 # Position containers so that they abut each other, with
                 # compt1 in the middle.
@@ -31,40 +31,40 @@ def makeModel():
                 compt0.y0 += side
                 compt2.x1 += side
                 compt2.x0 += side
-                print('Volumes = ', compt0.volume, compt1.volume, compt2.volume)
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compt0/a' )
-		b = moose.Pool( '/model/compt1/b' )
-		c = moose.Pool( '/model/compt2/c' )
-		reac0 = moose.Reac( '/model/compt1/reac0' )
-		reac1 = moose.Reac( '/model/compt1/reac1' )
-
-		# connect them up for reactions
-		moose.connect( reac0, 'sub', a, 'reac' )
-		moose.connect( reac0, 'prd', b, 'reac' )
-		moose.connect( reac1, 'sub', b, 'reac' )
-		moose.connect( reac1, 'prd', c, 'reac' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 12.1
-		c.concInit = 1
-		reac0.Kf = 0.1
-		reac0.Kb = 0.1
-		reac1.Kf = 0.1
-		reac1.Kb = 0.1
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/concA' )
-		outputB = moose.Table2 ( '/model/graphs/concB' )
-		outputC = moose.Table2 ( '/model/graphs/concC' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
-		moose.connect( outputC, 'requestOut', c, 'getConc' );
+                print(('Volumes = ', compt0.volume, compt1.volume, compt2.volume))
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compt0/a' )
+                b = moose.Pool( '/model/compt1/b' )
+                c = moose.Pool( '/model/compt2/c' )
+                reac0 = moose.Reac( '/model/compt1/reac0' )
+                reac1 = moose.Reac( '/model/compt1/reac1' )
+
+                # connect them up for reactions
+                moose.connect( reac0, 'sub', a, 'reac' )
+                moose.connect( reac0, 'prd', b, 'reac' )
+                moose.connect( reac1, 'sub', b, 'reac' )
+                moose.connect( reac1, 'prd', c, 'reac' )
+
+                # Assign parameters
+                a.concInit = 1
+                b.concInit = 12.1
+                c.concInit = 1
+                reac0.Kf = 0.1
+                reac0.Kb = 0.1
+                reac1.Kf = 0.1
+                reac1.Kb = 0.1
+
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2 ( '/model/graphs/concA' )
+                outputB = moose.Table2 ( '/model/graphs/concB' )
+                outputC = moose.Table2 ( '/model/graphs/concC' )
+
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getConc' );
+                moose.connect( outputB, 'requestOut', b, 'getConc' );
+                moose.connect( outputC, 'requestOut', c, 'getConc' );
 
                 # Build the solvers. No need for diffusion in this version.
                 ksolve0 = moose.Ksolve( '/model/compt0/ksolve0' )
@@ -138,7 +138,7 @@ def main():
     moose.start( runtime ) # Run the model for 100 seconds.
     print("All concs should converge to 2.0 even though vols differ:")
     for x in moose.wildcardFind( '/model/compt#/#[ISA=PoolBase]' ):
-        print(x.name, x.conc)
+        print((x.name, x.conc))
 
     # FIXME: Plotting causes seg-fault.
     ## Iterate through all plots, dump their contents to data.plot.
@@ -151,4 +151,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/crossComptSimpleReacGSSA.py b/snippets/crossComptSimpleReacGSSA.py
index 879fd90d..8723205a 100644
--- a/snippets/crossComptSimpleReacGSSA.py
+++ b/snippets/crossComptSimpleReacGSSA.py
@@ -15,14 +15,14 @@ import numpy
 import moose
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compt0 = moose.CubeMesh( '/model/compt0' )
-		compt0.volume = 1e-18
-		compt1 = moose.CubeMesh( '/model/compt1' )
-		compt1.volume = 1e-19
-		compt2 = moose.CubeMesh( '/model/compt2' )
-		compt2.volume = 1e-20
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compt0 = moose.CubeMesh( '/model/compt0' )
+                compt0.volume = 1e-18
+                compt1 = moose.CubeMesh( '/model/compt1' )
+                compt1.volume = 1e-19
+                compt2 = moose.CubeMesh( '/model/compt2' )
+                compt2.volume = 1e-20
 
                 # Position containers so that they abut each other, with
                 # compt1 in the middle.
@@ -31,40 +31,40 @@ def makeModel():
                 compt0.y0 += side
                 compt2.x1 += side
                 compt2.x0 += side
-                print('Volumes = ', compt0.volume, compt1.volume, compt2.volume)
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compt0/a' )
-		b = moose.Pool( '/model/compt1/b' )
-		c = moose.Pool( '/model/compt2/c' )
-		reac0 = moose.Reac( '/model/compt1/reac0' )
-		reac1 = moose.Reac( '/model/compt1/reac1' )
-
-		# connect them up for reactions
-		moose.connect( reac0, 'sub', a, 'reac' )
-		moose.connect( reac0, 'prd', b, 'reac' )
-		moose.connect( reac1, 'sub', b, 'reac' )
-		moose.connect( reac1, 'prd', c, 'reac' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 12.1
-		c.concInit = 1
-		reac0.Kf = 0.1
-		reac0.Kb = 0.1
-		reac1.Kf = 0.1
-		reac1.Kb = 0.1
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/concA' )
-		outputB = moose.Table2 ( '/model/graphs/concB' )
-		outputC = moose.Table2 ( '/model/graphs/concC' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
-		moose.connect( outputC, 'requestOut', c, 'getConc' );
+                print(('Volumes = ', compt0.volume, compt1.volume, compt2.volume))
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compt0/a' )
+                b = moose.Pool( '/model/compt1/b' )
+                c = moose.Pool( '/model/compt2/c' )
+                reac0 = moose.Reac( '/model/compt1/reac0' )
+                reac1 = moose.Reac( '/model/compt1/reac1' )
+
+                # connect them up for reactions
+                moose.connect( reac0, 'sub', a, 'reac' )
+                moose.connect( reac0, 'prd', b, 'reac' )
+                moose.connect( reac1, 'sub', b, 'reac' )
+                moose.connect( reac1, 'prd', c, 'reac' )
+
+                # Assign parameters
+                a.concInit = 1
+                b.concInit = 12.1
+                c.concInit = 1
+                reac0.Kf = 0.1
+                reac0.Kb = 0.1
+                reac1.Kf = 0.1
+                reac1.Kb = 0.1
+
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2 ( '/model/graphs/concA' )
+                outputB = moose.Table2 ( '/model/graphs/concB' )
+                outputC = moose.Table2 ( '/model/graphs/concC' )
+
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getConc' );
+                moose.connect( outputB, 'requestOut', b, 'getConc' );
+                moose.connect( outputC, 'requestOut', c, 'getConc' );
 
                 # Build the solvers. No need for diffusion in this version.
                 ksolve0 = moose.Gsolve( '/model/compt0/ksolve0' )
@@ -138,7 +138,7 @@ def main():
     moose.start( runtime ) # Run the model for 100 seconds.
     print("All concs should converge to 2.0 even though vols differ:")
     for x in moose.wildcardFind( '/model/compt#/#[ISA=PoolBase]' ):
-        print(x.name, x.conc)
+        print((x.name, x.conc))
 
     # Iterate through all plots, dump their contents to data.plot.
     for x in moose.wildcardFind( '/model/graphs/conc#' ):
@@ -150,4 +150,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/cspaceSteadyState.py b/snippets/cspaceSteadyState.py
index a21f3bf3..06a5f0bc 100644
--- a/snippets/cspaceSteadyState.py
+++ b/snippets/cspaceSteadyState.py
@@ -12,13 +12,13 @@
 # It looks for the fixed points 100 times, as follows:
 # - Set up the random initial condition that fits the conservation laws
 # - Run for 2 seconds. This should not be mathematically necessary, but
-#	for obscure numerical reasons it makes it much more likely that the 
-#	steady state solver will succeed in finding a state.
+#        for obscure numerical reasons it makes it much more likely that the 
+#        steady state solver will succeed in finding a state.
 # - Find the fixed point
 # - Print out the fixed point vector and various diagnostics.
 # - Run for 10 seconds. This is completely unnecessary, and is done here
-# 	just so that the resultant graph will show what kind of state has been
-#	found.
+#         just so that the resultant graph will show what kind of state has been
+#        found.
 # After it does all this, the program runs for 100 more seconds on the last
 # found fixed point (which turns out to be a saddle node), then
 # is hard-switched in the script to the first attractor basin from which
@@ -27,13 +27,13 @@
 # seconds.
 # Looking at the output you will see many features of note:
 # - the first attractor (stable point) and the saddle point 
-#	(unstable fixed point) are both found quite often. But the second
-#	attractor is found just once. Has a very small basin of attraction.
+#        (unstable fixed point) are both found quite often. But the second
+#        attractor is found just once. Has a very small basin of attraction.
 # - The values found for each of the fixed points match well with the
-#	values found by running the system to steady-state at the end.
+#        values found by running the system to steady-state at the end.
 # - There are a large number of failures to find a fixed point. These are
-# 	found and reported in the diagnostics. They show up on the plot
-# 	as cases where the 10-second runs are not flat.
+#         found and reported in the diagnostics. They show up on the plot
+#         as cases where the 10-second runs are not flat.
 #
 # If you wanted to find fixed points in a production model, you would
 # not need to do the 10-second runs, and you would need to eliminate the
@@ -50,73 +50,73 @@ import numpy
 import moose
 
 def displayPlots():
-		for x in moose.wildcardFind( '/model/graphs/#' ):
-			t = numpy.arange( 0, x.vector.size, 1 ) #sec
-			pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
+                for x in moose.wildcardFind( '/model/graphs/#' ):
+                        t = numpy.arange( 0, x.vector.size, 1 ) #sec
+                        pylab.plot( t, x.vector, label=x.name )
+                pylab.legend()
+                pylab.show()
 
 def getState( ksolve, state ):
-		state.randomInit()
-		moose.start( 0.1 ) # Run the model for 2 seconds.
-		state.settle()
+                state.randomInit()
+                moose.start( 0.1 ) # Run the model for 2 seconds.
+                state.settle()
                 '''
-		scale = 1.0 / ( 1e-15 * 6.022e23 )
-		for x in ksolve.nVec[0]:
-			print x * scale,
-		# print ksolve.nVec[0]
-		print state.nIter, state.status, state.stateType, state.nNegEigenvalues, state.nPosEigenvalues, state.solutionStatus
+                scale = 1.0 / ( 1e-15 * 6.022e23 )
+                for x in ksolve.nVec[0]:
+                        print x * scale,
+                # print ksolve.nVec[0]
+                print state.nIter, state.status, state.stateType, state.nNegEigenvalues, state.nPosEigenvalues, state.solutionStatus
                  '''
-		moose.start( 20.0 ) # Run model for 10 seconds, just for display
+                moose.start( 20.0 ) # Run model for 10 seconds, just for display
 
 
 def main():
-		# The wildcard uses # for single level, and ## for recursive.
-		#compartment = makeModel()
+                # The wildcard uses # for single level, and ## for recursive.
+                #compartment = makeModel()
                 moose.loadModel( '../genesis/M1719.cspace', '/model', 'ee' )
                 compartment = moose.element( 'model/kinetics' )
                 compartment.name = 'compartment'
-		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = compartment
-		stoich.ksolve = ksolve
-		#ksolve.stoich = stoich
-		stoich.path = "/model/compartment/##"
-		state = moose.SteadyState( '/model/compartment/state' )
+                ksolve = moose.Ksolve( '/model/compartment/ksolve' )
+                stoich = moose.Stoich( '/model/compartment/stoich' )
+                stoich.compartment = compartment
+                stoich.ksolve = ksolve
+                #ksolve.stoich = stoich
+                stoich.path = "/model/compartment/##"
+                state = moose.SteadyState( '/model/compartment/state' )
 
-		moose.reinit()
-		state.stoich = stoich
-		#state.showMatrices()
-		state.convergenceCriterion = 1e-7
+                moose.reinit()
+                state.stoich = stoich
+                #state.showMatrices()
+                state.convergenceCriterion = 1e-7
 
                 moose.le( '/model/graphs' )
                 a = moose.element( '/model/compartment/a' )
                 b = moose.element( '/model/compartment/b' )
                 c = moose.element( '/model/compartment/c' )
 
-		for i in range( 0, 100 ):
-			getState( ksolve, state )
-		
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                for i in range( 0, 100 ):
+                        getState( ksolve, state )
+                
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		b = moose.element( '/model/compartment/b' )
-		c = moose.element( '/model/compartment/c' )
+                b = moose.element( '/model/compartment/b' )
+                c = moose.element( '/model/compartment/c' )
 
-		# move most molecules over to b
-		b.conc = b.conc + c.conc * 0.95
-		c.conc = c.conc * 0.05
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                # move most molecules over to b
+                b.conc = b.conc + c.conc * 0.95
+                c.conc = c.conc * 0.05
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# move most molecules back to a
-		c.conc = c.conc + b.conc * 0.95
-		b.conc = b.conc * 0.05
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                # move most molecules back to a
+                c.conc = c.conc + b.conc * 0.95
+                b.conc = b.conc * 0.05
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# Iterate through all plots, dump their contents to data.plot.
-		displayPlots()
+                # Iterate through all plots, dump their contents to data.plot.
+                displayPlots()
 
-		quit()
+                quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/cubeMeshSigNeur.py b/snippets/cubeMeshSigNeur.py
index 4669db48..355ff27b 100644
--- a/snippets/cubeMeshSigNeur.py
+++ b/snippets/cubeMeshSigNeur.py
@@ -155,9 +155,9 @@ def createPool( compt, name, concInit ):
 
 # This is a Ca-activated enzyme that phosphorylates and inactivates kChan
 # as per the following scheme:
-# 		Ca + inact_kinase <===> Ca.kinase
-# 		kChan ----- Ca.kinase -----> kChan_p
-# 		kChan_p -------> kChan
+#                 Ca + inact_kinase <===> Ca.kinase
+#                 kChan ----- Ca.kinase -----> kChan_p
+#                 kChan_p -------> kChan
 def createChemModel( neuroCompt ):
     dendCa = createPool( neuroCompt, 'Ca', 1e-4 )
     dendKinaseInact = createPool( neuroCompt, 'inact_kinase', 1e-4 )
diff --git a/snippets/cylinderDiffusion.py b/snippets/cylinderDiffusion.py
index 0b4d8665..a4ff666c 100644
--- a/snippets/cylinderDiffusion.py
+++ b/snippets/cylinderDiffusion.py
@@ -57,11 +57,11 @@ def makeModel():
     The concentrations of all molecules are displayed in an animation.
     """
     # create container for model
-    r0 = 2e-6	# m
-    r1 = 1e-6	# m
+    r0 = 2e-6        # m
+    r1 = 1e-6        # m
     num = 100
     diffLength = 1e-6 # m
-    len = num * diffLength	# m
+    len = num * diffLength        # m
     diffConst = 10e-12 # m^2/sec
     motorRate = 10e-6 # m/sec
     concA = 1 # millimolar
@@ -106,7 +106,7 @@ def makeModel():
     os.kill( PID, signal.SIGUSR1 )
     stoich.path = "/model/compartment/##"
 
-    print dsolve.numPools
+    print((dsolve.numPools))
     assert( dsolve.numPools == 3 )
     a.vec[0].concInit = concA
     b.vec[0].concInit = concA
@@ -180,15 +180,15 @@ def main():
     ctot2 = sum( c.vec.n )
     dtot2 = sum( d.vec.n )
 
-    print 'Ratio of initial to final total numbers of of a, b, c, d = '
-    print atot2/atot, btot2/btot, ctot2/ctot, dtot2/dtot
-    print 'Initial to final (b+c)=', (btot2 + ctot2) / (btot + ctot )
-    print "\nHit 'enter' to exit"
-    raw_input()
+    print('Ratio of initial to final total numbers of of a, b, c, d = ')
+    print((atot2/atot, btot2/btot, ctot2/ctot, dtot2/dtot))
+    print(('Initial to final (b+c)=', (btot2 + ctot2) / (btot + ctot )))
+    print("\nHit 'enter' to exit")
+    eval(input())
 
     quit()
 
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/cylinderMotor.py b/snippets/cylinderMotor.py
index 91257b95..b9b96ad6 100644
--- a/snippets/cylinderMotor.py
+++ b/snippets/cylinderMotor.py
@@ -30,36 +30,36 @@ import signal
 PID = os.getpid()
 
 def doNothing( *args ):
-		pass
+                pass
 
 signal.signal( signal.SIGUSR1, doNothing )
 
 def makeModel():
-		# create container for model
-		r0 = 1e-6	# m
-		r1 = 1e-6	# m
-		num = 25
-		diffLength = 1e-6 # m
-		len = num * diffLength	# m
-		diffConst = 1e-12 # m^2/sec
-		motorConst = 1e-6 # m/sec
-		concA = 1 # millimolar
-
-		model = moose.Neutral( 'model' )
-		compartment = moose.CylMesh( '/model/compartment' )
-		compartment.r0 = r0
-		compartment.r1 = r1
-		compartment.x0 = 0
-		compartment.x1 = len
-		compartment.diffLength = diffLength
-		
-		assert( compartment.numDiffCompts == num )
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		c = moose.Pool( '/model/compartment/c' )
-		d = moose.Pool( '/model/compartment/d' )
+                # create container for model
+                r0 = 1e-6        # m
+                r1 = 1e-6        # m
+                num = 25
+                diffLength = 1e-6 # m
+                len = num * diffLength        # m
+                diffConst = 1e-12 # m^2/sec
+                motorConst = 1e-6 # m/sec
+                concA = 1 # millimolar
+
+                model = moose.Neutral( 'model' )
+                compartment = moose.CylMesh( '/model/compartment' )
+                compartment.r0 = r0
+                compartment.r1 = r1
+                compartment.x0 = 0
+                compartment.x1 = len
+                compartment.diffLength = diffLength
+                
+                assert( compartment.numDiffCompts == num )
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compartment/a' )
+                b = moose.Pool( '/model/compartment/b' )
+                c = moose.Pool( '/model/compartment/c' )
+                d = moose.Pool( '/model/compartment/d' )
                 """
                 r1 = moose.Reac( '/model/compartment/r1' )
                 moose.connect( r1, 'sub', b, 'reac' )
@@ -69,39 +69,39 @@ def makeModel():
                 r1.Kb = 0.01 # 1/sec
                 """
 
-		# Assign parameters
-		a.diffConst = 0.0;
-		b.diffConst = 0.0;
-		#b.motorRate = motorRate
-		c.diffConst = 0.0;
-		d.diffConst = 0.0;
-		#d.diffConst = diffConst;
-		os.kill( PID, signal.SIGUSR1 )
+                # Assign parameters
+                a.diffConst = 0.0;
+                b.diffConst = 0.0;
+                #b.motorRate = motorRate
+                c.diffConst = 0.0;
+                d.diffConst = 0.0;
+                #d.diffConst = diffConst;
+                os.kill( PID, signal.SIGUSR1 )
                 a.motorConst = motorConst
                 b.motorConst = motorConst
                 c.motorConst = -motorConst
                 d.motorConst = -motorConst
 
 
-		# Make solvers
-		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
-		dsolve = moose.Dsolve( '/model/compartment/dsolve' )
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = compartment
-		stoich.ksolve = ksolve
-		stoich.dsolve = dsolve
-		stoich.path = "/model/compartment/##"
+                # Make solvers
+                ksolve = moose.Ksolve( '/model/compartment/ksolve' )
+                dsolve = moose.Dsolve( '/model/compartment/dsolve' )
+                stoich = moose.Stoich( '/model/compartment/stoich' )
+                stoich.compartment = compartment
+                stoich.ksolve = ksolve
+                stoich.dsolve = dsolve
+                stoich.path = "/model/compartment/##"
                 assert( dsolve.numPools == 4 )
-		a.vec[0].concInit = concA * 1
-		b.vec[num-1].concInit = concA * 2
-		c.vec[0].concInit = concA * 3
-		d.vec[num-1].concInit = concA * 4
+                a.vec[0].concInit = concA * 1
+                b.vec[num-1].concInit = concA * 2
+                c.vec[0].concInit = concA * 3
+                d.vec[num-1].concInit = concA * 4
 
 def displayPlots():
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
-		c = moose.element( '/model/compartment/c' )
-		d = moose.element( '/model/compartment/d' )
+                a = moose.element( '/model/compartment/a' )
+                b = moose.element( '/model/compartment/b' )
+                c = moose.element( '/model/compartment/c' )
+                d = moose.element( '/model/compartment/d' )
                 pos = numpy.arange( 0, a.vec.conc.size, 1 )
                 pylab.plot( pos, a.vec.conc, label='a' )
                 pylab.plot( pos, b.vec.conc, label='b' )
@@ -111,44 +111,44 @@ def displayPlots():
                 pylab.show()
 
 def main():
-		dt4 = 0.01
-		dt5 = 0.01
+                dt4 = 0.01
+                dt5 = 0.01
                 runtime = 10.0 # seconds
                 # Set up clocks. The dsolver to know before assigning stoich
-		moose.setClock( 4, dt4 )
-		moose.setClock( 5, dt5 )
+                moose.setClock( 4, dt4 )
+                moose.setClock( 5, dt5 )
 
-		makeModel()
-		moose.useClock( 4, '/model/compartment/dsolve', 'process' )
+                makeModel()
+                moose.useClock( 4, '/model/compartment/dsolve', 'process' )
                 # Ksolve must be scheduled after dsolve.
-		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
+                moose.useClock( 5, '/model/compartment/ksolve', 'process' )
 
-		moose.reinit()
-		moose.start( runtime ) # Run the model
+                moose.reinit()
+                moose.start( runtime ) # Run the model
 
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
-		c = moose.element( '/model/compartment/c' )
-		d = moose.element( '/model/compartment/d' )
+                a = moose.element( '/model/compartment/a' )
+                b = moose.element( '/model/compartment/b' )
+                c = moose.element( '/model/compartment/c' )
+                d = moose.element( '/model/compartment/d' )
 
                 atot = sum( a.vec.conc )
                 btot = sum( b.vec.conc )
                 ctot = sum( c.vec.conc )
                 dtot = sum( d.vec.conc )
 
-                print 'tot = ', atot, btot, ctot, dtot, ' (b+c)=', btot+ctot
+                print(('tot = ', atot, btot, ctot, dtot, ' (b+c)=', btot+ctot))
                 displayPlots()
-		moose.start( runtime ) # Run the model
+                moose.start( runtime ) # Run the model
                 atot = sum( a.vec.conc )
                 btot = sum( b.vec.conc )
                 ctot = sum( c.vec.conc )
                 dtot = sum( d.vec.conc )
 
-                print 'tot = ', atot, btot, ctot, dtot, ' (b+c)=', btot+ctot
+                print(('tot = ', atot, btot, ctot, dtot, ' (b+c)=', btot+ctot))
 
-		quit()
+                quit()
 
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/diffSpinyNeuron.py b/snippets/diffSpinyNeuron.py
index af7f457a..16984873 100644
--- a/snippets/diffSpinyNeuron.py
+++ b/snippets/diffSpinyNeuron.py
@@ -102,12 +102,12 @@ def makeModel():
     stoich2.filterXreacs()
     
     Ca_input_dend = moose.vec( '/model/chem/compt0/Ca_input' )
-    print len( Ca_input_dend )
+    print((len( Ca_input_dend )))
     for i in range( 60 ):
         Ca_input_dend[ 3 + i * 3 ].conc = 2.0
 
     Ca_input_PSD = moose.vec( '/model/chem/compt2/Ca_input' )
-    print len( Ca_input_PSD )
+    print((len( Ca_input_PSD )))
     for i in range( 5 ):
         Ca_input_PSD[ 2 + i * 2].conc = 1.0
     
@@ -157,36 +157,36 @@ def makeDisplay():
         plt.xlabel( 'time (seconds)' )
         plt.legend()
 
-	Ca = moose.vec( '/model/chem/compt0/Ca' )
-	Ca_input = moose.vec( '/model/chem/compt0/Ca_input' )
-        line1, = dend.plot( range( len( Ca ) ), Ca.conc, label='Ca' )
-        line2, = dend.plot( range( len( Ca_input ) ), Ca_input.conc, label='Ca_input' )
+        Ca = moose.vec( '/model/chem/compt0/Ca' )
+        Ca_input = moose.vec( '/model/chem/compt0/Ca_input' )
+        line1, = dend.plot( list(range( len( Ca ))), Ca.conc, label='Ca' )
+        line2, = dend.plot( list(range( len( Ca_input ))), Ca_input.conc, label='Ca_input' )
         dend.set_ylim( 0, 2 )
 
-	Ca = moose.vec( '/model/chem/compt1/Ca' )
-        line3, = spine.plot( range( len( Ca ) ), Ca.conc, label='Ca' )
+        Ca = moose.vec( '/model/chem/compt1/Ca' )
+        line3, = spine.plot( list(range( len( Ca ))), Ca.conc, label='Ca' )
         spine.set_ylim( 0, 1 )
 
-	Ca = moose.vec( '/model/chem/compt2/Ca' )
-	Ca_input = moose.vec( '/model/chem/compt2/Ca_input' )
-        line4, = psd.plot( range( len( Ca ) ), Ca.conc, label='Ca' )
-        line5, = psd.plot( range( len( Ca_input ) ), Ca_input.conc, label='Ca_input' )
+        Ca = moose.vec( '/model/chem/compt2/Ca' )
+        Ca_input = moose.vec( '/model/chem/compt2/Ca_input' )
+        line4, = psd.plot( list(range( len( Ca ))), Ca.conc, label='Ca' )
+        line5, = psd.plot( list(range( len( Ca_input ))), Ca_input.conc, label='Ca_input' )
         psd.set_ylim( 0, 1 )
 
         fig.canvas.draw()
         return ( timeSeries, dend, spine, psd, fig, line1, line2, line3, line4, line5, timeLabel )
 
 def updateDisplay( plotlist ):
-	Ca = moose.vec( '/model/chem/compt0/Ca' )
-	Ca_input = moose.vec( '/model/chem/compt0/Ca_input' )
+        Ca = moose.vec( '/model/chem/compt0/Ca' )
+        Ca_input = moose.vec( '/model/chem/compt0/Ca_input' )
         plotlist[5].set_ydata( Ca.conc )
         plotlist[6].set_ydata( Ca_input.conc )
 
-	Ca = moose.vec( '/model/chem/compt1/Ca' )
+        Ca = moose.vec( '/model/chem/compt1/Ca' )
         plotlist[7].set_ydata( Ca.conc )
 
-	Ca = moose.vec( '/model/chem/compt2/Ca' )
-	Ca_input = moose.vec( '/model/chem/compt2/Ca_input' )
+        Ca = moose.vec( '/model/chem/compt2/Ca' )
+        Ca_input = moose.vec( '/model/chem/compt2/Ca_input' )
         plotlist[8].set_ydata( Ca.conc )
         plotlist[9].set_ydata( Ca_input.conc )
         plotlist[4].canvas.draw()
@@ -198,7 +198,7 @@ def finalizeDisplay( plotlist, cPlotDt ):
         line1, = plotlist[0].plot( pos, x.vector, label=x.name )
     plotlist[4].canvas.draw()
     print( "Hit 'enter' to exit" )
-    raw_input()
+    eval(input())
 
 def makeChemModel( compt, doInput ):
     """
@@ -279,4 +279,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/fieldelement.py b/snippets/fieldelement.py
index 53835f9d..ee456c71 100644
--- a/snippets/fieldelement.py
+++ b/snippets/fieldelement.py
@@ -92,7 +92,7 @@ import moose
 
 # Create an IntFire vec containing 10 elements, a refers to alpha[0]
 a = moose.IntFire('alpha', 10)
-print 'a=', a
+print(('a=', a))
 for i in range( 10 ):
     syn = moose.SimpleSynHandler( 'alpha[' + str(i) + ']/sh' )
     moose.connect( syn, 'activationOut', a.vec[i], 'activation' )
@@ -103,49 +103,49 @@ moose.connect( syn, 'activationOut', a, 'activation', 'OneToOne' )
 # FieldElement identity
 ###############################
 x = syn.synapse # x is an ElementField alpha[0].synapse
-print 'x=',x 
-print 'x.num=', x.num # Initially there are no synapses, so this will be 0
+print(('x=',x)) 
+print(('x.num=', x.num)) # Initially there are no synapses, so this will be 0
 syn.synapse.num = 3 # We set number of field elements to 3
-print 'x.num=', x.num  # x refers to a.synapse, so this should be 3
+print(('x.num=', x.num))  # x refers to a.synapse, so this should be 3
 b = moose.element('alpha[0]/sh/synapse[1]') # We access x[1]
-print 'b=',b
-print 'x[1]=', x[1]
-print 'b==x[1]?', b == x[1]
+print(('b=',b))
+print(('x[1]=', x[1]))
+print(('b==x[1]?', b == x[1]))
 
 ###############################
 # Check fieldIndex and dataId
 ###############################
-print 'syn.synapse[0]=', syn.synapse[0]
-print 'syn.synapse[1]=', syn.synapse[1] # The fieldIndex should change, not dataId
+print(('syn.synapse[0]=', syn.synapse[0]))
+print(('syn.synapse[1]=', syn.synapse[1])) # The fieldIndex should change, not dataId
 
 #########################
 # setVec call example
 #########################
-print 'alpha[0].synapse.delay=', x.delay
+print(('alpha[0].synapse.delay=', x.delay))
 x.delay = [1.0, 2.0, 3.0] # This sets `delay` field in all elements via setVec call
-print 'alpha[0].synapse.delay=', x.delay
+print(('alpha[0].synapse.delay=', x.delay))
 x.delay = [1.141592] * len(x) # This is a Pythonic way of replicating the values in a list - ensures same length
-print 'alpha[0].synapse.delay=', x.delay
+print(('alpha[0].synapse.delay=', x.delay))
 
 #####################################################
 # Play a little more with ObjId, FieldElement, Id
 #####################################################
-print 'Length of alpha[1]/synapse=', len(moose.element('/alpha[1]/sh').synapse)
+print(('Length of alpha[1]/synapse=', len(moose.element('/alpha[1]/sh').synapse)))
 c = moose.element('alpha[1]/sh/synapse[2]') # This should throw an error - alpha[1] does not have 3 synapses. 
-print 'b=', b, 'numData=', b.numData
-print 'c=', c, 'numData=', c.numData
+print(('b=', b, 'numData=', b.numData))
+print(('c=', c, 'numData=', c.numData))
 try:
-    print 'len(c)=', len(c)
-except TypeError, e:
-    print e
+    print(('len(c)=', len(c)))
+except TypeError as e:
+    print(e)
 d = moose.element('/alpha[1]/sh')
 try:
-    print d.synapse[1]
-except IndexError, e:
-    print e
+    print((d.synapse[1]))
+except IndexError as e:
+    print(e)
 else:
-    print 'Expected an IndexError. Length of synapse=', len(d.synapse)
+    print(('Expected an IndexError. Length of synapse=', len(d.synapse)))
 # The fieldIndex should change, not dataId
 x = moose.element(a.vec, 0, 1)
 y = moose.element(a.vec, 1, 2)
-print x, y
+print((x, y))
diff --git a/snippets/findChemSteadyState.py b/snippets/findChemSteadyState.py
index 6f928d13..85783ced 100644
--- a/snippets/findChemSteadyState.py
+++ b/snippets/findChemSteadyState.py
@@ -7,6 +7,8 @@
 ## See the file COPYING.LIB for the full notice.
 #########################################################################
 
+from __future__ import print_function
+
 import math
 import pylab
 import numpy
@@ -180,11 +182,12 @@ def getState( ksolve, state ):
     moose.start( 2.0 ) # Run the model for 2 seconds.
     state.settle() # This function finds the steady states.
     for x in ksolve.nVec[0]:
-        print x * scale,
-    print state.nIter, state.status, state.stateType, state.nNegEigenvalues, state.nPosEigenvalues, state.solutionStatus
+        print(x * scale, end=' ')
+
+    print(state.nIter, state.status, state.stateType, state.nNegEigenvalues, state.nPosEigenvalues, state.solutionStatus)
     moose.start( 10.0 ) # Run model for 10 seconds, just for display
 
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+    main()
diff --git a/snippets/func.py b/snippets/func.py
index d5bfc7d2..b521fe59 100644
--- a/snippets/func.py
+++ b/snippets/func.py
@@ -62,17 +62,17 @@ def test_func_nosim():
     for ii in range(num-1):
         expr += 'x_%d, ' % (ii)
     expr += 'x_%d)' % (num-1)
-    print 'Expression:', expr    
+    print(('Expression:', expr))    
     func_0.expr = expr
     for ii in range(num):
         var = 'x_%d' % (ii)
-        print 'Setting:', var, '=', func_0.var[var]
+        print(('Setting:', var, '=', func_0.var[var]))
         func_0.var[var] = float(ii)
-    print 'Expression:', func_0.expr
-    print 'Variables after assignment:'
+    print(('Expression:', func_0.expr))
+    print('Variables after assignment:')
     for v in func_0.vars:
-        print '  %s = %g' % (v, func_0.var[v])
-    print 'value %g\n' % (func_0.value)
+        print(('  %s = %g' % (v, func_0.var[v])))
+    print(('value %g\n' % (func_0.value)))
 
 def test_func():
     """This function creates a Func object evaluating a function of a
@@ -106,7 +106,7 @@ def test_func():
     input.startTime = 0.0
     input.stepPosition = xarr[0]
     input.stopTime = xarr[-1] - xarr[0]
-    print input.startTime, input.stopTime
+    print((input.startTime, input.stopTime))
     
     moose.connect(input, 'output', func_1, 'xIn')
 
@@ -129,7 +129,7 @@ def test_func():
     moose.useClock(3, '%s/##' % (data.path), 'process')
     moose.reinit()
     t = xarr[-1] - xarr[0]
-    print 'Run for', t
+    print(('Run for', t))
     moose.start(t)
     y = np.asarray(y_tab.vector)
     yp = np.asarray(yprime_tab.vector)
diff --git a/snippets/funcInputToPools.py b/snippets/funcInputToPools.py
index 12939853..b0477381 100644
--- a/snippets/funcInputToPools.py
+++ b/snippets/funcInputToPools.py
@@ -39,46 +39,46 @@ import moose
 import sys
 
 def makeModel():
-		if len( sys.argv ) == 1:
-			useGsolve = True
+                if len( sys.argv ) == 1:
+                        useGsolve = True
                 else:
-			useGsolve = ( sys.argv[1] == 'True' )
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compartment = moose.CubeMesh( '/model/compartment' )
-		compartment.volume = 1e-22
-		# the mesh is created automatically by the compartment
-		moose.le( '/model/compartment' )
-		mesh = moose.element( '/model/compartment/mesh' ) 
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-
-		# create functions of time
+                        useGsolve = ( sys.argv[1] == 'True' )
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compartment = moose.CubeMesh( '/model/compartment' )
+                compartment.volume = 1e-22
+                # the mesh is created automatically by the compartment
+                moose.le( '/model/compartment' )
+                mesh = moose.element( '/model/compartment/mesh' ) 
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compartment/a' )
+                b = moose.Pool( '/model/compartment/b' )
+
+                # create functions of time
                 f1 = moose.Function( '/model/compartment/f1' )
                 f2 = moose.Function( '/model/compartment/f2' )
 
-		# connect them up for reactions
-		moose.connect( f1, 'valueOut', a, 'setConc' )
-		moose.connect( f2, 'valueOut', b, 'increment' )
+                # connect them up for reactions
+                moose.connect( f1, 'valueOut', a, 'setConc' )
+                moose.connect( f2, 'valueOut', b, 'increment' )
 
-		# Assign parameters
-		a.concInit = 0
-		b.concInit = 1
+                # Assign parameters
+                a.concInit = 0
+                b.concInit = 1
                 #f1.numVars = 1
                 #f2.numVars = 1
                 f1.expr = '1 + sin(t)'
                 f2.expr = '10 * cos(t)'
 
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/nA' )
-		outputB = moose.Table2 ( '/model/graphs/nB' )
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2 ( '/model/graphs/nA' )
+                outputB = moose.Table2 ( '/model/graphs/nB' )
 
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getN' );
-		moose.connect( outputB, 'requestOut', b, 'getN' );
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getN' );
+                moose.connect( outputB, 'requestOut', b, 'getN' );
 
                 # Set up the solvers
                 if useGsolve:
@@ -93,31 +93,31 @@ def makeModel():
                 '''
                 '''
 
-		# We need a finer timestep than the default 0.1 seconds, 
+                # We need a finer timestep than the default 0.1 seconds, 
                 # in order to get numerical accuracy.
                 for i in range (10, 19 ):
-		    moose.setClock( i, 0.1 ) # for computational objects
+                    moose.setClock( i, 0.1 ) # for computational objects
 
 def main():
-		makeModel()
+                makeModel()
                 moose.seed()
 
-		moose.reinit()
-		moose.start( 50.0 ) # Run the model for 100 seconds.
+                moose.reinit()
+                moose.start( 50.0 ) # Run the model for 100 seconds.
 
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
+                a = moose.element( '/model/compartment/a' )
+                b = moose.element( '/model/compartment/b' )
 
-		# Iterate through all plots, dump their contents to data.plot.
-		for x in moose.wildcardFind( '/model/graphs/n#' ):
-				#x.xplot( 'scriptKineticModel.plot', x.name )
-				t = numpy.arange( 0, x.vector.size, 1 ) * x.dt # sec
-				pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
+                # Iterate through all plots, dump their contents to data.plot.
+                for x in moose.wildcardFind( '/model/graphs/n#' ):
+                                #x.xplot( 'scriptKineticModel.plot', x.name )
+                                t = numpy.arange( 0, x.vector.size, 1 ) * x.dt # sec
+                                pylab.plot( t, x.vector, label=x.name )
+                pylab.legend()
+                pylab.show()
 
-		quit()
+                quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/funcRateHarmonicOsc.py b/snippets/funcRateHarmonicOsc.py
index 029f49f0..6fbd0af9 100644
--- a/snippets/funcRateHarmonicOsc.py
+++ b/snippets/funcRateHarmonicOsc.py
@@ -14,18 +14,18 @@ import moose
 
 runtime = 120.0
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		harmonic = moose.CubeMesh( '/model/harmonic' )
-		harmonic.volume = 1e-15
-		lotka = moose.CubeMesh( '/model/lotka' )
-		lotka.volume = 1e-15
-
-		# create molecules and reactions
-		p = moose.Pool( '/model/harmonic/p' )
-		v = moose.Pool( '/model/harmonic/v' )
-		pdot = moose.Function( '/model/harmonic/p/func' )
-		vdot = moose.Function( '/model/harmonic/v/func' )
+                # create container for model
+                model = moose.Neutral( 'model' )
+                harmonic = moose.CubeMesh( '/model/harmonic' )
+                harmonic.volume = 1e-15
+                lotka = moose.CubeMesh( '/model/lotka' )
+                lotka.volume = 1e-15
+
+                # create molecules and reactions
+                p = moose.Pool( '/model/harmonic/p' )
+                v = moose.Pool( '/model/harmonic/v' )
+                pdot = moose.Function( '/model/harmonic/p/func' )
+                vdot = moose.Function( '/model/harmonic/v/func' )
 
                 # Parameters
                 offset1 = 1.0
@@ -38,25 +38,25 @@ def makeModel():
                 pdot.expr = "x0 - " + str( offset1 )
                 vdot.expr = "-" + str( k ) + " * (x0 - " + str( offset2 ) + ")"
 
-		# connect them up for reactions
-		moose.connect( p, 'nOut', vdot.x[0], 'input' )
-		moose.connect( v, 'nOut', pdot.x[0], 'input' )
+                # connect them up for reactions
+                moose.connect( p, 'nOut', vdot.x[0], 'input' )
+                moose.connect( v, 'nOut', pdot.x[0], 'input' )
                 moose.connect( vdot, 'valueOut', v, 'increment' )
                 moose.connect( pdot, 'valueOut', p, 'increment' )
 
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		pplot = moose.Table2 ( '/model/graphs/p' )
-		vplot = moose.Table2 ( '/model/graphs/v' )
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                pplot = moose.Table2 ( '/model/graphs/p' )
+                vplot = moose.Table2 ( '/model/graphs/v' )
 
-		# connect up the tables
-		moose.connect( pplot, 'requestOut', p, 'getN' );
-		moose.connect( vplot, 'requestOut', v, 'getN' );
+                # connect up the tables
+                moose.connect( pplot, 'requestOut', p, 'getN' );
+                moose.connect( vplot, 'requestOut', v, 'getN' );
 
 def main():
 
-	"""
-	funcRateHarmonicOsc illustrates the use of function objects to
+        """
+        funcRateHarmonicOsc illustrates the use of function objects to
         directly define the rates of change of pool concentration. This
         example shows how to set up a simple harmonic oscillator system
         of differential equations using the script. In normal use one would
@@ -64,31 +64,31 @@ def main():
 
         The equations are ::
 
-	        p' = v - offset1
-	        v' = -k(p - offset2)
+                p' = v - offset1
+                v' = -k(p - offset2)
 
-	where the rates for Pools p and v are computed using Functions.
-	Note the use of offsets. This is because MOOSE chemical
-	systems cannot have negative concentrations.
-	
-	The model is set up to run using default Exponential Euler 
-	integration, and then using the GSL deterministic solver.
-	"""
-	makeModel()
+        where the rates for Pools p and v are computed using Functions.
+        Note the use of offsets. This is because MOOSE chemical
+        systems cannot have negative concentrations.
+        
+        The model is set up to run using default Exponential Euler 
+        integration, and then using the GSL deterministic solver.
+        """
+        makeModel()
 
         for i in range( 11, 18 ):
             moose.setClock( i, 0.01 )
         moose.setClock( 18, 0.1 )
-	moose.reinit()
-	moose.start( runtime ) # Run the model
-
-	# Iterate through all plots, dump their contents to data.plot.
-	for x in moose.wildcardFind( '/model/graphs/#' ):
-		#x.xplot( 'scriptKineticModel.plot', x.name )
-		t = numpy.arange( 0, x.vector.size, 1 ) * x.dt # sec
-		pylab.plot( t, x.vector, label=x.name )
+        moose.reinit()
+        moose.start( runtime ) # Run the model
+
+        # Iterate through all plots, dump their contents to data.plot.
+        for x in moose.wildcardFind( '/model/graphs/#' ):
+                #x.xplot( 'scriptKineticModel.plot', x.name )
+                t = numpy.arange( 0, x.vector.size, 1 ) * x.dt # sec
+                pylab.plot( t, x.vector, label=x.name )
         pylab.suptitle( "Integration using ee" )
-	pylab.legend()
+        pylab.legend()
         pylab.figure()
 
         compt = moose.element( '/model/harmonic' )
@@ -99,18 +99,18 @@ def main():
         stoich.path = '/model/harmonic/##'
         for i in range( 11, 18 ):
             moose.setClock( i, 0.1 )
-	moose.reinit()
-	moose.start( runtime ) # Run the model
+        moose.reinit()
+        moose.start( runtime ) # Run the model
 
-	for x in moose.wildcardFind( '/model/graphs/#' ):
-		t = numpy.arange( 0, x.vector.size, 1 ) * x.dt # sec
-		pylab.plot( t, x.vector, label=x.name )
+        for x in moose.wildcardFind( '/model/graphs/#' ):
+                t = numpy.arange( 0, x.vector.size, 1 ) * x.dt # sec
+                pylab.plot( t, x.vector, label=x.name )
         pylab.suptitle( "Integration using gsl" )
-	pylab.legend()
-	pylab.show()
+        pylab.legend()
+        pylab.show()
 
-	quit()
+        quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/funcReacLotkaVolterra.py b/snippets/funcReacLotkaVolterra.py
index a1922392..13a90119 100644
--- a/snippets/funcReacLotkaVolterra.py
+++ b/snippets/funcReacLotkaVolterra.py
@@ -15,21 +15,21 @@ import moose
 
 runtime = 50.0
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		harmonic = moose.CubeMesh( '/model/harmonic' )
-		harmonic.volume = 1e-15
-		lotka = moose.CubeMesh( '/model/lotka' )
-		lotka.volume = 1e-15
-
-		# create molecules and reactions
-		x = moose.Pool( '/model/lotka/x' )
-		y = moose.Pool( '/model/lotka/y' )
+                # create container for model
+                model = moose.Neutral( 'model' )
+                harmonic = moose.CubeMesh( '/model/harmonic' )
+                harmonic.volume = 1e-15
+                lotka = moose.CubeMesh( '/model/lotka' )
+                lotka.volume = 1e-15
+
+                # create molecules and reactions
+                x = moose.Pool( '/model/lotka/x' )
+                y = moose.Pool( '/model/lotka/y' )
                 z = moose.BufPool( '/model/lotka/z' ) # Dummy molecule.
                 xreac = moose.Reac( '/model/lotka/xreac' )
                 yreac = moose.Reac( '/model/lotka/yreac' )
-		xrate = moose.Function( '/model/lotka/xreac/func' )
-		yrate = moose.Function( '/model/lotka/yreac/func' )
+                xrate = moose.Function( '/model/lotka/xreac/func' )
+                yrate = moose.Function( '/model/lotka/yreac/func' )
 
                 # Parameters
                 alpha = 1.0
@@ -49,9 +49,9 @@ def makeModel():
                 xreac.Kb = 0
                 yreac.Kb = 0
 
-		# connect them up for reactions
-		moose.connect( y, 'nOut', xrate.x[0], 'input' )
-		moose.connect( x, 'nOut', yrate.x[0], 'input' )
+                # connect them up for reactions
+                moose.connect( y, 'nOut', xrate.x[0], 'input' )
+                moose.connect( x, 'nOut', yrate.x[0], 'input' )
                 moose.connect( xrate, 'valueOut', xreac, 'setNumKf' )
                 moose.connect( yrate, 'valueOut', yreac, 'setNumKf' )
                 moose.connect( xreac, 'sub', x, 'reac' )
@@ -59,14 +59,14 @@ def makeModel():
                 moose.connect( yreac, 'sub', y, 'reac' )
                 moose.connect( yreac, 'prd', z, 'reac' )
 
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		xplot = moose.Table2 ( '/model/graphs/x' )
-		yplot = moose.Table2 ( '/model/graphs/y' )
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                xplot = moose.Table2 ( '/model/graphs/x' )
+                yplot = moose.Table2 ( '/model/graphs/y' )
 
-		# connect up the tables
-		moose.connect( xplot, 'requestOut', x, 'getN' );
-		moose.connect( yplot, 'requestOut', y, 'getN' );
+                # connect up the tables
+                moose.connect( xplot, 'requestOut', x, 'getN' );
+                moose.connect( yplot, 'requestOut', y, 'getN' );
 
 def main():
     """
diff --git a/snippets/gssaCylinderDiffusion.py b/snippets/gssaCylinderDiffusion.py
index 57033a42..932c4aa2 100644
--- a/snippets/gssaCylinderDiffusion.py
+++ b/snippets/gssaCylinderDiffusion.py
@@ -9,12 +9,12 @@
 
 
 import sys
-sys.path.append('../../python')
 import math
 import pylab
 import numpy
 import matplotlib.pyplot as plt
 import moose
+print(('[INFO] Using moose from %s' % moose.__file__ ))
 
 import os
 import signal 
@@ -58,11 +58,11 @@ def makeModel():
     The concentrations of all molecules are displayed in an animation.
     """
     # create container for model
-    r0 = 2e-6	# m
-    r1 = 1e-6	# m
+    r0 = 2e-6        # m
+    r1 = 1e-6        # m
     num = 100
     diffLength = 1e-6 # m
-    len = num * diffLength	# m
+    len = num * diffLength        # m
     diffConst = 10e-12
     #motorRate = 1e-6
     #diffConst = 0
@@ -108,7 +108,7 @@ def makeModel():
     os.kill( PID, signal.SIGUSR1 )
     stoich.path = "/model/compartment/##"
 
-    print dsolve.numPools
+    print((dsolve.numPools))
     assert( dsolve.numPools == 4 )
     a.vec.concInit = concA
     b.vec.concInit = concA / 5.0
@@ -178,22 +178,24 @@ def main():
     for t in numpy.arange( 0, runtime, plotdt ):
         moose.start( plotdt )
         updatePlots( plotlist, t )
-    # moose.start( runtime ) # Run the model
+
+    # save the final result to a file.
+    outfile = '%s.png' % sys.argv[0]
+    plt.savefig( outfile )
+    print(( '[INFO] Saved results to %s' % outfile ))
 
     atot2 = sum( a.vec.n )
     btot2 = sum( b.vec.n )
     ctot2 = sum( c.vec.n )
     dtot2 = sum( d.vec.n )
 
-    print 'Ratio of initial to final total numbers of of a, b, c, d = '
-    print atot2/atot, btot2/btot, ctot2/ctot, dtot2/dtot
-    print 'Initial to final (b+c)=', (btot2 + ctot2) / (btot + ctot )
-    print "\nHit 'enter' to exit"
-    #raw_input()
-
+    msg = 'Ratio of initial to final total numbers of '
+    msg += 'a=%f b=%f, c=%f, d=%f'% (atot2/atot, btot2/btot, ctot2/ctot, dtot2/dtot)
+    print(msg)
+    print(('Initial to final (b+c)=%f' % (float(btot2 + ctot2) / (btot + ctot ))))
     quit()
 
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+    main()
diff --git a/snippets/gssaRDspiny.py b/snippets/gssaRDspiny.py
index 46beebcd..5e95febe 100644
--- a/snippets/gssaRDspiny.py
+++ b/snippets/gssaRDspiny.py
@@ -133,46 +133,46 @@ def makeDisplay():
         plt.xlabel( 'time (seconds)' )
         plt.legend()
 
-	a = moose.vec( '/model/chem/compt0/a' )
-	b = moose.vec( '/model/chem/compt0/b' )
-        line1, = dend.plot( range( len( a ) ), a.conc, label='a' )
-        line2, = dend.plot( range( len( b ) ), b.conc, label='b' )
+        a = moose.vec( '/model/chem/compt0/a' )
+        b = moose.vec( '/model/chem/compt0/b' )
+        line1, = dend.plot( list(range( len( a ))), a.conc, label='a' )
+        line2, = dend.plot( list(range( len( b ))), b.conc, label='b' )
         dend.set_ylim( 0, 0.6 )
 
-	a = moose.vec( '/model/chem/compt1/a' )
-	b = moose.vec( '/model/chem/compt1/b' )
-        line3, = spine.plot( range( len( a ) ), a.conc, label='a' )
-        line4, = spine.plot( range( len( b ) ), b.conc, label='b' )
+        a = moose.vec( '/model/chem/compt1/a' )
+        b = moose.vec( '/model/chem/compt1/b' )
+        line3, = spine.plot( list(range( len( a ))), a.conc, label='a' )
+        line4, = spine.plot( list(range( len( b ))), b.conc, label='b' )
         spine.set_ylim( 0, 0.6 )
 
-	a = moose.vec( '/model/chem/compt2/a' )
-	b = moose.vec( '/model/chem/compt2/b' )
-        line5, = psd.plot( range( len( a ) ), a.conc, label='a' )
-        line6, = psd.plot( range( len( b ) ), b.conc, label='b' )
+        a = moose.vec( '/model/chem/compt2/a' )
+        b = moose.vec( '/model/chem/compt2/b' )
+        line5, = psd.plot( list(range( len( a ))), a.conc, label='a' )
+        line6, = psd.plot( list(range( len( b ))), b.conc, label='b' )
         psd.set_ylim( 0, 0.6 )
 
         fig.canvas.draw()
         return ( timeSeries, dend, spine, psd, fig, line1, line2, line3, line4, line5, line6, timeLabel )
 
 def updateDisplay( plotlist ):
-	a = moose.vec( '/model/chem/compt0/a' )
-	b = moose.vec( '/model/chem/compt0/b' )
+        a = moose.vec( '/model/chem/compt0/a' )
+        b = moose.vec( '/model/chem/compt0/b' )
         plotlist[5].set_ydata( a.conc )
         plotlist[6].set_ydata( b.conc )
-        print 'compt0:', min(a.n), max(a.n), min(b.n), max(b.n)
+        print(('compt0:', min(a.n), max(a.n), min(b.n), max(b.n)))
 
-	a = moose.vec( '/model/chem/compt1/a' )
-	b = moose.vec( '/model/chem/compt1/b' )
+        a = moose.vec( '/model/chem/compt1/a' )
+        b = moose.vec( '/model/chem/compt1/b' )
         plotlist[7].set_ydata( a.conc )
         plotlist[8].set_ydata( b.conc )
-        print 'compt1:', min(a.n), max(a.n), min(b.n), max(b.n)
+        print(('compt1:', min(a.n), max(a.n), min(b.n), max(b.n)))
 
-	a = moose.vec( '/model/chem/compt2/a' )
-	b = moose.vec( '/model/chem/compt2/b' )
+        a = moose.vec( '/model/chem/compt2/a' )
+        b = moose.vec( '/model/chem/compt2/b' )
         plotlist[9].set_ydata( a.conc )
         plotlist[10].set_ydata( b.conc )
         plotlist[4].canvas.draw()
-        print 'compt2:', min(a.n), max(a.n), min(b.n), max(b.n)
+        print(('compt2:', min(a.n), max(a.n), min(b.n), max(b.n)))
 
 
 def finalizeDisplay( plotlist, cPlotDt ):
@@ -181,7 +181,7 @@ def finalizeDisplay( plotlist, cPlotDt ):
         line1, = plotlist[0].plot( pos, x.vector, label=x.name )
     plotlist[4].canvas.draw()
     print( "Hit 'enter' to exit" )
-    raw_input()
+    eval(input())
 
 def makeChemModel( compt ):
     """
@@ -293,4 +293,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/hdfdemo.py b/snippets/hdfdemo.py
index f9081c2e..081b2c1f 100644
--- a/snippets/hdfdemo.py
+++ b/snippets/hdfdemo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # Author: Subhasis Ray
 
 """HDF5 is a self-describing file format for storing large
@@ -92,7 +92,7 @@ def example():
     moose.start(30.0)
     hdfwriter.close()
     vm_tab.plainPlot('hdfdemo_Vm.csv')
-    print 'Finished simulation. Data was saved in', hdfwriter.filename
+    print(('Finished simulation. Data was saved in', hdfwriter.filename))
 
    
 if __name__ == '__main__':
diff --git a/snippets/helloMoose.py b/snippets/helloMoose.py
index 1db5f60e..c9fe2933 100644
--- a/snippets/helloMoose.py
+++ b/snippets/helloMoose.py
@@ -36,4 +36,4 @@ def main():
     pylab.show()
 
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/hhcomp.py b/snippets/hhcomp.py
index 7115a57a..3a7e46fd 100644
--- a/snippets/hhcomp.py
+++ b/snippets/hhcomp.py
@@ -205,7 +205,7 @@ def test_hhcomp():
     model = moose.Neutral('/model')
     data = moose.Neutral('/data')    
     comp, na, k = create_hhcomp(parent=model.path)
-    print comp.Rm, comp.Cm, na.Ek, na.Gbar, k.Ek, k.Gbar
+    print((comp.Rm, comp.Cm, na.Ek, na.Gbar, k.Ek, k.Gbar))
     pg = moose.PulseGen('%s/pg' % (model.path))
     pg.firstDelay = 20e-3
     pg.firstWidth = 40e-3
diff --git a/snippets/insertSpines.py b/snippets/insertSpines.py
index 024e8aa3..5d8a31c8 100644
--- a/snippets/insertSpines.py
+++ b/snippets/insertSpines.py
@@ -56,7 +56,7 @@ def main():
     # Now we set up the display
     compts = moose.wildcardFind( "/model/elec/#[ISA=CompartmentBase]" )
     compts[0].inject = inject
-    ecomptPath = map( lambda x : x.path, compts )
+    ecomptPath = [x.path for x in compts]
     morphology = moogli.read_morphology_from_moose(name = "", path = "/model/elec")
     #morphology.create_group( "group_all", ecomptPath, -0.08, 0.02, \
     #        [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 0.9] ) 
@@ -67,7 +67,7 @@ def main():
     viewer.set_background_color( 1.0, 1.0, 1.0, 1.0 )
     def callback( morphology, viewer ):
         moose.start( frameRunTime )
-        Vm = map( lambda x: moose.element( x ).Vm, compts )
+        Vm = [moose.element( x ).Vm for x in compts]
         morphology.set_color( "group_all", Vm )
         currTime = moose.element( '/clock' ).currentTime
         #print currTime, compts[0].Vm
diff --git a/snippets/insertSpinesWithoutRdesigneur.py b/snippets/insertSpinesWithoutRdesigneur.py
index 48ae40e3..484653e2 100644
--- a/snippets/insertSpinesWithoutRdesigneur.py
+++ b/snippets/insertSpinesWithoutRdesigneur.py
@@ -84,7 +84,7 @@ def main():
     # Now we set up the display
     compts = moose.wildcardFind( "/model/#[ISA=CompartmentBase]" )
     compts[0].inject = inject
-    ecomptPath = map( lambda x : x.path, compts )
+    ecomptPath = [x.path for x in compts]
     morphology = moogli.read_morphology_from_moose(name = "", path = "/model")
     morphology.create_group( "group_all", ecomptPath, -0.08, 0.02, \
             [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 0.9] ) 
@@ -92,7 +92,7 @@ def main():
     viewer = moogli.DynamicMorphologyViewerWidget(morphology)
     def callback( morphology, viewer ):
         moose.start( frameRunTime )
-        Vm = map( lambda x: moose.element( x ).Vm, compts )
+        Vm = [moose.element( x ).Vm for x in compts]
         morphology.set_color( "group_all", Vm )
         currTime = moose.element( '/clock' ).currentTime
         #print currTime, compts[0].Vm
diff --git a/snippets/interpol.py b/snippets/interpol.py
index 61193c64..a2f031f0 100644
--- a/snippets/interpol.py
+++ b/snippets/interpol.py
@@ -72,8 +72,8 @@ stimtab.stepSize = 0.0
 # stimtab.startTime = 0.0
 # stimtab.stopTime = simtime
 stimtab.vector = np.linspace(-4, 4, 1000)
-print stimtab.vector
-print interpol.vector
+print((stimtab.vector))
+print((interpol.vector))
 moose.connect(stimtab, 'output', interpol, 'input')
 
 
diff --git a/snippets/interpol2d.py b/snippets/interpol2d.py
index 46a3041f..a6ccef2e 100644
--- a/snippets/interpol2d.py
+++ b/snippets/interpol2d.py
@@ -61,18 +61,18 @@ def interpolation_demo():
     # Make a 50 element array with entries at equal distance from
     # [0,1) and reshape it into a 10x5 matrix and assign to table.
     matrix = np.linspace(0, 1.0, 50).reshape(10, 5)
-    print 'Setting table to'
-    print matrix
+    print('Setting table to')
+    print(matrix)
     interpol.tableVector2D = matrix
     # interpolating beyond top left corner.
     # value should be 
     pos = (0.8, 0.3)
     
-    print 'Interpolated value at', pos
-    print interpol.z[pos[0], pos[1]]
+    print(('Interpolated value at', pos))
+    print((interpol.z[pos[0], pos[1]]))
     
-    print 'Point going out of bound on both x and y', interpol.z[1.1, 1.1]
-    print 'Point going out of bound on both x and y', interpol.z[0.5, 1.1]
+    print(('Point going out of bound on both x and y', interpol.z[1.1, 1.1]))
+    print(('Point going out of bound on both x and y', interpol.z[0.5, 1.1]))
 
 if __name__ == '__main__':
     interpolation_demo()
diff --git a/snippets/loadCspaceModel.py b/snippets/loadCspaceModel.py
index 561f4199..a5956fba 100644
--- a/snippets/loadCspaceModel.py
+++ b/snippets/loadCspaceModel.py
@@ -49,26 +49,26 @@ import pylab
 import numpy
 import moose
 def main():
-	""" This example illustrates loading and running, a kinetic model 
-	 defined in cspace format. We use the gsl solver here. The model already
-	 defines a couple of plots and sets the runtime to 3000 seconds. 
-	"""
-	# This command loads the file into the path '/model', and tells
-	# the system to use the gsl solver.
-	modelId = moose.loadModel( 'Osc.cspace', 'model', 'gsl' )
-	moose.reinit()
-	moose.start( 3000.0 ) # Run the model for 300 seconds.
+        """ This example illustrates loading and running, a kinetic model 
+         defined in cspace format. We use the gsl solver here. The model already
+         defines a couple of plots and sets the runtime to 3000 seconds. 
+        """
+        # This command loads the file into the path '/model', and tells
+        # the system to use the gsl solver.
+        modelId = moose.loadModel( 'Osc.cspace', 'model', 'gsl' )
+        moose.reinit()
+        moose.start( 3000.0 ) # Run the model for 300 seconds.
 
-	# display all plots
-	for x in moose.wildcardFind( '/model/graphs/#' ):
-		t = numpy.arange( 0, x.vector.size, 1 ) #sec
-		pylab.plot( t, x.vector, label=x.name )
-	pylab.legend()
-	pylab.show()
+        # display all plots
+        for x in moose.wildcardFind( '/model/graphs/#' ):
+                t = numpy.arange( 0, x.vector.size, 1 ) #sec
+                pylab.plot( t, x.vector, label=x.name )
+        pylab.legend()
+        pylab.show()
 
-	# moose.saveModel( modelId, 'saveReaction.g' )
-	quit()
+        # moose.saveModel( modelId, 'saveReaction.g' )
+        quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/loadKineticModel.py b/snippets/loadKineticModel.py
index 49206ad8..c31d4619 100644
--- a/snippets/loadKineticModel.py
+++ b/snippets/loadKineticModel.py
@@ -51,47 +51,47 @@ import sys
 
 def main():
         """ This example illustrates loading, running, and saving a kinetic model 
-	defined in kkit format. It uses a default kkit model but you can specify another using the command line ``python filename runtime solver``. We use the gsl solver here. The model already defines a couple of plots and sets the runtime to 20 seconds.
-	"""
-	solver = "gsl"  # Pick any of gsl, gssa, ee..
-	mfile = '../genesis/kkit_objects_example.g'
-	runtime = 20.0
-	if ( len( sys.argv ) >= 3 ):
+        defined in kkit format. It uses a default kkit model but you can specify another using the command line ``python filename runtime solver``. We use the gsl solver here. The model already defines a couple of plots and sets the runtime to 20 seconds.
+        """
+        solver = "gsl"  # Pick any of gsl, gssa, ee..
+        mfile = '../genesis/kkit_objects_example.g'
+        runtime = 20.0
+        if ( len( sys.argv ) >= 3 ):
             if sys.argv[1][0] == '/':
-		mfile = sys.argv[1]
+                mfile = sys.argv[1]
             else:
-		mfile = '../genesis/' + sys.argv[1]
-    	    runtime = float( sys.argv[2] )
-	if ( len( sys.argv ) == 4 ):
+                mfile = '../genesis/' + sys.argv[1]
+                runtime = float( sys.argv[2] )
+        if ( len( sys.argv ) == 4 ):
                 solver = sys.argv[3]
-	modelId = moose.loadModel( mfile, 'model', solver )
+        modelId = moose.loadModel( mfile, 'model', solver )
         # Increase volume so that the stochastic solver gssa 
         # gives an interesting output
         #compt = moose.element( '/model/kinetics' )
         #compt.volume = 1e-19 
 
-	moose.reinit()
-	moose.start( runtime ) 
+        moose.reinit()
+        moose.start( runtime ) 
 
         # Report parameters
         '''
-	for x in moose.wildcardFind( '/model/kinetics/##[ISA=PoolBase]' ):
-		print x.name, x.nInit, x.concInit
-	for x in moose.wildcardFind( '/model/kinetics/##[ISA=ReacBase]' ):
-		print x.name, 'num: (', x.numKf, ', ',  x.numKb, '), conc: (', x.Kf, ', ', x.Kb, ')'
-	for x in moose.wildcardFind('/model/kinetics/##[ISA=EnzBase]'):
-		print x.name, '(', x.Km, ', ',  x.numKm, ', ', x.kcat, ')'
+        for x in moose.wildcardFind( '/model/kinetics/##[ISA=PoolBase]' ):
+                print x.name, x.nInit, x.concInit
+        for x in moose.wildcardFind( '/model/kinetics/##[ISA=ReacBase]' ):
+                print x.name, 'num: (', x.numKf, ', ',  x.numKb, '), conc: (', x.Kf, ', ', x.Kb, ')'
+        for x in moose.wildcardFind('/model/kinetics/##[ISA=EnzBase]'):
+                print x.name, '(', x.Km, ', ',  x.numKm, ', ', x.kcat, ')'
                 '''
 
-	# Display all plots.
-	for x in moose.wildcardFind( '/model/#graphs/conc#/#' ):
+        # Display all plots.
+        for x in moose.wildcardFind( '/model/#graphs/conc#/#' ):
             t = numpy.arange( 0, x.vector.size, 1 ) * x.dt
             pylab.plot( t, x.vector, label=x.name )
         pylab.legend()
         pylab.show()
 
-	quit()
+        quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/loadMorphology.py b/snippets/loadMorphology.py
index 99cbc62a..a7215449 100644
--- a/snippets/loadMorphology.py
+++ b/snippets/loadMorphology.py
@@ -27,7 +27,7 @@ def main():
     # Now we set up the display
     compts = moose.wildcardFind( "/model/testSwc/#[ISA=CompartmentBase]" )
     compts[0].inject = inject
-    ecomptPath = map( lambda x : x.path, compts )
+    ecomptPath = [x.path for x in compts]
     morphology = moogli.read_morphology_from_moose(name = "", path = "/model/testSwc")
     morphology.create_group( "group_all", ecomptPath, -0.08, 0.02, \
             [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 0.9] ) 
@@ -35,7 +35,7 @@ def main():
     viewer = moogli.DynamicMorphologyViewerWidget(morphology)
     def callback( morphology, viewer ):
         moose.start( frameRunTime )
-        Vm = map( lambda x: moose.element( x ).Vm, compts )
+        Vm = [moose.element( x ).Vm for x in compts]
         morphology.set_color( "group_all", Vm )
         currTime = moose.element( '/clock' ).currentTime
         #print currTime, compts[0].Vm
diff --git a/snippets/loadSbmlmodel.py b/snippets/loadSbmlmodel.py
index 2781d9fc..1a717245 100644
--- a/snippets/loadSbmlmodel.py
+++ b/snippets/loadSbmlmodel.py
@@ -35,22 +35,22 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # General Public License for more details.
 # 
+import sys
+import os.path
 
-import moose
-import matplotlib
 import numpy as np
-import matplotlib.pyplot as plt
-import sys
 import pylab
+
+import moose
 from moose.SBML import *
-import os.path
+from moose.chemUtil.add_Delete_ChemicalSolver import *
 
 def main():
     """ This example illustrates loading, running of an SBML model defined in XML format.\n
-	The model 00001-sbml-l3v1.xml is taken from l3v1 SBML testcase.\n
-	Plots are setup.\n
-	Model is run for 20sec.\n
-	As a general rule we created model under '/path/model' and plots under '/path/graphs'.\n
+        The model 00001-sbml-l3v1.xml is taken from l3v1 SBML testcase.\n
+        Plots are setup.\n
+        Model is run for 20sec.\n
+        As a general rule we created model under '/path/model' and plots under '/path/graphs'.\n
     """
 
     mfile = "../genesis/00001-sbml-l3v1.xml"
@@ -67,11 +67,16 @@ def main():
         runtime = 20.0
     else:
         runtime = float(sys.argv[2])
+        
+    # Loading the sbml file into MOOSE, models are loaded in path/model
+    sbmlId = moose.SBML.readSBML.mooseReadSBML(mfile,'sbml')
     
     # Loading the sbml file into MOOSE, models are loaded in path/model
     sbmlId = mooseReadSBML(mfile,'/sbml')
-        
-    if sbmlId.path != '/':
+    if isinstance(sbmlId, (list, tuple)):
+            print(sbmlId)
+    elif sbmlId.path != '/':
+    
         s1 = moose.element('/sbml/model/compartment/S1')
         s2= moose.element('/sbml/model/compartment/S2')
                           
@@ -84,7 +89,9 @@ def main():
         moose.connect( outputs1,'requestOut', s1, 'getConc' );
         moose.connect( outputs2,'requestOut', s2, 'getConc' );
 
-            
+        # gsl solver is added, default is ee
+        mooseaddChemSolver(sbmlId.path,"ee")
+        
         # Reset and Run
         moose.reinit()
         moose.start(runtime)
@@ -95,7 +102,7 @@ def displayPlots():
     # Display all plots.
     for x in moose.wildcardFind( '/sbml/graphs/#[TYPE=Table2]' ):
         t = np.arange( 0, x.vector.size, 1 ) #sec
-        plt.plot( t, x.vector, label=x.name )
+        pylab.plot( t, x.vector, label=x.name )
     
     pylab.legend()
     pylab.show()
diff --git a/snippets/mgblock.py b/snippets/mgblock.py
index 2ad8741b..0c66ec53 100644
--- a/snippets/mgblock.py
+++ b/snippets/mgblock.py
@@ -133,7 +133,7 @@ def test_mgblock():
     for i in range( 10 ):
         moose.setClock( i, simdt )
     moose.setClock( Gnmda.tick, plotdt )
-    print spikegen.dt, Gnmda.dt
+    print((spikegen.dt, Gnmda.dt))
     moose.reinit()
     moose.start( simtime )
     t = pylab.linspace(0, simtime*1e3, len(Vm.vector))
diff --git a/snippets/multiscaleOneCompt.py b/snippets/multiscaleOneCompt.py
index 19202121..2ab95416 100644
--- a/snippets/multiscaleOneCompt.py
+++ b/snippets/multiscaleOneCompt.py
@@ -8,8 +8,9 @@
 ## See the file COPYING.LIB for the full notice.
 #########################################################################
 
+from __future__ import print_function
+
 import sys
-sys.path.append('../../python')
 import os
 os.environ['NUMPTHREADS'] = '1'
 import math
@@ -19,6 +20,7 @@ import matplotlib.pyplot as plt
 import moose
 import proto18
 
+scriptDir = os.path.dirname( os.path.realpath( __file__ ) )
 #EREST_ACT = -70e-3
 
 def loadElec():
@@ -33,19 +35,19 @@ def loadElec():
     for x in moose.wildcardFind( "/library/##" ):
         x.tick = -1
     model = moose.Neutral( '/model' )
-    cellId = moose.loadModel( 'soma.p', '/model/elec', "Neutral" )
+    cellId = moose.loadModel( 
+            os.path.join( scriptDir, 'soma.p')
+            , '/model/elec', "Neutral" 
+            )
     moose.setCwe( '/' )
-    '''
-    hsolve = moose.HSolve( '/model/elec/hsolve' )
-    hsolve.dt = 50.0e-6
-    hsolve.target = '/model/elec/soma'
-    moose.reinit()
-    '''
     return cellId
 
 def loadChem():
     chem = moose.Neutral( '/model/chem' )
-    modelId = moose.loadModel( '../genesis/chanPhosphByCaMKII.g', '/model/chem', 'gsl' )
+    modelId = moose.loadModel(
+            os.path.join( scriptDir, '..', 'genesis', 'chanPhosphByCaMKII.g' )
+                , '/model/chem', 'gsl' 
+                )
     nmstoich = moose.element( '/model/chem/kinetics/stoich' )
 
 def makeModel():
@@ -87,7 +89,7 @@ def addPlot( objpath, field, plot, tick ):
         tab.tick = tick
         return tab
     else:
-        print "failed in addPlot(", objpath, field, plot, tick, ")"
+        print(("failed in addPlot(", objpath, field, plot, tick, ")"))
         return 0
 
 def main():
@@ -177,4 +179,4 @@ def main():
     quit()
 
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/neuronFromDotp.py b/snippets/neuronFromDotp.py
index 8b8702c5..e7008c03 100644
--- a/snippets/neuronFromDotp.py
+++ b/snippets/neuronFromDotp.py
@@ -78,80 +78,80 @@ VMAX = 120e-3 + EREST_ACT
 VDIVS = 3000
 
 def makeChannelPrototypes():
-	"""Create channel prototypes for readcell."""
-	library = moose.Neutral( '/library' )
-	moose.setCwe( '/library' )
-	compt = moose.SymCompartment( '/library/symcompartment' )
-	Em = EREST_ACT + 10.613e-3
-	compt.Em = Em
-	compt.initVm = EREST_ACT
-	compt.Cm = 7.85e-9 * 0.5
-	compt.Rm = 4.2e5 * 5.0
-	compt.Ra = 7639.44e3
-	nachan = moose.HHChannel( '/library/Na' )
-	nachan.Xpower = 3
-	xGate = moose.HHGate(nachan.path + '/gateX')	
-	xGate.setupAlpha(Na_m_params + [VDIVS, VMIN, VMAX])
-	xGate.useInterpolation = 1
-	nachan.Ypower = 1
-	yGate = moose.HHGate(nachan.path + '/gateY')
-	yGate.setupAlpha(Na_h_params + [VDIVS, VMIN, VMAX])
-	yGate.useInterpolation = 1
-	nachan.Gbar = 0.942e-3
-	nachan.Ek = 115e-3+EREST_ACT
-
-	kchan = moose.HHChannel( '/library/K' )
-	kchan.Xpower = 4.0
-	xGate = moose.HHGate(kchan.path + '/gateX')	
-	xGate.setupAlpha(K_n_params + [VDIVS, VMIN, VMAX])
-	xGate.useInterpolation = 1
-	kchan.Gbar = 0.2836e-3
-	kchan.Ek = -12e-3+EREST_ACT
+        """Create channel prototypes for readcell."""
+        library = moose.Neutral( '/library' )
+        moose.setCwe( '/library' )
+        compt = moose.SymCompartment( '/library/symcompartment' )
+        Em = EREST_ACT + 10.613e-3
+        compt.Em = Em
+        compt.initVm = EREST_ACT
+        compt.Cm = 7.85e-9 * 0.5
+        compt.Rm = 4.2e5 * 5.0
+        compt.Ra = 7639.44e3
+        nachan = moose.HHChannel( '/library/Na' )
+        nachan.Xpower = 3
+        xGate = moose.HHGate(nachan.path + '/gateX')        
+        xGate.setupAlpha(Na_m_params + [VDIVS, VMIN, VMAX])
+        xGate.useInterpolation = 1
+        nachan.Ypower = 1
+        yGate = moose.HHGate(nachan.path + '/gateY')
+        yGate.setupAlpha(Na_h_params + [VDIVS, VMIN, VMAX])
+        yGate.useInterpolation = 1
+        nachan.Gbar = 0.942e-3
+        nachan.Ek = 115e-3+EREST_ACT
+
+        kchan = moose.HHChannel( '/library/K' )
+        kchan.Xpower = 4.0
+        xGate = moose.HHGate(kchan.path + '/gateX')        
+        xGate.setupAlpha(K_n_params + [VDIVS, VMIN, VMAX])
+        xGate.useInterpolation = 1
+        kchan.Gbar = 0.2836e-3
+        kchan.Ek = -12e-3+EREST_ACT
 
 def addPlot( objpath, field, plot ):
-	assert moose.exists( objpath )
-	tab = moose.Table( '/graphs/' + plot )
-	obj = moose.element( objpath )
-	moose.connect( tab, 'requestOut', obj, field )
-	return tab
+        assert moose.exists( objpath )
+        tab = moose.Table( '/graphs/' + plot )
+        obj = moose.element( objpath )
+        moose.connect( tab, 'requestOut', obj, field )
+        return tab
 
 def dumpPlots():
-	plots = moose.wildcardFind( '/graphs/##[ISA=Table]' )
-	for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
-	    t = numpy.arange( 0, x.size ) * x.dt # msec
-	    pylab.plot( t, x.vector, label=x.name)
+        plots = moose.wildcardFind( '/graphs/##[ISA=Table]' )
+        for x in moose.wildcardFind( '/graphs/##[ISA=Table]' ):
+            t = numpy.arange( 0, x.size ) * x.dt # msec
+            pylab.plot( t, x.vector, label=x.name)
 
-	pylab.legend()
-	pylab.show()
+        pylab.legend()
+        pylab.show()
 
 def makeModel():
-	makeChannelPrototypes()
-	cellId = moose.loadModel( 'dotp.p', '/model', 'Neutral' )
-	moose.element( '/model/soma' ).inject = 1.7e-9
-	graphs = moose.Neutral( '/graphs' )
-	addPlot( '/model/soma', 'getVm', 'somaVm' )
-	addPlot( '/model/apical_14', 'getVm', 'midVm' )
-	addPlot( '/model/lat_15_2', 'getVm', 'latVm' )
-	addPlot( '/model/apical_19', 'getVm', 'tipVm' )
+        makeChannelPrototypes()
+        cellId = moose.loadModel( 'dotp.p', '/model', 'Neutral' )
+        moose.element( '/model/soma' ).inject = 1.7e-9
+        graphs = moose.Neutral( '/graphs' )
+        addPlot( '/model/soma', 'getVm', 'somaVm' )
+        addPlot( '/model/apical_14', 'getVm', 'midVm' )
+        addPlot( '/model/lat_15_2', 'getVm', 'latVm' )
+        addPlot( '/model/apical_19', 'getVm', 'tipVm' )
 
 def testModel( useSolver ):
-	plotDt = 2e-4
-	if ( useSolver ):
-		elecDt = 50e-6
-		chemDt = 2e-3
+        plotDt = 2e-4
+        if ( useSolver ):
+                elecDt = 50e-6
+                chemDt = 2e-3
 
-	makeModel()
-	moose.setClock( 18, plotDt )
+        makeModel()
+        moose.setClock( 18, plotDt )
 
-	moose.reinit()
-	moose.start( 0.1 )
-	dumpPlots()
+        moose.reinit()
+        moose.start( 0.1 )
+        dumpPlots()
 
 def main():
-	testModel( 1 )
+        testModel( 1 )
 
 if __name__ == '__main__':
-	main()
+        main()
 
 # 
 # neuronFromDotp.py ends here
diff --git a/snippets/nsdf.py b/snippets/nsdf.py
index 93db9164..fc6d2007 100644
--- a/snippets/nsdf.py
+++ b/snippets/nsdf.py
@@ -125,12 +125,12 @@ def setup_model():
     nsdf.mode = 2 #overwrite existing file
     nsdf.flushLimit = 100
     moose.connect(nsdf, 'requestOut', pulse, 'getOutputValue')
-    print 'event input', nsdf.eventInput, nsdf.eventInput.num
-    print nsdf
+    print(('event input', nsdf.eventInput, nsdf.eventInput.num))
+    print(nsdf)
 
     nsdf.eventInput.num = 1
     ei = nsdf.eventInput[0]
-    print ei.path
+    print((ei.path))
     moose.connect(t_lead, 'spikeOut', nsdf.eventInput[0], 'input')
     tab = moose.Table('spiketab')
     tab.threshold = t_lead.threshold
@@ -138,10 +138,10 @@ def setup_model():
     for ii in range(32):
         moose.setClock(ii, dt)
     moose.connect(pulse, 'output', tab, 'spike')
-    print 'Starting simulation at:', datetime.now().isoformat()
+    print(('Starting simulation at:', datetime.now().isoformat()))
     moose.reinit()
     moose.start(simtime)
-    print 'Finished simulation at:', datetime.now().isoformat()
+    print(('Finished simulation at:', datetime.now().isoformat()))
     np.savetxt('nsdf.txt', tab.vector)
     ###################################
     # Set the environment attributes
diff --git a/snippets/nsdf_vec.py b/snippets/nsdf_vec.py
index 879c26d0..7a35586d 100644
--- a/snippets/nsdf_vec.py
+++ b/snippets/nsdf_vec.py
@@ -66,7 +66,7 @@ nsdf.py
 
 """
 
-from __future__ import print_function
+
 import numpy as np
 from datetime import datetime
 import getpass
@@ -110,10 +110,10 @@ def write_nsdf():
     clock = moose.element('/clock')
     for ii in range(32):
         moose.setClock(ii, dt)
-    print('Starting simulation at:', datetime.now().isoformat())
+    print(('Starting simulation at:', datetime.now().isoformat()))
     moose.reinit()
     moose.start(simtime)
-    print('Finished simulation at:', datetime.now().isoformat())
+    print(('Finished simulation at:', datetime.now().isoformat()))
     ###################################
     # Set the environment attributes
     ###################################
diff --git a/snippets/proto18.py b/snippets/proto18.py
index 83448ef7..b2fecbb3 100644
--- a/snippets/proto18.py
+++ b/snippets/proto18.py
@@ -4,7 +4,7 @@
 #** The 1991 Traub set of voltage and concentration dependent channels
 #** Implemented as tabchannels by : Dave Beeman
 #**      R.D.Traub, R. K. S. Wong, R. Miles, and H. Michelson
-#**	Journal of Neurophysiology, Vol. 66, p. 635 (1991)
+#**        Journal of Neurophysiology, Vol. 66, p. 635 (1991)
 #**
 #** This file depends on functions and constants defined in defaults.g
 #** As it is also intended as an example of the use of the tabchannel
@@ -52,61 +52,61 @@ SOMA_A = 3.320e-9       #// soma area in square meters
 #//========================================================================
 
 def make_Ca():
-	if moose.exists( 'Ca' ):
-		return
-	Ca = moose.HHChannel( 'Ca' )
-	Ca.Ek = ECA
-	Ca.Gbar = 40 * SOMA_A
-	Ca.Gk = 0
-	Ca.Xpower = 2
-	Ca.Ypower = 1
-	Ca.Zpower = 0
-
-	xgate = moose.element( 'Ca/gateX' )
-	xA = numpy.array( [ 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389, -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3, 3000, -0.1, 0.05 ] )
-#	xgate.min = -0.1
-#	xgate.max = 0.05
-#	xgate.divs = 3000
+        if moose.exists( 'Ca' ):
+                return
+        Ca = moose.HHChannel( 'Ca' )
+        Ca.Ek = ECA
+        Ca.Gbar = 40 * SOMA_A
+        Ca.Gk = 0
+        Ca.Xpower = 2
+        Ca.Ypower = 1
+        Ca.Zpower = 0
+
+        xgate = moose.element( 'Ca/gateX' )
+        xA = numpy.array( [ 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389, -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3, 3000, -0.1, 0.05 ] )
+#        xgate.min = -0.1
+#        xgate.max = 0.05
+#        xgate.divs = 3000
 #// Converting Traub's expressions for the gCa/s alpha and beta functions
 #// to SI units and entering the A, B, C, D and F parameters, we get:
-#	xgate.alpha( 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389 )
-#	xgate.beta( -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3 )
-	#xgate.setupAlpha( xA )
-	xgate.alphaParms = xA
+#        xgate.alpha( 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389 )
+#        xgate.beta( -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3 )
+        #xgate.setupAlpha( xA )
+        xgate.alphaParms = xA
 
 
 #  The Y gate (gCa/r) is not quite of this form.  For V > EREST_ACT, alpha =
 #  5*{exp({-50*(V - EREST_ACT)})}.  Otherwise, alpha = 5.  Over the entire
 #  range, alpha + beta = 5.  To create the Y_A and Y_B tables, we use some
 #  of the pieces of the setupalpha function.
-	ygate = moose.element( 'Ca/gateY' )
-	ygate.min = -0.1
-	ygate.max = 0.05
-	ygate.divs = 3000
-	yA = numpy.zeros( (ygate.divs + 1), dtype=float)
-	yB = numpy.zeros( (ygate.divs + 1), dtype=float)
+        ygate = moose.element( 'Ca/gateY' )
+        ygate.min = -0.1
+        ygate.max = 0.05
+        ygate.divs = 3000
+        yA = numpy.zeros( (ygate.divs + 1), dtype=float)
+        yB = numpy.zeros( (ygate.divs + 1), dtype=float)
 
 
 #Fill the Y_A table with alpha values and the Y_B table with (alpha+beta)
-	dx = (ygate.max - ygate.min)/ygate.divs
-	x = ygate.min
-	for i in range( ygate.divs + 1 ):
-		if ( x > EREST_ACT):
-			yA[i] = 5.0 * math.exp( -50 * (x - EREST_ACT) )
-		else:
-			yA[i] = 5.0
-		yB[i] = 5.0
-		x += dx
-	ygate.tableA = yA
-	ygate.tableB = yB
+        dx = (ygate.max - ygate.min)/ygate.divs
+        x = ygate.min
+        for i in range( ygate.divs + 1 ):
+                if ( x > EREST_ACT):
+                        yA[i] = 5.0 * math.exp( -50 * (x - EREST_ACT) )
+                else:
+                        yA[i] = 5.0
+                yB[i] = 5.0
+                x += dx
+        ygate.tableA = yA
+        ygate.tableB = yB
 # Tell the cell reader that the current from this channel must be fed into
 # the Ca_conc pool of calcium.
-	addmsg1 = moose.Mstring( '/library/Ca/addmsg1' )
-	addmsg1.value = '.	IkOut	../Ca_conc	current'
+        addmsg1 = moose.Mstring( '/library/Ca/addmsg1' )
+        addmsg1.value = '.        IkOut        ../Ca_conc        current'
 # in some compartments, whe have an NMDA_Ca_conc object to put the current
 # into.
-	addmsg2 = moose.Mstring( '/library/Ca/addmsg2' )
-	addmsg2.value = '.	IkOut	../NMDA_Ca_conc	current'
+        addmsg2 = moose.Mstring( '/library/Ca/addmsg2' )
+        addmsg2.value = '.        IkOut        ../NMDA_Ca_conc        current'
 # As we typically use the cell reader to create copies of these prototype
 #elements in one or more compartments, we need some way to be sure that the
 #needed messages are established.  Although the cell reader has enough
@@ -153,12 +153,12 @@ def make_Ca():
 #//========================================================================
 
 def make_Ca_conc():
-	if moose.exists( 'Ca_conc' ):
-		return
-	conc = moose.CaConc( 'Ca_conc' )
-	conc.tau = 0.013333  # sec
-	conc.B  = 17.402e12 # Curr to conc conversion for soma
-	conc.Ca_base = 0.0
+        if moose.exists( 'Ca_conc' ):
+                return
+        conc = moose.CaConc( 'Ca_conc' )
+        conc.tau = 0.013333  # sec
+        conc.B  = 17.402e12 # Curr to conc conversion for soma
+        conc.Ca_base = 0.0
 
 #This Ca_concen element should receive a message from any calcium channels
 # with the current going through the channel. Here we have this specified
@@ -176,38 +176,38 @@ def make_Ca_conc():
 #  functions of concentration, instead of voltage.
 
 def make_K_AHP():
-	if moose.exists( 'K_AHP' ):
-		return
-
-	K_AHP = moose.HHChannel( 'K_AHP' )
-	K_AHP.Ek = EK	#			V
-	K_AHP.Gbar = 8 * SOMA_A #	S
-	K_AHP.Gk = 0	#	S
-	K_AHP.Xpower = 0
-	K_AHP.Ypower = 0
-	K_AHP.Zpower = 1
-
-	zgate = moose.element( 'K_AHP/gateZ' )
-	xmax = 500.0
-	zgate.min = 0
-	zgate.max = xmax
-	zgate.divs = 3000
-	zA = numpy.zeros( (zgate.divs + 1), dtype=float)
-	zB = numpy.zeros( (zgate.divs + 1), dtype=float)
-	dx = (zgate.max - zgate.min)/zgate.divs
-	x = zgate.min
-	for i in range( zgate.divs + 1 ):
-		if (x < (xmax / 2.0 )):
-			zA[i] = 0.02*x
-		else:
-			zA[i] = 10.0
-		zB[i] = zA[i] + 1.0
-		x = x + dx
-
-	zgate.tableA = zA
-	zgate.tableB = zB
-	addmsg1 = moose.Mstring( '/library/K_AHP/addmsg1' )
-	addmsg1.value = '../Ca_conc	concOut	. concen'
+        if moose.exists( 'K_AHP' ):
+                return
+
+        K_AHP = moose.HHChannel( 'K_AHP' )
+        K_AHP.Ek = EK        #                        V
+        K_AHP.Gbar = 8 * SOMA_A #        S
+        K_AHP.Gk = 0        #        S
+        K_AHP.Xpower = 0
+        K_AHP.Ypower = 0
+        K_AHP.Zpower = 1
+
+        zgate = moose.element( 'K_AHP/gateZ' )
+        xmax = 500.0
+        zgate.min = 0
+        zgate.max = xmax
+        zgate.divs = 3000
+        zA = numpy.zeros( (zgate.divs + 1), dtype=float)
+        zB = numpy.zeros( (zgate.divs + 1), dtype=float)
+        dx = (zgate.max - zgate.min)/zgate.divs
+        x = zgate.min
+        for i in range( zgate.divs + 1 ):
+                if (x < (xmax / 2.0 )):
+                        zA[i] = 0.02*x
+                else:
+                        zA[i] = 10.0
+                zB[i] = zA[i] + 1.0
+                x = x + dx
+
+        zgate.tableA = zA
+        zgate.tableB = zB
+        addmsg1 = moose.Mstring( '/library/K_AHP/addmsg1' )
+        addmsg1.value = '../Ca_conc        concOut        . concen'
 # Use an added field to tell the cell reader to set up a message from the
 # Ca_Conc with concentration info, to the current K_AHP object.
 
@@ -228,71 +228,71 @@ def make_K_AHP():
 #the multiplicative Ca-dependent factor in the conductance.
 
 def make_K_C():
-	if moose.exists( 'K_C'):
-		return
-
-	K_C = moose.HHChannel( 'K_C' )
-	K_C.Ek = EK					#	V
-	K_C.Gbar = 100.0 * SOMA_A 	#	S
-	K_C.Gk = 0					#	S
-	K_C.Xpower = 1
-	K_C.Zpower = 1
-	K_C.instant = 4				# Flag: 0x100 means Z gate is instant.
-
-	# Now make a X-table for the voltage-dependent activation parameter.
-	xgate = moose.element( 'K_C/gateX' )
-	xgate.min = -0.1
-	xgate.max = 0.05
-	xgate.divs = 3000
-	xA = numpy.zeros( (xgate.divs + 1), dtype=float)
-	xB = numpy.zeros( (xgate.divs + 1), dtype=float)
-	dx = (xgate.max - xgate.min)/xgate.divs
-	x = xgate.min
-	for i in range( xgate.divs + 1 ):
-		alpha = 0.0
-		beta = 0.0
-		if (x < EREST_ACT + 0.05):
-			alpha = math.exp( 53.872 * (x - EREST_ACT) - 0.66835 ) / 0.018975
-			beta = 2000* (math.exp ( (EREST_ACT + 0.0065 - x)/0.027)) - alpha
-		else:
-			alpha = 2000 * math.exp( ( EREST_ACT + 0.0065 - x)/0.027 )
-			beta = 0.0
-		xA[i] = alpha
-		xB[i] = alpha + beta
-		x = x + dx
-	xgate.tableA = xA
-	xgate.tableB = xB
+        if moose.exists( 'K_C'):
+                return
+
+        K_C = moose.HHChannel( 'K_C' )
+        K_C.Ek = EK                                        #        V
+        K_C.Gbar = 100.0 * SOMA_A         #        S
+        K_C.Gk = 0                                        #        S
+        K_C.Xpower = 1
+        K_C.Zpower = 1
+        K_C.instant = 4                                # Flag: 0x100 means Z gate is instant.
+
+        # Now make a X-table for the voltage-dependent activation parameter.
+        xgate = moose.element( 'K_C/gateX' )
+        xgate.min = -0.1
+        xgate.max = 0.05
+        xgate.divs = 3000
+        xA = numpy.zeros( (xgate.divs + 1), dtype=float)
+        xB = numpy.zeros( (xgate.divs + 1), dtype=float)
+        dx = (xgate.max - xgate.min)/xgate.divs
+        x = xgate.min
+        for i in range( xgate.divs + 1 ):
+                alpha = 0.0
+                beta = 0.0
+                if (x < EREST_ACT + 0.05):
+                        alpha = math.exp( 53.872 * (x - EREST_ACT) - 0.66835 ) / 0.018975
+                        beta = 2000* (math.exp ( (EREST_ACT + 0.0065 - x)/0.027)) - alpha
+                else:
+                        alpha = 2000 * math.exp( ( EREST_ACT + 0.0065 - x)/0.027 )
+                        beta = 0.0
+                xA[i] = alpha
+                xB[i] = alpha + beta
+                x = x + dx
+        xgate.tableA = xA
+        xgate.tableB = xB
 
 # Create a table for the function of concentration, allowing a
 # concentration range of 0 to 1000, with 50 divisions.  This is done
 # using the Z gate, which can receive a CONCEN message.  By using
 # the "instant" flag, the A and B tables are evaluated as lookup tables,
 #  rather than being used in a differential equation.
-	zgate = moose.element( 'K_C/gateZ' )
-	zgate.min = 0.0
-	xmax = 500.0
-	zgate.max = xmax
-	zgate.divs = 3000
-	zA = numpy.zeros( (zgate.divs + 1), dtype=float)
-	zB = numpy.zeros( (zgate.divs + 1), dtype=float)
-	dx = ( zgate.max -  zgate.min)/ zgate.divs
-	x = zgate.min
-	for i in range( xgate.divs + 1 ):
-		if ( x < ( xmax / 4.0 ) ):
-			zA[i] = x * 4.0 / xmax
-		else:
-			zA[i] = 1.0
-		zB[i] = 1.0
-		x += dx
-	zgate.tableA = zA
-	zgate.tableB = zB
+        zgate = moose.element( 'K_C/gateZ' )
+        zgate.min = 0.0
+        xmax = 500.0
+        zgate.max = xmax
+        zgate.divs = 3000
+        zA = numpy.zeros( (zgate.divs + 1), dtype=float)
+        zB = numpy.zeros( (zgate.divs + 1), dtype=float)
+        dx = ( zgate.max -  zgate.min)/ zgate.divs
+        x = zgate.min
+        for i in range( xgate.divs + 1 ):
+                if ( x < ( xmax / 4.0 ) ):
+                        zA[i] = x * 4.0 / xmax
+                else:
+                        zA[i] = 1.0
+                zB[i] = 1.0
+                x += dx
+        zgate.tableA = zA
+        zgate.tableB = zB
 
 # Now we need to provide for messages that link to external elements.
 # The message that sends the Ca concentration to the Z gate tables is stored
 # in an added field of the channel, so that it may be found by the cell
 # reader.
-	addmsg1 = moose.Mstring( '/library/K_C/addmsg1' )
-	addmsg1.value = '../Ca_conc	concOut	. concen'
+        addmsg1 = moose.Mstring( '/library/K_C/addmsg1' )
+        addmsg1.value = '../Ca_conc        concOut        . concen'
 
 
 # The remaining channels are straightforward tabchannel implementations
@@ -301,103 +301,103 @@ def make_K_C():
 #/                Tabchannel Na Hippocampal cell channel
 #/========================================================================
 def make_Na():
-	if moose.exists( 'Na' ):
-		return
-	Na = moose.HHChannel( 'Na' )
-	Na.Ek = ENA				#	V
-	Na.Gbar = 300 * SOMA_A	#	S
-	Na.Gk = 0				#	S
-	Na.Xpower = 2
-	Na.Ypower = 1
-	Na.Zpower = 0
-
-	xgate = moose.element( 'Na/gateX' )
-	xA = numpy.array( [ 320e3 * (0.0131 + EREST_ACT),
-		-320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004, 
-		-280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, 
-		-1.0 * (0.0401 + EREST_ACT), 5.0e-3, 
-		3000, -0.1, 0.05 ] )
-	xgate.alphaParms = xA
-
-
-	#xgate.alpha( 320e3 * (0.0131 + EREST_ACT), -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004 )
-	#xgate.beta( -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 5.0e-3 )
-
-	ygate = moose.element( 'Na/gateY' )
-	yA = numpy.array( [ 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018,
-		4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3, 
-		3000, -0.1, 0.05 ] )
-	ygate.alphaParms = yA
-
-	#ygate.alpha( 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018 )
-	#ygate.beta( 4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3 )
+        if moose.exists( 'Na' ):
+                return
+        Na = moose.HHChannel( 'Na' )
+        Na.Ek = ENA                                #        V
+        Na.Gbar = 300 * SOMA_A        #        S
+        Na.Gk = 0                                #        S
+        Na.Xpower = 2
+        Na.Ypower = 1
+        Na.Zpower = 0
+
+        xgate = moose.element( 'Na/gateX' )
+        xA = numpy.array( [ 320e3 * (0.0131 + EREST_ACT),
+                -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004, 
+                -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, 
+                -1.0 * (0.0401 + EREST_ACT), 5.0e-3, 
+                3000, -0.1, 0.05 ] )
+        xgate.alphaParms = xA
+
+
+        #xgate.alpha( 320e3 * (0.0131 + EREST_ACT), -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004 )
+        #xgate.beta( -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 5.0e-3 )
+
+        ygate = moose.element( 'Na/gateY' )
+        yA = numpy.array( [ 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018,
+                4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3, 
+                3000, -0.1, 0.05 ] )
+        ygate.alphaParms = yA
+
+        #ygate.alpha( 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018 )
+        #ygate.beta( 4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3 )
 
 #========================================================================
 #                Tabchannel K(DR) Hippocampal cell channel
 #========================================================================
 def make_K_DR():
-	if moose.exists( 'K_DR' ):
-		return
-	K_DR = moose.HHChannel( 'K_DR' )
-	K_DR.Ek = EK				#	V
-	K_DR.Gbar = 150 * SOMA_A	#	S
-	K_DR.Gk = 0				#	S
-	K_DR.Xpower = 1
-	K_DR.Ypower = 0
-	K_DR.Zpower = 0
-
-	xgate = moose.element( 'K_DR/gateX' )
-	xA = numpy.array( [ 16e3 * (0.0351 + EREST_ACT), 
-		-16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005,
-		250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04,
-		3000, -0.1, 0.05 ] )
-	xgate.alphaParms = xA
-	#xgate.alpha( 16e3 * (0.0351 + EREST_ACT), -16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005 )
-	#xgate.beta( 250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04 )
+        if moose.exists( 'K_DR' ):
+                return
+        K_DR = moose.HHChannel( 'K_DR' )
+        K_DR.Ek = EK                                #        V
+        K_DR.Gbar = 150 * SOMA_A        #        S
+        K_DR.Gk = 0                                #        S
+        K_DR.Xpower = 1
+        K_DR.Ypower = 0
+        K_DR.Zpower = 0
+
+        xgate = moose.element( 'K_DR/gateX' )
+        xA = numpy.array( [ 16e3 * (0.0351 + EREST_ACT), 
+                -16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005,
+                250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04,
+                3000, -0.1, 0.05 ] )
+        xgate.alphaParms = xA
+        #xgate.alpha( 16e3 * (0.0351 + EREST_ACT), -16e3, -1.0, -1.0 * (0.0351 + EREST_ACT), -0.005 )
+        #xgate.beta( 250, 0.0, 0.0, -1.0 * (0.02 + EREST_ACT), 0.04 )
 
 #========================================================================
 #                Tabchannel K(A) Hippocampal cell channel
 #========================================================================
 def make_K_A():
-	if moose.exists( 'K_A' ):
-		return
-	K_A = moose.HHChannel( 'K_A' )
-	K_A.Ek = EK				#	V
-	K_A.Gbar = 50 * SOMA_A	#	S
-	K_A.Gk = 0				#	S
-	K_A.Xpower = 1
-	K_A.Ypower = 1
-	K_A.Zpower = 0
-
-	xgate = moose.element( 'K_A/gateX' )
-	xA = numpy.array( [ 20e3 * (0.0131 + EREST_ACT), 
-		-20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01,
-		-17.5e3 * (0.0401 + EREST_ACT), 
-		17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01,
-		3000, -0.1, 0.05 ] )
-	xgate.alphaParms = xA
-	# xgate.alpha( 20e3 * (0.0131 + EREST_ACT), -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01 )
-	# xgate.beta( -17.5e3 * (0.0401 + EREST_ACT), 17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01 )
-
-	ygate = moose.element( 'K_A/gateY' )
-	yA = numpy.array( [ 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018,
-		50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005,
-		3000, -0.1, 0.05 ] )
-	ygate.alphaParms = yA
-	# ygate.alpha( 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018 )
-	# ygate.beta( 50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005 )
+        if moose.exists( 'K_A' ):
+                return
+        K_A = moose.HHChannel( 'K_A' )
+        K_A.Ek = EK                                #        V
+        K_A.Gbar = 50 * SOMA_A        #        S
+        K_A.Gk = 0                                #        S
+        K_A.Xpower = 1
+        K_A.Ypower = 1
+        K_A.Zpower = 0
+
+        xgate = moose.element( 'K_A/gateX' )
+        xA = numpy.array( [ 20e3 * (0.0131 + EREST_ACT), 
+                -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01,
+                -17.5e3 * (0.0401 + EREST_ACT), 
+                17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01,
+                3000, -0.1, 0.05 ] )
+        xgate.alphaParms = xA
+        # xgate.alpha( 20e3 * (0.0131 + EREST_ACT), -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01 )
+        # xgate.beta( -17.5e3 * (0.0401 + EREST_ACT), 17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01 )
+
+        ygate = moose.element( 'K_A/gateY' )
+        yA = numpy.array( [ 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018,
+                50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005,
+                3000, -0.1, 0.05 ] )
+        ygate.alphaParms = yA
+        # ygate.alpha( 1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018 )
+        # ygate.beta( 50.0, 0.0, 1.0, -1.0 * (0.0101 + EREST_ACT), -0.005 )
 #========================================================================
 #                SynChan: Glu receptor
 #========================================================================
 
 def make_glu():
-	if moose.exists( 'glu' ):
-		return
-	glu = moose.SynChan( 'glu' )
-	glu.Ek = 0.0
-	glu.tau1 = 2.0e-3
-	glu.tau2 = 9.0e-3
-	glu.Gbar = 40 * SOMA_A
+        if moose.exists( 'glu' ):
+                return
+        glu = moose.SynChan( 'glu' )
+        glu.Ek = 0.0
+        glu.tau1 = 2.0e-3
+        glu.tau2 = 9.0e-3
+        glu.Gbar = 40 * SOMA_A
         sh = moose.SimpleSynHandler( 'glu/sh' )
         moose.connect( sh, 'activationOut', glu, 'activation' )
         sh.numSynapses = 1
@@ -409,39 +409,39 @@ def make_glu():
 #========================================================================
 
 def make_NMDA():
-	if moose.exists( 'NMDA' ):
-		return
-	NMDA = moose.SynChan( 'NMDA' )
-	NMDA.Ek = 0.0
-	NMDA.tau1 = 20.0e-3
-	NMDA.tau2 = 20.0e-3
-	NMDA.Gbar = 5 * SOMA_A
-
-	block = moose.MgBlock( '/library/NMDA/block' )
-	block.CMg = 1.2		#	[Mg] in mM
-	block.Zk = 2
-	block.KMg_A = 1.0/0.28
-	block.KMg_B = 1.0/62
-
-	moose.connect( NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
-	addmsg1 = moose.Mstring( '/library/NMDA/addmsg1' )
-	addmsg1.value = '.. channel	./block	channel'
-	#Here we want to also tell the cell reader to _remove_ the original
-	#Gk, Ek term going from the channel to the compartment, as this is
-	# now handled by the MgBlock.
-	#addmsg2 = moose.Mstring( 'NMDA/addmsg2'
-	#addmsg2.value = 'DropMsg	..	channel'
-	addmsg1 = moose.Mstring( '/library/NMDA/addmsg1' )
-	addmsg1.value = '.. VmOut	./block	Vm'
-	addmsg2 = moose.Mstring( '/library/NMDA/addmsg2' )
-	addmsg2.value = './block	IkOut ../Ca_conc current'
-	addmsg3 = moose.Mstring( '/library/NMDA/addmsg3' )
-	addmsg3.value = '.. VmOut	.	Vm'
-
-	sh = moose.SimpleSynHandler( 'NMDA/sh' )
-	moose.connect( sh, 'activationOut', NMDA, 'activation' )
-	sh.numSynapses = 1
-	sh.synapse[0].weight = 1
+        if moose.exists( 'NMDA' ):
+                return
+        NMDA = moose.SynChan( 'NMDA' )
+        NMDA.Ek = 0.0
+        NMDA.tau1 = 20.0e-3
+        NMDA.tau2 = 20.0e-3
+        NMDA.Gbar = 5 * SOMA_A
+
+        block = moose.MgBlock( '/library/NMDA/block' )
+        block.CMg = 1.2                #        [Mg] in mM
+        block.Zk = 2
+        block.KMg_A = 1.0/0.28
+        block.KMg_B = 1.0/62
+
+        moose.connect( NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
+        addmsg1 = moose.Mstring( '/library/NMDA/addmsg1' )
+        addmsg1.value = '.. channel        ./block        channel'
+        #Here we want to also tell the cell reader to _remove_ the original
+        #Gk, Ek term going from the channel to the compartment, as this is
+        # now handled by the MgBlock.
+        #addmsg2 = moose.Mstring( 'NMDA/addmsg2'
+        #addmsg2.value = 'DropMsg        ..        channel'
+        addmsg1 = moose.Mstring( '/library/NMDA/addmsg1' )
+        addmsg1.value = '.. VmOut        ./block        Vm'
+        addmsg2 = moose.Mstring( '/library/NMDA/addmsg2' )
+        addmsg2.value = './block        IkOut ../Ca_conc current'
+        addmsg3 = moose.Mstring( '/library/NMDA/addmsg3' )
+        addmsg3.value = '.. VmOut        .        Vm'
+
+        sh = moose.SimpleSynHandler( 'NMDA/sh' )
+        moose.connect( sh, 'activationOut', NMDA, 'activation' )
+        sh.numSynapses = 1
+        sh.synapse[0].weight = 1
 
 #addfield NMDA addmsg1
 #setfield NMDA addmsg1        ".. ./block VOLTAGE Vm"
@@ -461,37 +461,37 @@ def make_NMDA():
 #========================================================================
 
 def make_Ca_NMDA():
-	if moose.exists( 'Ca_NMDA' ):
-		return
-	Ca_NMDA = moose.SynChan( 'Ca_NMDA' )
-	Ca_NMDA.Ek = ECA
-	Ca_NMDA.tau1 = 20.0e-3
-	Ca_NMDA.tau2 = 20.0e-3
-	Ca_NMDA.Gbar = 5 * SOMA_A
-
-	block = moose.MgBlock( '/library/Ca_NMDA/block' )
-	block.CMg = 1.2		#	[Mg] in mM
-	block.Zk = 2
-	block.KMg_A = 1.0/0.28
-	block.KMg_B = 1.0/62
-
-	moose.connect( Ca_NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
-	addmsg1 = moose.Mstring( '/library/Ca_NMDA/addmsg1' )
-	addmsg1.value = '.. VmOut	./block	Vm'
-	addmsg2 = moose.Mstring( '/library/Ca_NMDA/addmsg2' )
-	addmsg2.value = './block	IkOut ../NMDA_Ca_conc current'
-	# The original model has the Ca current also coming here.
+        if moose.exists( 'Ca_NMDA' ):
+                return
+        Ca_NMDA = moose.SynChan( 'Ca_NMDA' )
+        Ca_NMDA.Ek = ECA
+        Ca_NMDA.tau1 = 20.0e-3
+        Ca_NMDA.tau2 = 20.0e-3
+        Ca_NMDA.Gbar = 5 * SOMA_A
+
+        block = moose.MgBlock( '/library/Ca_NMDA/block' )
+        block.CMg = 1.2                #        [Mg] in mM
+        block.Zk = 2
+        block.KMg_A = 1.0/0.28
+        block.KMg_B = 1.0/62
+
+        moose.connect( Ca_NMDA, 'channelOut', block, 'origChannel', 'OneToOne' )
+        addmsg1 = moose.Mstring( '/library/Ca_NMDA/addmsg1' )
+        addmsg1.value = '.. VmOut        ./block        Vm'
+        addmsg2 = moose.Mstring( '/library/Ca_NMDA/addmsg2' )
+        addmsg2.value = './block        IkOut ../NMDA_Ca_conc current'
+        # The original model has the Ca current also coming here.
 
 #========================================================================
 # Ca pool for influx through Ca_NMDA
 #========================================================================
 def make_NMDA_Ca_conc():
-	if moose.exists( 'NMDA_Ca_conc' ):
-		return
-	NMDA_Ca_conc = moose.CaConc( 'NMDA_Ca_conc' )
-	NMDA_Ca_conc.tau = 0.004   	# sec. Faster in spine than dend
-	NMDA_Ca_conc.B = 17.402e12	# overridden by cellreader.
-	NMDA_Ca_conc.Ca_base = 0.0
+        if moose.exists( 'NMDA_Ca_conc' ):
+                return
+        NMDA_Ca_conc = moose.CaConc( 'NMDA_Ca_conc' )
+        NMDA_Ca_conc.tau = 0.004           # sec. Faster in spine than dend
+        NMDA_Ca_conc.B = 17.402e12        # overridden by cellreader.
+        NMDA_Ca_conc.Ca_base = 0.0
 
 # This pool used to set up Ca info coming to it. Now we insist that the
 # originating channel should specify the deferred message.
@@ -502,9 +502,9 @@ def make_NMDA_Ca_conc():
 
 #//addmsg axon/spike axon BUFFER name
 def make_axon():
-	if moose.exists( 'axon' ):
-		return
-	axon = moose.SpikeGen( 'axon' )
-	axon.threshold = -40e-3 			#	V
-	axon.abs_refract = 10e-3			# 	sec
+        if moose.exists( 'axon' ):
+                return
+        axon = moose.SpikeGen( 'axon' )
+        axon.threshold = -40e-3                         #        V
+        axon.abs_refract = 10e-3                        #         sec
 
diff --git a/snippets/pulsegen.py b/snippets/pulsegen.py
index 2d554a93..2f6cfa36 100644
--- a/snippets/pulsegen.py
+++ b/snippets/pulsegen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # pulsegen.py --- 
 # 
 # Filename: pulsegen.py
diff --git a/snippets/pulsegen2.py b/snippets/pulsegen2.py
index 491ebf6b..b5c9f0ca 100644
--- a/snippets/pulsegen2.py
+++ b/snippets/pulsegen2.py
@@ -40,7 +40,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; see the file COPYING.  If not, write to
 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth
-# Floor, Boston, MA 02110-1301, USA.#!/usr/bin/env python
+# Floor, Boston, MA 02110-1301, USA.
 
 # 
 # 
@@ -164,7 +164,7 @@ pylab.plot(plotGate.vector)
 pylab.title('Free Running Gate')
 pylab.tight_layout()
 pylab.show()
-print "pulsegen.py: finished simulation"
+print("pulsegen.py: finished simulation")
 
 # 
 # pulsegen2.py ends here
diff --git a/snippets/reacDiffBranchingNeuron.py b/snippets/reacDiffBranchingNeuron.py
index fa4864eb..c76a3206 100644
--- a/snippets/reacDiffBranchingNeuron.py
+++ b/snippets/reacDiffBranchingNeuron.py
@@ -99,8 +99,8 @@ def makeDisplay():
         return ( timeSeries, fig, line, timeLabel, yp )
 
 def updateDisplay( plotlist ):
-	a = moose.vec( '/model/chem/compt0/a' )
-	b = moose.vec( '/model/chem/compt0/b' )
+        a = moose.vec( '/model/chem/compt0/a' )
+        b = moose.vec( '/model/chem/compt0/b' )
         plotlist[2].set_ydata( a.conc * 10 + plotlist[4]  )
 
         plotlist[1].canvas.draw()
@@ -113,7 +113,7 @@ def finalizeDisplay( plotlist, cPlotDt ):
     plt.legend()
     plotlist[1].canvas.draw()
     print( "Hit 'enter' to exit" )
-    raw_input()
+    eval(input())
 
 def makeChemModel( compt ):
     """
@@ -232,4 +232,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/reacDiffConcGradient.py b/snippets/reacDiffConcGradient.py
index 80cf4637..67f00209 100644
--- a/snippets/reacDiffConcGradient.py
+++ b/snippets/reacDiffConcGradient.py
@@ -17,7 +17,7 @@ import moose
 diffConst = 1e-12
 
 def makeCyl( num, concInit, radius, x0, x1 ):
-		compt = moose.CylMesh( '/model/compt' + num )
+                compt = moose.CylMesh( '/model/compt' + num )
                 compt.x0 = x0
                 compt.x1 = x1
                 compt.y0 = 0
@@ -29,14 +29,14 @@ def makeCyl( num, concInit, radius, x0, x1 ):
                 compt.diffLength = x1-x0
                 a = moose.Pool( compt.path + '/a' )
                 b = moose.Pool( compt.path + '/b' + num )
-		reac = moose.Reac( compt.path + '/reac' )
-		moose.connect( reac, 'sub', a, 'reac' )
-		moose.connect( reac, 'prd', b, 'reac' )
+                reac = moose.Reac( compt.path + '/reac' )
+                moose.connect( reac, 'sub', a, 'reac' )
+                moose.connect( reac, 'prd', b, 'reac' )
                 a.diffConst = diffConst
                 a.concInit = concInit
                 b.concInit = concInit
-		reac.Kf = 0.1
-		reac.Kb = 0.1
+                reac.Kf = 0.1
+                reac.Kb = 0.1
                 return a, b, compt
 
 def makeModel():
@@ -44,40 +44,40 @@ def makeModel():
                 len0 = 4e-6
                 len1 = 2e-6
                 len2 = 1e-6
-		# create container for model
-		model = moose.Neutral( 'model' )
+                # create container for model
+                model = moose.Neutral( 'model' )
                 a0, b0, compt0 = makeCyl( '0', 1, radius, -len0, 0 )
                 a1, b1, compt1 = makeCyl( '1', 2, radius, 0, len1 )
                 a2, b2, compt2 = makeCyl( '2', 6, radius, len1, len1 + len2 )
 
-                print('Volumes = ', compt0.volume, compt1.volume, compt2.volume)
+                print(('Volumes = ', compt0.volume, compt1.volume, compt2.volume))
 
-		# create molecules and reactions
-		reac0 = moose.Reac( '/model/compt1/reac0' )
-		reac1 = moose.Reac( '/model/compt1/reac1' )
+                # create molecules and reactions
+                reac0 = moose.Reac( '/model/compt1/reac0' )
+                reac1 = moose.Reac( '/model/compt1/reac1' )
 
-		# connect them up for reactions
-		moose.connect( reac0, 'sub', b0, 'reac' )
-		moose.connect( reac0, 'prd', b1, 'reac' )
-		moose.connect( reac1, 'sub', b1, 'reac' )
-		moose.connect( reac1, 'prd', b2, 'reac' )
+                # connect them up for reactions
+                moose.connect( reac0, 'sub', b0, 'reac' )
+                moose.connect( reac0, 'prd', b1, 'reac' )
+                moose.connect( reac1, 'sub', b1, 'reac' )
+                moose.connect( reac1, 'prd', b2, 'reac' )
 
-		# Assign parameters
-		reac0.Kf = 0.5
-		reac0.Kb = 0.05
-		reac1.Kf = 0.5
-		reac1.Kb = 0.05
+                # Assign parameters
+                reac0.Kf = 0.5
+                reac0.Kb = 0.05
+                reac1.Kf = 0.5
+                reac1.Kb = 0.05
 
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA0 = moose.Table2 ( '/model/graphs/concA0' )
-		outputA1 = moose.Table2 ( '/model/graphs/concA1' )
-		outputA2 = moose.Table2 ( '/model/graphs/concA2' )
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA0 = moose.Table2 ( '/model/graphs/concA0' )
+                outputA1 = moose.Table2 ( '/model/graphs/concA1' )
+                outputA2 = moose.Table2 ( '/model/graphs/concA2' )
 
-		# connect up the tables
-		moose.connect( outputA0, 'requestOut', a0, 'getConc' );
-		moose.connect( outputA1, 'requestOut', a1, 'getConc' );
-		moose.connect( outputA2, 'requestOut', a2, 'getConc' );
+                # connect up the tables
+                moose.connect( outputA0, 'requestOut', a0, 'getConc' );
+                moose.connect( outputA1, 'requestOut', a1, 'getConc' );
+                moose.connect( outputA2, 'requestOut', a2, 'getConc' );
 
                 # Build the solvers. No need for diffusion in this version.
                 ksolve0 = moose.Ksolve( '/model/compt0/ksolve0' )
@@ -143,10 +143,10 @@ def main():
     initTot = 0
     tot = 0
     for x in moose.wildcardFind( '/model/compt#/#[ISA=PoolBase]' ):
-        print(x.name, x.conc)
+        print((x.name, x.conc))
         tot += x.n
         initTot += x.nInit
-    print("Totals: expected = ", initTot, ", got: ", tot)
+    print(("Totals: expected = ", initTot, ", got: ", tot))
 
     # Iterate through all plots, dump their contents to data.plot.
     for x in moose.wildcardFind( '/model/graphs/conc#' ):
@@ -158,4 +158,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/reacDiffSpinyNeuron.py b/snippets/reacDiffSpinyNeuron.py
index 2edb86b9..067147f0 100644
--- a/snippets/reacDiffSpinyNeuron.py
+++ b/snippets/reacDiffSpinyNeuron.py
@@ -93,7 +93,7 @@ def makeModel():
     graphs = moose.Neutral( '/model/graphs' )
     moose.le( '/model/chem/compt1' )
     a = moose.element( '/model/chem/compt1' )
-    print a.voxelVolume
+    print((a.voxelVolume))
     makeTab( 'a_soma', '/model/chem/compt0/a[0]' )
     makeTab( 'b_soma', '/model/chem/compt0/b[0]' )
     makeTab( 'a_apical', '/model/chem/compt0/a[' + str( num ) + ']' )
@@ -135,40 +135,40 @@ def makeDisplay():
         plt.xlabel( 'time (seconds)' )
         plt.legend()
 
-	a = moose.vec( '/model/chem/compt0/a' )
-	b = moose.vec( '/model/chem/compt0/b' )
-        line1, = dend.plot( range( len( a ) ), a.conc, label='a' )
-        line2, = dend.plot( range( len( b ) ), b.conc, label='b' )
+        a = moose.vec( '/model/chem/compt0/a' )
+        b = moose.vec( '/model/chem/compt0/b' )
+        line1, = dend.plot( list(range( len( a ))), a.conc, label='a' )
+        line2, = dend.plot( list(range( len( b ))), b.conc, label='b' )
         dend.set_ylim( 0, 0.6 )
 
-	a = moose.vec( '/model/chem/compt1/a' )
-	b = moose.vec( '/model/chem/compt1/b' )
-        line3, = spine.plot( range( len( a ) ), a.conc, label='a' )
-        line4, = spine.plot( range( len( b ) ), b.conc, label='b' )
+        a = moose.vec( '/model/chem/compt1/a' )
+        b = moose.vec( '/model/chem/compt1/b' )
+        line3, = spine.plot( list(range( len( a ))), a.conc, label='a' )
+        line4, = spine.plot( list(range( len( b ))), b.conc, label='b' )
         spine.set_ylim( 0, 0.6 )
 
-	a = moose.vec( '/model/chem/compt2/a' )
-	b = moose.vec( '/model/chem/compt2/b' )
-        line5, = psd.plot( range( len( a ) ), a.conc, label='a' )
-        line6, = psd.plot( range( len( b ) ), b.conc, label='b' )
+        a = moose.vec( '/model/chem/compt2/a' )
+        b = moose.vec( '/model/chem/compt2/b' )
+        line5, = psd.plot( list(range( len( a ))), a.conc, label='a' )
+        line6, = psd.plot( list(range( len( b ))), b.conc, label='b' )
         psd.set_ylim( 0, 0.6 )
 
         fig.canvas.draw()
         return ( timeSeries, dend, spine, psd, fig, line1, line2, line3, line4, line5, line6, timeLabel )
 
 def updateDisplay( plotlist ):
-	a = moose.vec( '/model/chem/compt0/a' )
-	b = moose.vec( '/model/chem/compt0/b' )
+        a = moose.vec( '/model/chem/compt0/a' )
+        b = moose.vec( '/model/chem/compt0/b' )
         plotlist[5].set_ydata( a.conc )
         plotlist[6].set_ydata( b.conc )
 
-	a = moose.vec( '/model/chem/compt1/a' )
-	b = moose.vec( '/model/chem/compt1/b' )
+        a = moose.vec( '/model/chem/compt1/a' )
+        b = moose.vec( '/model/chem/compt1/b' )
         plotlist[7].set_ydata( a.conc )
         plotlist[8].set_ydata( b.conc )
 
-	a = moose.vec( '/model/chem/compt2/a' )
-	b = moose.vec( '/model/chem/compt2/b' )
+        a = moose.vec( '/model/chem/compt2/a' )
+        b = moose.vec( '/model/chem/compt2/b' )
         plotlist[9].set_ydata( a.conc )
         plotlist[10].set_ydata( b.conc )
         plotlist[4].canvas.draw()
@@ -180,7 +180,7 @@ def finalizeDisplay( plotlist, cPlotDt ):
         line1, = plotlist[0].plot( pos, x.vector, label=x.name )
     plotlist[4].canvas.draw()
     print( "Hit 'enter' to exit" )
-    raw_input()
+    eval(input())
 
 def makeChemModel( compt ):
     """
@@ -294,4 +294,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/recurrentIntFire.py b/snippets/recurrentIntFire.py
index 6a480cc4..1e291e1e 100644
--- a/snippets/recurrentIntFire.py
+++ b/snippets/recurrentIntFire.py
@@ -22,49 +22,49 @@ sys.path.append('/home/subha/src/moose_async13/python')
 import moose
 
 def make_network():
-	size = 1024
-	dt = 0.2
-	runsteps = 50
-	delayMin = 0
-	delayMax = 4
-	weightMax = 1
-	Vmax = 1.0
-	thresh = 0.4
-	refractoryPeriod = 0.4
+        size = 1024
+        dt = 0.2
+        runsteps = 50
+        delayMin = 0
+        delayMax = 4
+        weightMax = 1
+        Vmax = 1.0
+        thresh = 0.4
+        refractoryPeriod = 0.4
         tau = 0.5
-	connectionProbability = 0.01
-	random.seed( 123 )
-	nprand.seed( 456 )
-	t0 = time.time()
+        connectionProbability = 0.01
+        random.seed( 123 )
+        nprand.seed( 456 )
+        t0 = time.time()
 
-	network = moose.IntFire( 'network', size );
-	syns = moose.SimpleSynHandler( '/network/syns', size );
+        network = moose.IntFire( 'network', size );
+        syns = moose.SimpleSynHandler( '/network/syns', size );
         moose.connect( syns, 'activationOut', network, 'activation', 'OneToOne' )
-	moose.le( '/network' )
-	syns.vec.numSynapses = [1] * size
-	sv = moose.vec( '/network/syns/synapse' )
-	print 'before connect t = ', time.time() - t0
-	mid = moose.connect( network, 'spikeOut', sv, 'addSpike', 'Sparse')
-	print 'after connect t = ', time.time() - t0
-	#print mid.destFields
-	m2 = moose.element( mid )
-	m2.setRandomConnectivity( connectionProbability, 5489 )
-	print 'after setting connectivity, t = ', time.time() - t0
-	#network.vec.Vm = [(Vmax*random.random()) for r in range(size)]
-	network.vec.Vm = nprand.rand( size ) * Vmax
-	network.vec.thresh = thresh
-	network.vec.refractoryPeriod = refractoryPeriod
-	network.vec.tau = tau
-	numSynVec = syns.vec.numSynapses
-	print 'Middle of setup, t = ', time.time() - t0
-	numTotSyn = sum( numSynVec )
-        print numSynVec.size, ', tot = ', numTotSyn,  ', numSynVec = ', numSynVec
-	for item in syns.vec:
-		sh = moose.element( item )
+        moose.le( '/network' )
+        syns.vec.numSynapses = [1] * size
+        sv = moose.vec( '/network/syns/synapse' )
+        print(('before connect t = ', time.time() - t0))
+        mid = moose.connect( network, 'spikeOut', sv, 'addSpike', 'Sparse')
+        print(('after connect t = ', time.time() - t0))
+        #print mid.destFields
+        m2 = moose.element( mid )
+        m2.setRandomConnectivity( connectionProbability, 5489 )
+        print(('after setting connectivity, t = ', time.time() - t0))
+        #network.vec.Vm = [(Vmax*random.random()) for r in range(size)]
+        network.vec.Vm = nprand.rand( size ) * Vmax
+        network.vec.thresh = thresh
+        network.vec.refractoryPeriod = refractoryPeriod
+        network.vec.tau = tau
+        numSynVec = syns.vec.numSynapses
+        print(('Middle of setup, t = ', time.time() - t0))
+        numTotSyn = sum( numSynVec )
+        print((numSynVec.size, ', tot = ', numTotSyn,  ', numSynVec = ', numSynVec))
+        for item in syns.vec:
+                sh = moose.element( item )
                 sh.synapse.delay = delayMin +  (delayMax - delayMin ) * nprand.rand( len( sh.synapse ) )
-		#sh.synapse.delay = [ (delayMin + random.random() * (delayMax - delayMin ) for r in range( len( sh.synapse ) ) ] 
-		sh.synapse.weight = nprand.rand( len( sh.synapse ) ) * weightMax
-	print 'after setup, t = ', time.time() - t0
+                #sh.synapse.delay = [ (delayMin + random.random() * (delayMax - delayMin ) for r in range( len( sh.synapse ) ) ] 
+                sh.synapse.weight = nprand.rand( len( sh.synapse ) ) * weightMax
+        print(('after setup, t = ', time.time() - t0))
 
         numStats = 100
         stats = moose.SpikeStats( '/stats', numStats )
@@ -77,26 +77,26 @@ def make_network():
                 moose.connect( network.vec[k], 'spikeOut', stats.vec[i], 'addSpike' )
         moose.connect( plots, 'requestOut', stats, 'getMean', 'OneToOne' )
 
-	#moose.useClock( 0, '/network/syns,/network', 'process' )
-	moose.useClock( 0, '/network/syns', 'process' )
-	moose.useClock( 1, '/network', 'process' )
-	moose.useClock( 2, '/stats', 'process' )
-	moose.useClock( 3, '/plot', 'process' )
-	moose.setClock( 0, dt )
-	moose.setClock( 1, dt )
-	moose.setClock( 2, dt )
-	moose.setClock( 3, dt )
-	moose.setClock( 9, dt )
-	t1 = time.time()
-	moose.reinit()
-	print 'reinit time t = ', time.time() - t1
-	network.vec.Vm = nprand.rand( size ) * Vmax
-	print 'setting Vm , t = ', time.time() - t1
-	t1 = time.time()
-	print 'starting'
-	moose.start(runsteps * dt)
-	print 'runtime, t = ', time.time() - t1
-	print network.vec.Vm[99:103], network.vec.Vm[900:903]
+        #moose.useClock( 0, '/network/syns,/network', 'process' )
+        moose.useClock( 0, '/network/syns', 'process' )
+        moose.useClock( 1, '/network', 'process' )
+        moose.useClock( 2, '/stats', 'process' )
+        moose.useClock( 3, '/plot', 'process' )
+        moose.setClock( 0, dt )
+        moose.setClock( 1, dt )
+        moose.setClock( 2, dt )
+        moose.setClock( 3, dt )
+        moose.setClock( 9, dt )
+        t1 = time.time()
+        moose.reinit()
+        print(('reinit time t = ', time.time() - t1))
+        network.vec.Vm = nprand.rand( size ) * Vmax
+        print(('setting Vm , t = ', time.time() - t1))
+        t1 = time.time()
+        print('starting')
+        moose.start(runsteps * dt)
+        print(('runtime, t = ', time.time() - t1))
+        print((network.vec.Vm[99:103], network.vec.Vm[900:903]))
         t = [i * dt for i in range( plots.vec[0].vector.size )]
         i = 0
         for p in plots.vec:
diff --git a/snippets/recurrentLIF.py b/snippets/recurrentLIF.py
index 6f00fdfa..0bb5249f 100644
--- a/snippets/recurrentLIF.py
+++ b/snippets/recurrentLIF.py
@@ -22,50 +22,50 @@ sys.path.append('/home/subha/src/moose_async13/python')
 import moose
 
 def make_network():
-	size = 1024
-	dt = 0.2
-	runsteps = 50
-	delayMin = 0
-	delayMax = 4
-	weightMax = 1
-	Vmax = 1.0
-	thresh = 0.4
-	refractoryPeriod = 0.4
+        size = 1024
+        dt = 0.2
+        runsteps = 50
+        delayMin = 0
+        delayMax = 4
+        weightMax = 1
+        Vmax = 1.0
+        thresh = 0.4
+        refractoryPeriod = 0.4
         tau = 0.5
-	connectionProbability = 0.01
-	random.seed( 123 )
-	nprand.seed( 456 )
-	t0 = time.time()
+        connectionProbability = 0.01
+        random.seed( 123 )
+        nprand.seed( 456 )
+        t0 = time.time()
 
-	network = moose.LIF( 'network', size );
-	syns = moose.SimpleSynHandler( '/network/syns', size );
+        network = moose.LIF( 'network', size );
+        syns = moose.SimpleSynHandler( '/network/syns', size );
         moose.connect( syns, 'activationOut', network, 'activation', 'OneToOne' )
-	moose.le( '/network' )
-	syns.vec.numSynapses = [1] * size
-	sv = moose.vec( '/network/syns/synapse' )
-	print 'before connect t = ', time.time() - t0
-	mid = moose.connect( network, 'spikeOut', sv, 'addSpike', 'Sparse')
-	print 'after connect t = ', time.time() - t0
-	#print mid.destFields
-	m2 = moose.element( mid )
-	m2.setRandomConnectivity( connectionProbability, 5489 )
-	print 'after setting connectivity, t = ', time.time() - t0
-	#network.vec.Vm = [(Vmax*random.random()) for r in range(size)]
-	network.vec.Vm = nprand.rand( size ) * Vmax
-	network.vec.thresh = thresh
-	network.vec.refractoryPeriod = refractoryPeriod
-	network.vec.Rm = 1e10
-	network.vec.Cm = 5e-9
-	numSynVec = syns.vec.numSynapses
-	print 'Middle of setup, t = ', time.time() - t0
-	numTotSyn = sum( numSynVec )
-        print numSynVec.size, ', tot = ', numTotSyn,  ', numSynVec = ', numSynVec
-	for item in syns.vec:
-		sh = moose.element( item )
+        moose.le( '/network' )
+        syns.vec.numSynapses = [1] * size
+        sv = moose.vec( '/network/syns/synapse' )
+        print(('before connect t = ', time.time() - t0))
+        mid = moose.connect( network, 'spikeOut', sv, 'addSpike', 'Sparse')
+        print(('after connect t = ', time.time() - t0))
+        #print mid.destFields
+        m2 = moose.element( mid )
+        m2.setRandomConnectivity( connectionProbability, 5489 )
+        print(('after setting connectivity, t = ', time.time() - t0))
+        #network.vec.Vm = [(Vmax*random.random()) for r in range(size)]
+        network.vec.Vm = nprand.rand( size ) * Vmax
+        network.vec.thresh = thresh
+        network.vec.refractoryPeriod = refractoryPeriod
+        network.vec.Rm = 1e10
+        network.vec.Cm = 5e-9
+        numSynVec = syns.vec.numSynapses
+        print(('Middle of setup, t = ', time.time() - t0))
+        numTotSyn = sum( numSynVec )
+        print((numSynVec.size, ', tot = ', numTotSyn,  ', numSynVec = ', numSynVec))
+        for item in syns.vec:
+                sh = moose.element( item )
                 sh.synapse.delay = delayMin +  (delayMax - delayMin ) * nprand.rand( len( sh.synapse ) )
-		#sh.synapse.delay = [ (delayMin + random.random() * (delayMax - delayMin ) for r in range( len( sh.synapse ) ) ] 
-		sh.synapse.weight = nprand.rand( len( sh.synapse ) ) * weightMax
-	print 'after setup, t = ', time.time() - t0
+                #sh.synapse.delay = [ (delayMin + random.random() * (delayMax - delayMin ) for r in range( len( sh.synapse ) ) ] 
+                sh.synapse.weight = nprand.rand( len( sh.synapse ) ) * weightMax
+        print(('after setup, t = ', time.time() - t0))
 
         numStats = 100
         stats = moose.SpikeStats( '/stats', numStats )
@@ -78,26 +78,26 @@ def make_network():
                 moose.connect( network.vec[k], 'spikeOut', stats.vec[i], 'addSpike' )
         moose.connect( plots, 'requestOut', stats, 'getMean', 'OneToOne' )
 
-	#moose.useClock( 0, '/network/syns,/network', 'process' )
-	moose.useClock( 0, '/network/syns', 'process' )
-	moose.useClock( 1, '/network', 'process' )
-	moose.useClock( 2, '/stats', 'process' )
-	moose.useClock( 3, '/plot', 'process' )
-	moose.setClock( 0, dt )
-	moose.setClock( 1, dt )
-	moose.setClock( 2, dt )
-	moose.setClock( 3, dt )
-	moose.setClock( 9, dt )
-	t1 = time.time()
-	moose.reinit()
-	print 'reinit time t = ', time.time() - t1
-	network.vec.Vm = nprand.rand( size ) * Vmax
-	print 'setting Vm , t = ', time.time() - t1
-	t1 = time.time()
-	print 'starting'
-	moose.start(runsteps * dt)
-	print 'runtime, t = ', time.time() - t1
-	print network.vec.Vm[99:103], network.vec.Vm[900:903]
+        #moose.useClock( 0, '/network/syns,/network', 'process' )
+        moose.useClock( 0, '/network/syns', 'process' )
+        moose.useClock( 1, '/network', 'process' )
+        moose.useClock( 2, '/stats', 'process' )
+        moose.useClock( 3, '/plot', 'process' )
+        moose.setClock( 0, dt )
+        moose.setClock( 1, dt )
+        moose.setClock( 2, dt )
+        moose.setClock( 3, dt )
+        moose.setClock( 9, dt )
+        t1 = time.time()
+        moose.reinit()
+        print(('reinit time t = ', time.time() - t1))
+        network.vec.Vm = nprand.rand( size ) * Vmax
+        print(('setting Vm , t = ', time.time() - t1))
+        t1 = time.time()
+        print('starting')
+        moose.start(runsteps * dt)
+        print(('runtime, t = ', time.time() - t1))
+        print((network.vec.Vm[99:103], network.vec.Vm[900:903]))
         t = [i * dt for i in range( plots.vec[0].vector.size )]
         i = 0
         for p in plots.vec:
diff --git a/snippets/rxdFuncDiffusion.py b/snippets/rxdFuncDiffusion.py
index 142341dc..b3398367 100644
--- a/snippets/rxdFuncDiffusion.py
+++ b/snippets/rxdFuncDiffusion.py
@@ -1,9 +1,12 @@
+import sys
 import numpy
 import pylab
 import moose
 import time
 import sys
 
+print(('[DEBUG] Using moose from %s' % moose.__file__))
+
 '''
 This example implements a reaction-diffusion like system which is
 bistable and propagates losslessly. It is based on the NEURON example 
@@ -58,8 +61,9 @@ t1 = time.time()
 for t in range( 0, runtime-1, updateDt ):
     moose.start( updateDt )
     plt = pylab.plot( x, c.vec.n, label='t = '+str(t + updateDt) )
+print(("Time = %f " % (time.time() - t1)))
 
-print("Time = %s " % ( time.time() - t1) )
+print(("Time = %s " % ( time.time() - t1) ))
 pylab.ylim( 0, 1.05 )
 pylab.legend()
 pylab.show( )
diff --git a/snippets/rxdFuncDiffusionStoch.py b/snippets/rxdFuncDiffusionStoch.py
index 64883f0c..7b289475 100644
--- a/snippets/rxdFuncDiffusionStoch.py
+++ b/snippets/rxdFuncDiffusionStoch.py
@@ -55,7 +55,7 @@ c.vec.nInit = [ 100 for q in x ]
 
 # Run and plot it.
 moose.reinit()
-print dir(compt)
+print((dir(compt)))
 updateDt = 50
 runtime = updateDt * 4
 plt = pylab.plot( x, c.vec.n, label='t = 0 ')
@@ -63,7 +63,7 @@ t1 = time.time()
 for t in range( 0, runtime-1, updateDt ):
     moose.start( updateDt )
     plt = pylab.plot( x, c.vec.n, label='t = '+str(t + updateDt) )
-print "Time = ", time.time() - t1
+print(("Time = ", time.time() - t1))
 
 pylab.ylim( 0, 105 )
 pylab.legend()
diff --git a/snippets/rxdReacDiffusion.py b/snippets/rxdReacDiffusion.py
index b6b1adaf..d462b768 100644
--- a/snippets/rxdReacDiffusion.py
+++ b/snippets/rxdReacDiffusion.py
@@ -71,7 +71,7 @@ t1 = time.time()
 for t in range( 0, runtime-1, updateDt ):
     moose.start( updateDt )
     plt = pylab.plot( x, c.vec.n, label='t = '+str(t + updateDt) )
-print "Time = ", time.time() - t1
+print(("Time = ", time.time() - t1))
 
 pylab.ylim( 0, 1.05 )
 pylab.legend()
diff --git a/snippets/rxdSpineSize.py b/snippets/rxdSpineSize.py
index 1d071aba..544adc56 100644
--- a/snippets/rxdSpineSize.py
+++ b/snippets/rxdSpineSize.py
@@ -54,7 +54,7 @@ def makeChemProto( name ):
     chem = moose.Neutral( '/library/' + name )
     comptVol = diffLen * dendDia * dendDia * PI / 4.0
     for i in ( ['dend', comptVol], ['spine', 1e-19], ['psd', 1e-20] ):
-        print 'making ', i
+        print(('making ', i))
         compt = moose.CubeMesh( chem.path + '/' + i[0] )
         compt.volume = i[1]
         #x = moose.Pool( compt.path + '/x' )
@@ -72,7 +72,7 @@ def makeChemProto( name ):
     x.diffConst = diffConst
     func = moose.Function( x.path + '/func' )
     func.expr = "-x0 * (0.3 - " + nstr + " * x0) * ( 1 - " + nstr + " * x0)"
-    print func.expr
+    print((func.expr))
     func.x.num = 1
     moose.connect( x, 'nOut', func.x[0], 'input' )
     moose.connect( func, 'valueOut', x, 'increment' )
@@ -264,9 +264,9 @@ def create_viewer(path, moose_dendrite, dendZ, diaTab, psdZ):
             view.stop()
 
     viewer = moogli.Viewer("Viewer")
-    viewer.attach_shapes(network.shapes.values())
+    viewer.attach_shapes(list(network.shapes.values()))
     viewer.detach_shape(dendrite)
-    viewer.attach_shapes(chem_compt_group.shapes.values())
+    viewer.attach_shapes(list(chem_compt_group.shapes.values()))
 
     view = moogli.View("main-view",
                        prelude=prelude,
diff --git a/snippets/savemodel.py b/snippets/savemodel.py
index bf29b914..3c296bba 100644
--- a/snippets/savemodel.py
+++ b/snippets/savemodel.py
@@ -49,13 +49,20 @@ into Moose using "loadModel" function and using "saveModel" function one can
 save the model back to Genesis format
 """
 
+import os
 import sys
-#sys.path.append('../../python')
 import moose
 from moose.genesis import *
 
+cwd = os.path.dirname( os.path.realpath( __file__ ) )
+
 if __name__ == '__main__':
-    """ The script demonstates to convert Chemical (Genesis) file back to Genesis file using moose """
-    model = moose.loadModel('../genesis/reaction.g', '/model')
-    written = write('/model', 'testsave.g')
-    print written
+    """ 
+    The script demonstates to convert Chemical (Genesis) file back to Genesis 
+    file using moose 
+    """
+    model = moose.loadModel( 
+            os.path.join( cwd, '../genesis/reaction.g' ), '/model'
+            )
+    written = mooseWriteKkit('/model', 'testsave.g')
+    print( written )
diff --git a/snippets/scaleVolumes.py b/snippets/scaleVolumes.py
index 6a69da65..5591d205 100644
--- a/snippets/scaleVolumes.py
+++ b/snippets/scaleVolumes.py
@@ -13,74 +13,74 @@ import numpy
 import moose
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compartment = moose.CubeMesh( '/model/compartment' )
-		compartment.volume = 1e-20
-		# the mesh is created automatically by the compartment
-		mesh = moose.element( '/model/compartment/mesh' ) 
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		c = moose.Pool( '/model/compartment/c' )
-		enz1 = moose.Enz( '/model/compartment/b/enz1' )
-		enz2 = moose.Enz( '/model/compartment/c/enz2' )
-		cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
-		cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
-		reac = moose.Reac( '/model/compartment/reac' )
-
-		# connect them up for reactions
-		moose.connect( enz1, 'sub', a, 'reac' )
-		moose.connect( enz1, 'prd', b, 'reac' )
-		moose.connect( enz1, 'enz', b, 'reac' )
-		moose.connect( enz1, 'cplx', cplx1, 'reac' )
-
-		moose.connect( enz2, 'sub', b, 'reac' )
-		moose.connect( enz2, 'prd', a, 'reac' )
-		moose.connect( enz2, 'enz', c, 'reac' )
-		moose.connect( enz2, 'cplx', cplx2, 'reac' )
-
-		moose.connect( reac, 'sub', a, 'reac' )
-		moose.connect( reac, 'prd', b, 'reac' )
-
-		# connect them up to the compartment for volumes
-		#for x in ( a, b, c, cplx1, cplx2 ):
-		#			moose.connect( x, 'mesh', mesh, 'mesh' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 0
-		c.concInit = 0.01
-		enz1.kcat = 0.4
-		enz1.Km = 4
-		enz2.kcat = 0.6
-		enz2.Km = 0.01
-		reac.Kf = 0.001
-		reac.Kb = 0.01
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2( '/model/graphs/concA' )
-		outputB = moose.Table2( '/model/graphs/concB' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compartment = moose.CubeMesh( '/model/compartment' )
+                compartment.volume = 1e-20
+                # the mesh is created automatically by the compartment
+                mesh = moose.element( '/model/compartment/mesh' ) 
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compartment/a' )
+                b = moose.Pool( '/model/compartment/b' )
+                c = moose.Pool( '/model/compartment/c' )
+                enz1 = moose.Enz( '/model/compartment/b/enz1' )
+                enz2 = moose.Enz( '/model/compartment/c/enz2' )
+                cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
+                cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
+                reac = moose.Reac( '/model/compartment/reac' )
+
+                # connect them up for reactions
+                moose.connect( enz1, 'sub', a, 'reac' )
+                moose.connect( enz1, 'prd', b, 'reac' )
+                moose.connect( enz1, 'enz', b, 'reac' )
+                moose.connect( enz1, 'cplx', cplx1, 'reac' )
+
+                moose.connect( enz2, 'sub', b, 'reac' )
+                moose.connect( enz2, 'prd', a, 'reac' )
+                moose.connect( enz2, 'enz', c, 'reac' )
+                moose.connect( enz2, 'cplx', cplx2, 'reac' )
+
+                moose.connect( reac, 'sub', a, 'reac' )
+                moose.connect( reac, 'prd', b, 'reac' )
+
+                # connect them up to the compartment for volumes
+                #for x in ( a, b, c, cplx1, cplx2 ):
+                #                        moose.connect( x, 'mesh', mesh, 'mesh' )
+
+                # Assign parameters
+                a.concInit = 1
+                b.concInit = 0
+                c.concInit = 0.01
+                enz1.kcat = 0.4
+                enz1.Km = 4
+                enz2.kcat = 0.6
+                enz2.Km = 0.01
+                reac.Kf = 0.001
+                reac.Kb = 0.01
+
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2( '/model/graphs/concA' )
+                outputB = moose.Table2( '/model/graphs/concB' )
+
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getConc' );
+                moose.connect( outputB, 'requestOut', b, 'getConc' );
 
                 '''
-		# Schedule the whole lot
-		moose.setClock( 4, 0.01 ) # for the computational objects
-		moose.setClock( 8, 1.0 ) # for the plots
-		# The wildcard uses # for single level, and ## for recursive.
-		moose.useClock( 4, '/model/compartment/##', 'process' )
-		moose.useClock( 8, '/model/graphs/#', 'process' )
+                # Schedule the whole lot
+                moose.setClock( 4, 0.01 ) # for the computational objects
+                moose.setClock( 8, 1.0 ) # for the plots
+                # The wildcard uses # for single level, and ## for recursive.
+                moose.useClock( 4, '/model/compartment/##', 'process' )
+                moose.useClock( 8, '/model/graphs/#', 'process' )
                 '''
 
 def displayPlots():
-		for x in moose.wildcardFind( '/model/graphs/conc#' ):
-				t = numpy.arange( 0, x.vector.size, 1 ) #sec
-				pylab.plot( t, x.vector, label=x.name )
+                for x in moose.wildcardFind( '/model/graphs/conc#' ):
+                                t = numpy.arange( 0, x.vector.size, 1 ) #sec
+                                pylab.plot( t, x.vector, label=x.name )
 
 def main():
 
@@ -128,7 +128,7 @@ def main():
     for vol in ( 1e-19, 1e-20, 1e-21, 3e-22, 1e-22, 3e-23, 1e-23 ):
         # Set the volume
         compt.volume = vol
-        print 'vol = ', vol, ', a.concInit = ', a.concInit, ', a.nInit = ', a.nInit
+        print(('vol = ', vol, ', a.concInit = ', a.concInit, ', a.nInit = ', a.nInit))
 
         moose.reinit()
         moose.start( 100.0 ) # Run the model for 100 seconds.
@@ -149,11 +149,11 @@ def main():
         # Iterate through all plots, dump their contents to data.plot.
         displayPlots()
         pylab.show( block=False )
-        print 'vol = ', vol, 'hit enter to go to next plot'
-        raw_input()
+        print(('vol = ', vol, 'hit enter to go to next plot'))
+        eval(input())
 
     quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/scriptGssaSolver.py b/snippets/scriptGssaSolver.py
index 94f10aed..0bf5c4c0 100644
--- a/snippets/scriptGssaSolver.py
+++ b/snippets/scriptGssaSolver.py
@@ -21,103 +21,103 @@ import numpy
 import moose
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compartment = moose.CubeMesh( '/model/compartment' )
-		compartment.volume = 1e-20
-		# the mesh is created automatically by the compartment
-		mesh = moose.element( '/model/compartment/mesh' ) 
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		c = moose.Pool( '/model/compartment/c' )
-		enz1 = moose.Enz( '/model/compartment/b/enz1' )
-		enz2 = moose.Enz( '/model/compartment/c/enz2' )
-		cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
-		cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
-		reac = moose.Reac( '/model/compartment/reac' )
-
-		# connect them up for reactions
-		moose.connect( enz1, 'sub', a, 'reac' )
-		moose.connect( enz1, 'prd', b, 'reac' )
-		moose.connect( enz1, 'enz', b, 'reac' )
-		moose.connect( enz1, 'cplx', cplx1, 'reac' )
-
-		moose.connect( enz2, 'sub', b, 'reac' )
-		moose.connect( enz2, 'prd', a, 'reac' )
-		moose.connect( enz2, 'enz', c, 'reac' )
-		moose.connect( enz2, 'cplx', cplx2, 'reac' )
-
-		moose.connect( reac, 'sub', a, 'reac' )
-		moose.connect( reac, 'prd', b, 'reac' )
-
-		# connect them up to the compartment for volumes
-		#for x in ( a, b, c, cplx1, cplx2 ):
-		#			moose.connect( x, 'mesh', mesh, 'mesh' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 0
-		c.concInit = 0.01
-		enz1.kcat = 0.4
-		enz1.Km = 4
-		enz2.kcat = 0.6
-		enz2.Km = 0.01
-		reac.Kf = 0.001
-		reac.Kb = 0.01
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/concA' )
-		outputB = moose.Table2 ( '/model/graphs/concB' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compartment = moose.CubeMesh( '/model/compartment' )
+                compartment.volume = 1e-20
+                # the mesh is created automatically by the compartment
+                mesh = moose.element( '/model/compartment/mesh' ) 
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compartment/a' )
+                b = moose.Pool( '/model/compartment/b' )
+                c = moose.Pool( '/model/compartment/c' )
+                enz1 = moose.Enz( '/model/compartment/b/enz1' )
+                enz2 = moose.Enz( '/model/compartment/c/enz2' )
+                cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
+                cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
+                reac = moose.Reac( '/model/compartment/reac' )
+
+                # connect them up for reactions
+                moose.connect( enz1, 'sub', a, 'reac' )
+                moose.connect( enz1, 'prd', b, 'reac' )
+                moose.connect( enz1, 'enz', b, 'reac' )
+                moose.connect( enz1, 'cplx', cplx1, 'reac' )
+
+                moose.connect( enz2, 'sub', b, 'reac' )
+                moose.connect( enz2, 'prd', a, 'reac' )
+                moose.connect( enz2, 'enz', c, 'reac' )
+                moose.connect( enz2, 'cplx', cplx2, 'reac' )
+
+                moose.connect( reac, 'sub', a, 'reac' )
+                moose.connect( reac, 'prd', b, 'reac' )
+
+                # connect them up to the compartment for volumes
+                #for x in ( a, b, c, cplx1, cplx2 ):
+                #                        moose.connect( x, 'mesh', mesh, 'mesh' )
+
+                # Assign parameters
+                a.concInit = 1
+                b.concInit = 0
+                c.concInit = 0.01
+                enz1.kcat = 0.4
+                enz1.Km = 4
+                enz2.kcat = 0.6
+                enz2.Km = 0.01
+                reac.Kf = 0.001
+                reac.Kb = 0.01
+
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2 ( '/model/graphs/concA' )
+                outputB = moose.Table2 ( '/model/graphs/concB' )
+
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getConc' );
+                moose.connect( outputB, 'requestOut', b, 'getConc' );
 
 
 def displayPlots():
-		for x in moose.wildcardFind( '/model/graphs/conc#' ):
-				t = numpy.arange( 0, x.vector.size, 1 ) #sec
-				pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
+                for x in moose.wildcardFind( '/model/graphs/conc#' ):
+                                t = numpy.arange( 0, x.vector.size, 1 ) #sec
+                                pylab.plot( t, x.vector, label=x.name )
+                pylab.legend()
+                pylab.show()
 
 def main():
-		makeModel()
-		gsolve = moose.Gsolve( '/model/compartment/gsolve' )
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = moose.element( '/model/compartment' )
-		stoich.ksolve = gsolve
-		stoich.path = "/model/compartment/##"
-		#solver.method = "rk5"
-		#mesh = moose.element( "/model/compartment/mesh" )
-		#moose.connect( mesh, "remesh", solver, "remesh" )
-		moose.setClock( 5, 1.0 ) # clock for the solver
-		moose.useClock( 5, '/model/compartment/gsolve', 'process' )
-
-		moose.reinit()
-		moose.start( 100.0 ) # Run the model for 100 seconds.
-
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
-
-		# move most molecules over to bgsolve
-		b.conc = b.conc + a.conc * 0.9
-		a.conc = a.conc * 0.1
-		moose.start( 100.0 ) # Run the model for 100 seconds.
-
-		# move most molecules back to a
-		a.conc = a.conc + b.conc * 0.99
-		b.conc = b.conc * 0.01
-		moose.start( 100.0 ) # Run the model for 100 seconds.
-
-		# Iterate through all plots, dump their contents to data.plot.
-		displayPlots()
-
-		quit()
+                makeModel()
+                gsolve = moose.Gsolve( '/model/compartment/gsolve' )
+                stoich = moose.Stoich( '/model/compartment/stoich' )
+                stoich.compartment = moose.element( '/model/compartment' )
+                stoich.ksolve = gsolve
+                stoich.path = "/model/compartment/##"
+                #solver.method = "rk5"
+                #mesh = moose.element( "/model/compartment/mesh" )
+                #moose.connect( mesh, "remesh", solver, "remesh" )
+                moose.setClock( 5, 1.0 ) # clock for the solver
+                moose.useClock( 5, '/model/compartment/gsolve', 'process' )
+
+                moose.reinit()
+                moose.start( 100.0 ) # Run the model for 100 seconds.
+
+                a = moose.element( '/model/compartment/a' )
+                b = moose.element( '/model/compartment/b' )
+
+                # move most molecules over to bgsolve
+                b.conc = b.conc + a.conc * 0.9
+                a.conc = a.conc * 0.1
+                moose.start( 100.0 ) # Run the model for 100 seconds.
+
+                # move most molecules back to a
+                a.conc = a.conc + b.conc * 0.99
+                b.conc = b.conc * 0.01
+                moose.start( 100.0 ) # Run the model for 100 seconds.
+
+                # Iterate through all plots, dump their contents to data.plot.
+                displayPlots()
+
+                quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/scriptKineticModel.py b/snippets/scriptKineticModel.py
index 453e446f..39202715 100644
--- a/snippets/scriptKineticModel.py
+++ b/snippets/scriptKineticModel.py
@@ -6,115 +6,112 @@
 ## GNU Lesser General Public License version 2.1
 ## See the file COPYING.LIB for the full notice.
 #########################################################################
-
-"""
-This example illustrates how to define a kinetic model using the
-scripting interface. Normally one uses standard model formats like
-SBML or kkit to concisely define kinetic models, but in some cases one
-would like to modify the model through the script.
-This example creates a bistable model having two enzymes and a reaction.
-One of the enzymes is autocatalytic.
-The model is set up to run using default Exponential Euler integration.
-The snippet scriptKineticSolver.py uses the much better GSL 
-Runge-Kutta-Fehlberg integration scheme on this same model.
-"""
-
 import math
 import pylab
 import numpy
 import moose
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compartment = moose.CubeMesh( '/model/compartment' )
-		compartment.volume = 1e-15
-		# the mesh is created automatically by the compartment
-		moose.le( '/model/compartment' )
-		mesh = moose.element( '/model/compartment/mesh' ) 
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		c = moose.Pool( '/model/compartment/c' )
-		enz1 = moose.Enz( '/model/compartment/b/enz1' )
-		enz2 = moose.Enz( '/model/compartment/c/enz2' )
-		cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
-		cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
-		reac = moose.Reac( '/model/compartment/reac' )
-
-		# connect them up for reactions
-		moose.connect( enz1, 'sub', a, 'reac' )
-		moose.connect( enz1, 'prd', b, 'reac' )
-		moose.connect( enz1, 'enz', b, 'reac' )
-		moose.connect( enz1, 'cplx', cplx1, 'reac' )
-
-		moose.connect( enz2, 'sub', b, 'reac' )
-		moose.connect( enz2, 'prd', a, 'reac' )
-		moose.connect( enz2, 'enz', c, 'reac' )
-		moose.connect( enz2, 'cplx', cplx2, 'reac' )
-
-		moose.connect( reac, 'sub', a, 'reac' )
-		moose.connect( reac, 'prd', b, 'reac' )
-
-		# connect them up to the compartment for volumes
-		#for x in ( a, b, c, cplx1, cplx2 ):
-		#			moose.connect( x, 'mesh', mesh, 'mesh' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 0
-		c.concInit = 0.01
-		enz1.kcat = 0.4
-		enz1.Km = 4
-		enz2.kcat = 0.6
-		enz2.Km = 0.01
-		reac.Kf = 0.001
-		reac.Kb = 0.01
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/concA' )
-		outputB = moose.Table2 ( '/model/graphs/concB' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
-
-		# We need a finer timestep than the default 0.1 seconds, 
-                # in order to get numerical accuracy.
-                for i in range (11, 15 ):
-		    moose.setClock( i, 0.001 ) # for computational objects
+    # create container for model
+    model = moose.Neutral( 'model' )
+    compartment = moose.CubeMesh( '/model/compartment' )
+    compartment.volume = 1e-15
+    # the mesh is created automatically by the compartment
+    moose.le( '/model/compartment' )
+    mesh = moose.element( '/model/compartment/mesh' ) 
+
+    # create molecules and reactions
+    a = moose.Pool( '/model/compartment/a' )
+    b = moose.Pool( '/model/compartment/b' )
+    c = moose.Pool( '/model/compartment/c' )
+    enz1 = moose.Enz( '/model/compartment/b/enz1' )
+    enz2 = moose.Enz( '/model/compartment/c/enz2' )
+    cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
+    cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
+    reac = moose.Reac( '/model/compartment/reac' )
+
+    # connect them up for reactions
+    moose.connect( enz1, 'sub', a, 'reac' )
+    moose.connect( enz1, 'prd', b, 'reac' )
+    moose.connect( enz1, 'enz', b, 'reac' )
+    moose.connect( enz1, 'cplx', cplx1, 'reac' )
+
+    moose.connect( enz2, 'sub', b, 'reac' )
+    moose.connect( enz2, 'prd', a, 'reac' )
+    moose.connect( enz2, 'enz', c, 'reac' )
+    moose.connect( enz2, 'cplx', cplx2, 'reac' )
+
+    moose.connect( reac, 'sub', a, 'reac' )
+    moose.connect( reac, 'prd', b, 'reac' )
+
+    # connect them up to the compartment for volumes
+    #for x in ( a, b, c, cplx1, cplx2 ):
+    #                        moose.connect( x, 'mesh', mesh, 'mesh' )
+
+    # Assign parameters
+    a.concInit = 1
+    b.concInit = 0
+    c.concInit = 0.01
+    enz1.kcat = 0.4
+    enz1.Km = 4
+    enz2.kcat = 0.6
+    enz2.Km = 0.01
+    reac.Kf = 0.001
+    reac.Kb = 0.01
+
+    # Create the output tables
+    graphs = moose.Neutral( '/model/graphs' )
+    outputA = moose.Table2 ( '/model/graphs/concA' )
+    outputB = moose.Table2 ( '/model/graphs/concB' )
+
+    # connect up the tables
+    moose.connect( outputA, 'requestOut', a, 'getConc' );
+    moose.connect( outputB, 'requestOut', b, 'getConc' );
+
+    # We need a finer timestep than the default 0.1 seconds, 
+    # in order to get numerical accuracy.
+    for i in range (11, 15 ):
+        moose.setClock( i, 0.001 ) # for computational objects
 
 def main():
-		makeModel()
-
-		moose.reinit()
-		moose.start( 100.0 ) # Run the model for 100 seconds.
-
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
-
-		# move most molecules over to b
-		b.conc = b.conc + a.conc * 0.9
-		a.conc = a.conc * 0.1
-		moose.start( 100.0 ) # Run the model for 100 seconds.
-
-		# move most molecules back to a
-		a.conc = a.conc + b.conc * 0.99
-		b.conc = b.conc * 0.01
-		moose.start( 100.0 ) # Run the model for 100 seconds.
-
-		# Iterate through all plots, dump their contents to data.plot.
-		for x in moose.wildcardFind( '/model/graphs/conc#' ):
-				#x.xplot( 'scriptKineticModel.plot', x.name )
-				t = numpy.arange( 0, x.vector.size, 1 ) # sec
-				pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
-
-		quit()
+    """
+    This example illustrates how to define a kinetic model using the
+    scripting interface. Normally one uses standard model formats like
+    SBML or kkit to concisely define kinetic models, but in some cases one
+    would like to modify the model through the script.
+    This example creates a bistable model having two enzymes and a reaction.
+    One of the enzymes is autocatalytic.
+    The model is set up to run using default Exponential Euler integration.
+    The snippet scriptKineticSolver.py uses the much better GSL 
+    Runge-Kutta-Fehlberg integration scheme on this same model.
+    """
+    makeModel()
+    moose.reinit()
+    moose.start( 100.0 ) # Run the model for 100 seconds.
+
+    a = moose.element( '/model/compartment/a' )
+    b = moose.element( '/model/compartment/b' )
+
+    # move most molecules over to b
+    b.conc = b.conc + a.conc * 0.9
+    a.conc = a.conc * 0.1
+    moose.start( 100.0 ) # Run the model for 100 seconds.
+
+    # move most molecules back to a
+    a.conc = a.conc + b.conc * 0.99
+    b.conc = b.conc * 0.01
+    moose.start( 100.0 ) # Run the model for 100 seconds.
+
+    # Iterate through all plots, dump their contents to data.plot.
+    for x in moose.wildcardFind( '/model/graphs/conc#' ):
+                    #x.xplot( 'scriptKineticModel.plot', x.name )
+                    t = numpy.arange( 0, x.vector.size, 1 ) # sec
+                    pylab.plot( t, x.vector, label=x.name )
+    pylab.legend()
+    pylab.show()
+
+    quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/scriptKineticSolver.py b/snippets/scriptKineticSolver.py
index 977a099f..3660afea 100644
--- a/snippets/scriptKineticSolver.py
+++ b/snippets/scriptKineticSolver.py
@@ -21,104 +21,104 @@ import numpy
 import moose
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compartment = moose.CubeMesh( '/model/compartment' )
-		compartment.volume = 1e-15
-		# the mesh is created automatically by the compartment
-		mesh = moose.element( '/model/compartment/mesh' ) 
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		c = moose.Pool( '/model/compartment/c' )
-		enz1 = moose.Enz( '/model/compartment/b/enz1' )
-		enz2 = moose.Enz( '/model/compartment/c/enz2' )
-		cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
-		cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
-		reac = moose.Reac( '/model/compartment/reac' )
-
-		# connect them up for reactions
-		moose.connect( enz1, 'sub', a, 'reac' )
-		moose.connect( enz1, 'prd', b, 'reac' )
-		moose.connect( enz1, 'enz', b, 'reac' )
-		moose.connect( enz1, 'cplx', cplx1, 'reac' )
-
-		moose.connect( enz2, 'sub', b, 'reac' )
-		moose.connect( enz2, 'prd', a, 'reac' )
-		moose.connect( enz2, 'enz', c, 'reac' )
-		moose.connect( enz2, 'cplx', cplx2, 'reac' )
-
-		moose.connect( reac, 'sub', a, 'reac' )
-		moose.connect( reac, 'prd', b, 'reac' )
-
-		# connect them up to the compartment for volumes
-		#for x in ( a, b, c, cplx1, cplx2 ):
-		#			moose.connect( x, 'mesh', mesh, 'mesh' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 0
-		c.concInit = 0.01
-		enz1.kcat = 0.4
-		enz1.Km = 4
-		enz2.kcat = 0.6
-		enz2.Km = 0.01
-		reac.Kf = 0.001
-		reac.Kb = 0.01
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table2 ( '/model/graphs/concA' )
-		outputB = moose.Table2 ( '/model/graphs/concB' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compartment = moose.CubeMesh( '/model/compartment' )
+                compartment.volume = 1e-15
+                # the mesh is created automatically by the compartment
+                mesh = moose.element( '/model/compartment/mesh' ) 
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compartment/a' )
+                b = moose.Pool( '/model/compartment/b' )
+                c = moose.Pool( '/model/compartment/c' )
+                enz1 = moose.Enz( '/model/compartment/b/enz1' )
+                enz2 = moose.Enz( '/model/compartment/c/enz2' )
+                cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
+                cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
+                reac = moose.Reac( '/model/compartment/reac' )
+
+                # connect them up for reactions
+                moose.connect( enz1, 'sub', a, 'reac' )
+                moose.connect( enz1, 'prd', b, 'reac' )
+                moose.connect( enz1, 'enz', b, 'reac' )
+                moose.connect( enz1, 'cplx', cplx1, 'reac' )
+
+                moose.connect( enz2, 'sub', b, 'reac' )
+                moose.connect( enz2, 'prd', a, 'reac' )
+                moose.connect( enz2, 'enz', c, 'reac' )
+                moose.connect( enz2, 'cplx', cplx2, 'reac' )
+
+                moose.connect( reac, 'sub', a, 'reac' )
+                moose.connect( reac, 'prd', b, 'reac' )
+
+                # connect them up to the compartment for volumes
+                #for x in ( a, b, c, cplx1, cplx2 ):
+                #                        moose.connect( x, 'mesh', mesh, 'mesh' )
+
+                # Assign parameters
+                a.concInit = 1
+                b.concInit = 0
+                c.concInit = 0.01
+                enz1.kcat = 0.4
+                enz1.Km = 4
+                enz2.kcat = 0.6
+                enz2.Km = 0.01
+                reac.Kf = 0.001
+                reac.Kb = 0.01
+
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table2 ( '/model/graphs/concA' )
+                outputB = moose.Table2 ( '/model/graphs/concB' )
+
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getConc' );
+                moose.connect( outputB, 'requestOut', b, 'getConc' );
 
 def displayPlots():
-		for x in moose.wildcardFind( '/model/graphs/conc#' ):
-				t = numpy.arange( 0, x.vector.size, 1 ) #sec
-				pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
+                for x in moose.wildcardFind( '/model/graphs/conc#' ):
+                                t = numpy.arange( 0, x.vector.size, 1 ) #sec
+                                pylab.plot( t, x.vector, label=x.name )
+                pylab.legend()
+                pylab.show()
 
 def main():
-		makeModel()
-		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = moose.element( '/model/compartment' )
-		stoich.ksolve = ksolve
-		stoich.path = "/model/compartment/##"
-		#solver.method = "rk5"
-		#mesh = moose.element( "/model/compartment/mesh" )
-		#moose.connect( mesh, "remesh", solver, "remesh" )
+                makeModel()
+                ksolve = moose.Ksolve( '/model/compartment/ksolve' )
+                stoich = moose.Stoich( '/model/compartment/stoich' )
+                stoich.compartment = moose.element( '/model/compartment' )
+                stoich.ksolve = ksolve
+                stoich.path = "/model/compartment/##"
+                #solver.method = "rk5"
+                #mesh = moose.element( "/model/compartment/mesh" )
+                #moose.connect( mesh, "remesh", solver, "remesh" )
                 '''
-		moose.setClock( 5, 1.0 ) # clock for the solver
-		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
+                moose.setClock( 5, 1.0 ) # clock for the solver
+                moose.useClock( 5, '/model/compartment/ksolve', 'process' )
                 '''
 
-		moose.reinit()
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                moose.reinit()
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
+                a = moose.element( '/model/compartment/a' )
+                b = moose.element( '/model/compartment/b' )
 
-		# move most molecules over to b
-		b.conc = b.conc + a.conc * 0.9
-		a.conc = a.conc * 0.1
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                # move most molecules over to b
+                b.conc = b.conc + a.conc * 0.9
+                a.conc = a.conc * 0.1
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# move most molecules back to a
-		a.conc = a.conc + b.conc * 0.99
-		b.conc = b.conc * 0.01
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                # move most molecules back to a
+                a.conc = a.conc + b.conc * 0.99
+                b.conc = b.conc * 0.01
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# Iterate through all plots, dump their contents to data.plot.
-		displayPlots()
+                # Iterate through all plots, dump their contents to data.plot.
+                displayPlots()
 
-		quit()
+                quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/showclocks.py b/snippets/showclocks.py
index 3ebb3f7c..1bcd23ee 100644
--- a/snippets/showclocks.py
+++ b/snippets/showclocks.py
@@ -35,37 +35,37 @@ moose.useClock(0, '/##[ISA=Compartment]', 'init')
 moose.useClock(1, '/##[ISA=Compartment]', 'process')
 
 # List the ticks connected to an element.
-print 'Ticks connected to `process` method of', comp.path
+print(('Ticks connected to `process` method of', comp.path))
 for tick in comp.neighbors['process']:
-    print ' ->',tick.path
+    print((' ->',tick.path))
 
 # Different ticks can be connected to different fields.
-print 'Ticks connected to `init` method of', comp.path
+print(('Ticks connected to `init` method of', comp.path))
 for tick in comp.neighbors['init']:
-    print ' ->',tick.path
+    print((' ->',tick.path))
 
 # View the scheduled elements using the tick nos.
 t = moose.element('/clock')
-print 'Elements on tick 0'
+print('Elements on tick 0')
 for e in t.neighbors['proc0']:
-    print ' ->', e.path
-print 'Elements on tick 1'
+    print((' ->', e.path))
+print('Elements on tick 1')
 for e in t.neighbors['proc1']:
-    print ' ->', e.path    
+    print((' ->', e.path))    
 
 ch = moose.HHChannel('/comp/chan')
 moose.useClock(1, ch.path, 'process')
-print ch.path, 'has been scheduled'
-print 'Elements on tick 1'
+print((ch.path, 'has been scheduled'))
+print('Elements on tick 1')
 for e in t.neighbors['proc1']:
-    print ' ->', e.path
+    print((' ->', e.path))
 
 # Go through elements by wildcard search and list the ticks connected.
 # This can be slow when the model is too big.
 for el in moose.wildcardFind('/##[ISA=Compartment]'):
-    print 'Ticks connected to `process` method of', el.path
+    print(('Ticks connected to `process` method of', el.path))
     for t in moose.element(el).neighbors['process']:
-        print ' ->', t.path
+        print((' ->', t.path))
 
 # <codecell>
 
diff --git a/snippets/showmsg.py b/snippets/showmsg.py
index 98b9677a..f981956a 100644
--- a/snippets/showmsg.py
+++ b/snippets/showmsg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 """This is to show a _raw_ way of traversing messages."""
 import sys
 sys.path.append('../../python')
@@ -14,9 +14,9 @@ mid = moose.connect(net, 'spikeOut', synapse, 'addSpike', 'Sparse') # This creat
 msg = moose.element(mid)
 msg.setRandomConnectivity(connectionProbability, 5)
 for n in net.vec:
-    print 'Messages from %s.spikeOut' % (n.path)
+    print(('Messages from %s.spikeOut' % (n.path)))
     node = moose.element(n)
     for dest, df in zip(node.msgDests['spikeOut'], node.msgDestFunctions['spikeOut']):
-        print '\t--> %s.%s' % (dest.path, df)
+        print(('\t--> %s.%s' % (dest.path, df)))
 
 
diff --git a/snippets/singlemsgcross.py b/snippets/singlemsgcross.py
index 7a589294..ee0a67a1 100644
--- a/snippets/singlemsgcross.py
+++ b/snippets/singlemsgcross.py
@@ -74,17 +74,17 @@ def test_crossing_single():
     tab = moose.Table('table', size)
     moose.connect(tab.vec[0], 'requestOut', pg.vec[1], 'getOutputValue', 'Single')
     moose.connect(tab.vec[1], 'requestOut', pg.vec[0], 'getOutputValue', 'Single')
-    print 'Neighbors:'
+    print('Neighbors:')
     for t in tab.vec:
-        print t.path
+        print((t.path))
         for n in moose.element(t).neighbors['requestOut']:
-            print 'requestOut <-', n.path
+            print(('requestOut <-', n.path))
     moose.setClock(0, 0.1)
     moose.useClock(0, '/##', 'process')
     moose.start(5)
     for ii in tab.vec:
         t = moose.Table(ii).vector
-        print len(t)
+        print((len(t)))
         pylab.plot(t)
     pylab.show()
 
diff --git a/snippets/startstop.py b/snippets/startstop.py
index 11d98ea2..fd66b4f9 100644
--- a/snippets/startstop.py
+++ b/snippets/startstop.py
@@ -77,11 +77,11 @@ def main():
     moose.setClock( table.tick, dt )
     moose.reinit()
     clock = moose.element('/clock')
-    print dt
-    print 'dt = ', dt, ', Total simulation time = ', simtime
-    print 'Running simulation for', simtime, 'seconds'
+    print(dt)
+    print(('dt = ', dt, ', Total simulation time = ', simtime))
+    print(('Running simulation for', simtime, 'seconds'))
     moose.start( simtime )
-    print 'Simulator time:', clock.currentTime
+    print(('Simulator time:', clock.currentTime))
     # Here we change the pulse delay and then run again.
     pulse.delay[0] = 1.0
     moose.start( simtime )
@@ -93,13 +93,13 @@ def main():
 
     # Here is yet another way to change clocks used by the table
     moose.useClock( 9, '/model/pulse/tab', 'process' )
-    print table.tick
+    print((table.tick))
     moose.setClock( 9, dt / 2.0 )
     moose.start( simtime )
 
     # Finally, here we change the pulse delay to 1 second and run again.
 
-    print 'Simulator time at end of simulation', clock.currentTime
+    print(('Simulator time at end of simulation', clock.currentTime))
     pylab.plot(pylab.linspace(0, clock.currentTime, len(table.vector)), table.vector)    
     pylab.show()
 
diff --git a/snippets/stochasticLotkaVolterra.py b/snippets/stochasticLotkaVolterra.py
index 59864005..e7bec53b 100644
--- a/snippets/stochasticLotkaVolterra.py
+++ b/snippets/stochasticLotkaVolterra.py
@@ -15,21 +15,21 @@ import moose
 
 runtime = 138.0
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		harmonic = moose.CubeMesh( '/model/harmonic' )
-		harmonic.volume = 1e-15
-		lotka = moose.CubeMesh( '/model/lotka' )
-		lotka.volume = 1e-15
-
-		# create molecules and reactions
-		x = moose.Pool( '/model/lotka/x' )
-		y = moose.Pool( '/model/lotka/y' )
+                # create container for model
+                model = moose.Neutral( 'model' )
+                harmonic = moose.CubeMesh( '/model/harmonic' )
+                harmonic.volume = 1e-15
+                lotka = moose.CubeMesh( '/model/lotka' )
+                lotka.volume = 1e-15
+
+                # create molecules and reactions
+                x = moose.Pool( '/model/lotka/x' )
+                y = moose.Pool( '/model/lotka/y' )
                 z = moose.BufPool( '/model/lotka/z' ) # Dummy molecule.
                 xreac = moose.Reac( '/model/lotka/xreac' )
                 yreac = moose.Reac( '/model/lotka/yreac' )
-		xrate = moose.Function( '/model/lotka/xreac/func' )
-		yrate = moose.Function( '/model/lotka/yreac/func' )
+                xrate = moose.Function( '/model/lotka/xreac/func' )
+                yrate = moose.Function( '/model/lotka/yreac/func' )
 
                 # Parameters
                 alpha = 1.0
@@ -49,9 +49,9 @@ def makeModel():
                 xreac.Kb = 0
                 yreac.Kb = 0
 
-		# connect them up for reactions
-		moose.connect( y, 'nOut', xrate.x[0], 'input' )
-		moose.connect( x, 'nOut', yrate.x[0], 'input' )
+                # connect them up for reactions
+                moose.connect( y, 'nOut', xrate.x[0], 'input' )
+                moose.connect( x, 'nOut', yrate.x[0], 'input' )
                 moose.connect( xrate, 'valueOut', xreac, 'setNumKf' )
                 moose.connect( yrate, 'valueOut', yreac, 'setNumKf' )
                 moose.connect( xreac, 'sub', x, 'reac' )
@@ -59,14 +59,14 @@ def makeModel():
                 moose.connect( yreac, 'sub', y, 'reac' )
                 moose.connect( yreac, 'prd', z, 'reac' )
 
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		xplot = moose.Table2 ( '/model/graphs/x' )
-		yplot = moose.Table2 ( '/model/graphs/y' )
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                xplot = moose.Table2 ( '/model/graphs/x' )
+                yplot = moose.Table2 ( '/model/graphs/y' )
 
-		# connect up the tables
-		moose.connect( xplot, 'requestOut', x, 'getN' );
-		moose.connect( yplot, 'requestOut', y, 'getN' );
+                # connect up the tables
+                moose.connect( xplot, 'requestOut', x, 'getN' );
+                moose.connect( yplot, 'requestOut', y, 'getN' );
 
 def main():
     """
diff --git a/snippets/switchKineticSolvers.py b/snippets/switchKineticSolvers.py
index 5ef2c1d2..48592934 100644
--- a/snippets/switchKineticSolvers.py
+++ b/snippets/switchKineticSolvers.py
@@ -134,4 +134,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/synapse.py b/snippets/synapse.py
index aea6f372..fb061e7e 100644
--- a/snippets/synapse.py
+++ b/snippets/synapse.py
@@ -43,6 +43,10 @@
 # 
 
 # Code:
+
+from __future__ import print_function
+
+
 import moose
 
 def many_ematrix_to_one_element():
@@ -73,9 +77,9 @@ def many_ematrix_to_one_element():
         # synchan.synapse[ii].delay = ii  * 1e-3
         # synchan.synapse[ii].weight = (ii+1) * 0.1
     for sg in spikegens:
-        print sg.path, '-->',
+        print(sg.path, '-->', end=' ')
         for m in sg.msgOut:
-            print moose.element(m).adjacent[sg].path
+            print(moose.element(m).adjacent[sg].path)
     
 if __name__ == '__main__':
     many_ematrix_to_one_element()
diff --git a/snippets/synapse_tutorial.py b/snippets/synapse_tutorial.py
index 98b6c02d..b6e574b8 100644
--- a/snippets/synapse_tutorial.py
+++ b/snippets/synapse_tutorial.py
@@ -108,7 +108,7 @@ net.vec.Vm = [thresh / 2.0] * size
 
 
 
-print net.vec[1].Vm
+print((net.vec[1].Vm))
 
 
 
@@ -116,7 +116,7 @@ print net.vec[1].Vm
 
 
 
-print len(synh.synapse)
+print((len(synh.synapse)))
 
 
 
@@ -125,12 +125,12 @@ print len(synh.synapse)
 
 
 synh.numSynapses = 3
-print len(synh.synapse)
+print((len(synh.synapse)))
 
 
 
 synh.synapse.num = 4
-print len(synh.synapse)
+print((len(synh.synapse)))
 
 
 
@@ -138,9 +138,9 @@ print len(synh.synapse)
 
 
 
-print 'Before:', synh.synapse[0].delay
+print(('Before:', synh.synapse[0].delay))
 synh.synapse[0].delay = 1.0
-print 'After:', synh.synapse[0].delay
+print(('After:', synh.synapse[0].delay))
 
 
 
@@ -149,7 +149,7 @@ print 'After:', synh.synapse[0].delay
 
 
 synh.synapse.weight = [0.2] * len(synh.synapse)
-print synh.synapse.weight
+print((synh.synapse.weight))
 
 
 
@@ -177,8 +177,8 @@ for syn in synh.vec:
 
 
 for syn in synh.vec[:5]:
-    print 'Delays for synapses on ', syn.path, ':', syn.synapse.delay
-    print 'Weights for synapses on ', syn.path, ':', syn.synapse.weight
+    print(('Delays for synapses on ', syn.path, ':', syn.synapse.delay))
+    print(('Weights for synapses on ', syn.path, ':', syn.synapse.weight))
 
 
 
diff --git a/snippets/testHsolve.py b/snippets/testHsolve.py
index 77bf3a16..9f06c4cd 100644
--- a/snippets/testHsolve.py
+++ b/snippets/testHsolve.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # testHsolve.py --- 
 # Upi Bhalla, NCBS Bangalore, 9 June 2013.
 #
@@ -103,7 +103,7 @@ def create_squid():
     nachan.Xpower = 3
     xGate = moose.HHGate(nachan.path + '/gateX')    
     xGate.setupAlpha(Na_m_params + [VDIVS, VMIN, VMAX])
-	#This is important: one can run without it but the output will diverge.
+        #This is important: one can run without it but the output will diverge.
     xGate.useInterpolation = 1
     nachan.Ypower = 1
     yGate = moose.HHGate(nachan.path + '/gateY')
@@ -295,7 +295,7 @@ def test_elec_alone():
     hsolve.target = '/n/compt'
     moose.le( '/n' )
     for dt in ( 20e-6, 50e-6, 100e-6 ):
-        print 'running at dt =', dt
+        print(('running at dt =', dt))
         moose.setClock( 0, dt )
         moose.setClock( 1, dt )
         moose.setClock( 2, dt )
diff --git a/snippets/testRdesigneur.py b/snippets/testRdesigneur.py
index c7764813..b38e0ccd 100644
--- a/snippets/testRdesigneur.py
+++ b/snippets/testRdesigneur.py
@@ -40,7 +40,7 @@ spineAngleDistrib = 2*numpy.pi
 # Here we define a function that is used to make a cell prototype. Normally
 # it would load in a model from a file.
 def makeCellProto( name ):
-    print 'IN: makeCellProto( ', name, ')'
+    print(('IN: makeCellProto( ', name, ')'))
     elec = moose.Neuron( '/library/' + name )
     ecompt = []
     for i in range( numDendSegments ):
@@ -63,7 +63,7 @@ rd.makeCellProto = makeCellProto
 def makeChemProto( name ):
     chem = moose.Neutral( '/library/' + name )
     for i in ( 'dend', 'spine', 'psd' ):
-        print 'making ', i
+        print(('making ', i))
         compt = moose.CubeMesh( chem.path + '/' + i )
         compt.volume = 1e-18
         ca = moose.Pool( compt.path + '/Ca' )
@@ -109,7 +109,7 @@ def addPlot( objpath, field, plot, tick ):
         tab.tick = tick
         return tab 
     else:
-        print "failed in addPlot(", objpath, field, plot, tick, ")" 
+        print(("failed in addPlot(", objpath, field, plot, tick, ")")) 
         return 0
 
 def plotVm( plot, name ):
@@ -202,4 +202,4 @@ def getMidpts( compt ):
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/testSigNeur.py b/snippets/testSigNeur.py
index 679bb312..b6695b75 100644
--- a/snippets/testSigNeur.py
+++ b/snippets/testSigNeur.py
@@ -404,8 +404,8 @@ def makeNeuroMeshModel():
     assert( pdc == 5 )
     #
     # We need to use the spine solver as the master for the purposes of
-	# these calculations. This will handle the diffusion calculations
-	# between head and dendrite, and between head and PSD.
+        # these calculations. This will handle the diffusion calculations
+        # between head and dendrite, and between head and PSD.
     smksolve.addJunction( nmksolve )
     #print "spine: nv=", smksolve.numLocalVoxels, ", nav=", smksolve.numAllVoxels, smksolve.numVarPools, smksolve.numAllPools
     smksolve.addJunction( pmksolve )
@@ -442,7 +442,7 @@ def makeNeuroMeshModel():
         elecR = moose.element( path )
         moose.connect( adaptGluR[i], 'outputSrc', elecR, 'setGbar', 'Single' )
     #moose.connect( chemR, 'nOut', adaptGluR, 'input', 'OneToOne' )
-	# Ksolve isn't sending nOut. Not good. So have to use requestOut.
+        # Ksolve isn't sending nOut. Not good. So have to use requestOut.
     moose.connect( adaptGluR, 'requestOut', chemR, 'getN', 'OneToOne' )
     adaptGluR.outputOffset = 1e-7    # pS
     adaptGluR.scale = 1e-6 / 100     # from n to pS
diff --git a/snippets/testWigglySpines.py b/snippets/testWigglySpines.py
index 36a8294c..5adb7746 100644
--- a/snippets/testWigglySpines.py
+++ b/snippets/testWigglySpines.py
@@ -10,17 +10,22 @@
 ## a molecule that diffuses.
 ##################################################################
 
+from __future__ import print_function
+
 import math
 import pylab
 import numpy
 import matplotlib.pyplot as plt
 import moose
 import sys
-sys.path.append( '../util' )
 import rdesigneur as rd
 from PyQt4 import QtGui
 import moogli
 
+import os
+scriptDir = os.path.dirname( os.path.realpath( __file__ ) )
+sys.path.append( os.path.join( scriptDir, '../util' ) )
+
 PI = 3.141592653
 ScalingForTesting = 10
 RM = 1.0 / ScalingForTesting
@@ -46,7 +51,7 @@ def makeCellProto( name ):
 def makeChemProto( name ):
     chem = moose.Neutral( '/library/' + name )
     for i in ( ['dend', 1e-18], ['spine', 1e-19], ['psd', 1e-20] ):
-        print 'making ', i
+        print('making ', i)
         compt = moose.CubeMesh( chem.path + '/' + i[0] )
         compt.volume = i[1]
         Ca = moose.Pool( compt.path + '/Ca' )
@@ -93,12 +98,12 @@ def p2(x):
     '''
     Print to 2 sig fig
     '''
-    print round(x, 1-int(numpy.floor(numpy.log10(x)))),
+    print(round(x, 1-int(numpy.floor(numpy.log10(x)))), end=' ')
 
 def assertEq( a, b ):
-    print '.',
+    print('.', end=' ')
     if not( numpy.fabs( a-b) / (a+b) < 1e-10 ):
-        print 'a!=b:', a, b
+        print('a!=b:', a, b)
         assert(False)
 
 def main():
@@ -151,8 +156,8 @@ def main():
     head2 = moose.element( '/model/elec/head2' )
 
     # Here we scale the spine head length while keeping all vols constt.
-    print "Spine 0: longer head, same vol\nSpine 1: longer shaft"
-    print "Spine 2: Bigger head, same diffScale\n"
+    print("Spine 0: longer head, same vol\nSpine 1: longer shaft")
+    print("Spine 2: Bigger head, same diffScale\n")
     elecParms = [ (i.Rm, i.Cm, i.Ra) for i in ( head0, shaft1, head2) ]
     chemParms = [ i.volume for i in ( caHead[0], caPsd[0], caHead[1], caPsd[1], caHead[2], caPsd[2] ) ]
 
@@ -170,7 +175,7 @@ def main():
     elec.spine[2].headDiameter *= numpy.sqrt(2) # sqrt(2) x dia
     hdia = elec.spine[2].headDiameter
 
-    print "Checking scaling assertions: "
+    print("Checking scaling assertions: ")
     assertEq( elecParms[0][0] * 0.5 , head0.Rm )
     assertEq( elecParms[0][1] * 2 , head0.Cm )
     assertEq( elecParms[0][2] * 16 , head0.Ra )
@@ -189,7 +194,7 @@ def main():
     assertEq( elecParms[2][2] , head2.Ra )
     assertEq( chemParms[4] * 4 , caHead[2].volume )
     assertEq( chemParms[5] * 2 , caPsd[2].volume )
-    print "\nAll assertions cleared"
+    print("\nAll assertions cleared")
 
     moose.start( 2 )
     for i in range( len( psdTab ) ):
@@ -220,4 +225,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/threading_demo.py b/snippets/threading_demo.py
index a9fd15ca..ca040911 100644
--- a/snippets/threading_demo.py
+++ b/snippets/threading_demo.py
@@ -30,15 +30,20 @@
 # Code:
 
 import sys
-from datetime import datetime
 import threading
-import Queue
-import time
 
+# Python3 and python2.
+try:
+    import queue
+except ImportError as e:
+    import Queue as queue 
+
+import time
+from datetime import datetime
 import moose
 
-worker_queue = Queue.Queue()
-status_queue = Queue.Queue()
+worker_queue = queue.Queue()
+status_queue = queue.Queue()
 
 class WorkerThread(threading.Thread):
     """This thread initializes the simulation (reinit) and then runs
@@ -49,16 +54,16 @@ class WorkerThread(threading.Thread):
     def __init__(self, runtime):
         threading.Thread.__init__(self)
         self.runtime = runtime
-        print 'Created WorkerThread of name', self.name
+        print(('Created WorkerThread of name', self.name))
         
     def run(self):
-        print self.name, 'Starting run for', self.runtime, ' seconds'        
+        print((self.name, 'Starting run for', self.runtime, ' seconds'))        
         moose.reinit()
         moose.start(self.runtime)
         while moose.isRunning():
             time.sleep(1.0)
-            print self.name, 'Table length', len(moose.Table('/tab').vector)
-        print self.name, 'Finishing simulation'
+            print((self.name, 'Table length', len(moose.Table('/tab').vector)))
+        print((self.name, 'Finishing simulation'))
         worker_queue.put(self.name)
 
 class StatusThread(threading.Thread):
@@ -71,18 +76,23 @@ class StatusThread(threading.Thread):
     def __init__(self, tab):
         threading.Thread.__init__(self)
         self.table = tab
-        print 'Created StatusThread of name', self.name
+        print(('Created StatusThread of name', self.name))
         
     def run(self):
         while True:
             try:
                 value = worker_queue.get(False)
-                print self.name, 'Received queue entry: ', value, '. Final table length:', len(self.table.vector), ' ... now Finishing'
+                print((self.name, 'Received queue entry: ', value
+                        , '. Final table length:', len(self.table.vector)
+                        , ' ... now Finishing'
+                        ))
                 status_queue.put(self.name)
                 return
-            except Queue.Empty:
+            except queue.Empty:
                 time.sleep(1.0)
-                print self.name, 'Queue is empty. Current table length:', len(self.table.vector)
+                print((self.name, 'Queue is empty. Current table length:'
+                        , len(self.table.vector)
+                        ))
         
 if __name__ == '__main__':
     pg = moose.PulseGen('pg')
@@ -99,7 +109,7 @@ if __name__ == '__main__':
     t1.start()
     status_queue.get(True)
     tab.xplot('threading_demo.dat', 'pulsegen_output')
-    print 'Ending threading_demo: final length of table', len(tab.vector) 
+    print(('Ending threading_demo: final length of table', len(tab.vector))) 
 
 # 
 # threading_demo.py ends here
diff --git a/snippets/transportBranchingNeuron.py b/snippets/transportBranchingNeuron.py
index b8616b58..c15ab0d1 100644
--- a/snippets/transportBranchingNeuron.py
+++ b/snippets/transportBranchingNeuron.py
@@ -73,7 +73,7 @@ def makeModel():
     
     moose.element( '/model/chem/compt0/a[0]' ).concInit = aConcInit
     twigs = findTwigs( compt0 )
-    print 'twigs = ', twigs
+    print(('twigs = ', twigs))
     for i in twigs:
         e = moose.element( '/model/chem/compt0/b[' + str(i) + ']' )
         e.concInit = bConcInit
@@ -126,8 +126,8 @@ def makeDisplay():
         return ( timeSeries, fig, aline, bline, timeLabel, yp )
 
 def updateDisplay( plotlist ):
-	a = moose.vec( '/model/chem/compt0/a' )
-	b = moose.vec( '/model/chem/compt0/b' )
+        a = moose.vec( '/model/chem/compt0/a' )
+        b = moose.vec( '/model/chem/compt0/b' )
         plotlist[2].set_ydata( a.conc * plotScale + plotlist[5]  )
         plotlist[3].set_ydata( b.conc * plotScale + plotlist[5]  )
         plotlist[1].canvas.draw()
@@ -140,7 +140,7 @@ def finalizeDisplay( plotlist, cPlotDt ):
     plt.legend()
     plotlist[1].canvas.draw()
     print( "Hit 'enter' to exit" )
-    raw_input()
+    eval(input())
 
 def makeChemModel( compt ):
     
@@ -208,10 +208,10 @@ def main():
         plotlist[4].set_text( "time = %d" % i )
         updateDisplay( plotlist )
 
-    print 'mass consv a = ', a0, sum( a.n ), ', b = ', b0, sum( b.n )
+    print(('mass consv a = ', a0, sum( a.n ), ', b = ', b0, sum( b.n )))
 
     finalizeDisplay( plotlist, plotdt )
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/traub_naf.py b/snippets/traub_naf.py
index cb124e44..db83c41f 100644
--- a/snippets/traub_naf.py
+++ b/snippets/traub_naf.py
@@ -254,7 +254,7 @@ def run_clamp(model_dict, clamp, levels, holding=0.0, simtime=100e-3):
     for level in levels:
         model_dict['command'].level[0] = level
         model_dict['command'].baseLevel = holding
-        print 'Running %s with holding=%g, level=%g' % (clamp, holding, model_dict['command'].level[0])
+        print(('Running %s with holding=%g, level=%g' % (clamp, holding, model_dict['command'].level[0])))
         run_sim(model_dict['model'], model_dict['data'], simtime)
         ivec.append(np.asarray(model_dict['inject_tab'].vector))
         cvec.append(np.asarray(model_dict['command_tab'].vector))
diff --git a/snippets/tweakingParameters.py b/snippets/tweakingParameters.py
index 2f7a2a58..7c962ea1 100644
--- a/snippets/tweakingParameters.py
+++ b/snippets/tweakingParameters.py
@@ -72,4 +72,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/snippets/vclamp.py b/snippets/vclamp.py
index 71f60679..edad6460 100644
--- a/snippets/vclamp.py
+++ b/snippets/vclamp.py
@@ -101,10 +101,10 @@ def vclamp_demo(simtime=50.0, dt=1e-2):
     moose.useClock(2, '%s/##[TYPE=VClamp]' % (container.path), 'process')
     moose.useClock(3, '%s/##[TYPE=Table]' % (container.path), 'process')
     moose.reinit()
-    print 'RC filter in VClamp:: tau:', clamp.tau
-    print 'PID controller in VClamp:: ti:', clamp.ti, 'td:', clamp.td, 'gain:', clamp.gain
+    print(('RC filter in VClamp:: tau:', clamp.tau))
+    print(('PID controller in VClamp:: ti:', clamp.ti, 'td:', clamp.td, 'gain:', clamp.gain))
     moose.start(simtime)
-    print 'Finished simulation for %g seconds' % (simtime)
+    print(('Finished simulation for %g seconds' % (simtime)))
     tseries = linspace(0, simtime, len(vmtab.vector))
     subplot(211)
     title('Membrane potential and clamp voltage')
diff --git a/snippets/wildcard.py b/snippets/wildcard.py
index 6db9225c..97cf2dac 100644
--- a/snippets/wildcard.py
+++ b/snippets/wildcard.py
@@ -71,84 +71,84 @@ def wildcard_setup():
 def wildcard_test():
     # TYPE matches the type of the object
     wildcard = '/alfa/bravo/#[TYPE=HHChannel2D]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # ISA matches elements of specified type or its subclasses
     wildcard = '/alfa/bravo/#[ISA=HHChannel]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # HHChannel and HHChannel2D are subclasses of ChanBase
     wildcard = '/alfa/bravo/#[ISA=ChanBase]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # HHChannel and HHChannel2D are subclasses of ChanBase
     wildcard = '/alfa/bravo/#[TYPE=ChanBase]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # `#` can be used only once and matches all subsequent characters in name
     wildcard = '/alfa/bravo/charl?e'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # `?` can be used any number of times but substitutes a single character
     wildcard = '/alfa/bravo/fox#'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # Specify `##` to search through all levels below the path prefixing it
     wildcard = '/##[ISA=ChanBase]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # You can even select by field - but if the field does not exist,
     # this will produce a lot of harmless error messages in debug
     # builds.
     wildcard = '/##[FIELD(name)=echo]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # == and = are same
     wildcard = '/##[FIELD(name)==echo]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path
+        print(('\t', element.path))
 
     # Comparison operators other than == are allowed for floating point number fields
     wildcard = '/alfa/##[FIELD(Gbar)<1e-6]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path, moose.element(element).Gbar
+        print(('\t', element.path, moose.element(element).Gbar))
 
     # Equality is not defined for floating point fields
     wildcard = '/alfa/##[FIELD(Gbar)=1e-6]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path, moose.element(element).Gbar
+        print(('\t', element.path, moose.element(element).Gbar))
 
     # Another operator is !=
     wildcard = '/alfa/bravo/#[TYPE!=HHChannel]'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path, ', class:', element.className
+        print(('\t', element.path, ', class:', element.className))
 
     # With `##` you can get a listing of all elements under a path if
     # you don't use a condition
     wildcard = '/alfa/##'
-    print '\nElements Matching:', wildcard
+    print(('\nElements Matching:', wildcard))
     for element in moose.wildcardFind(wildcard):
-        print '\t', element.path, ', class:', element.className
+        print(('\t', element.path, ', class:', element.className))
     
 
 if __name__ == '__main__':
diff --git a/squid/channeleditor.py b/squid/channeleditor.py
index ead90412..23f8973e 100644
--- a/squid/channeleditor.py
+++ b/squid/channeleditor.py
@@ -59,17 +59,17 @@ class GateEditor(QtGui.QWidget):
         self.maxVEdit = QtGui.QLineEdit(self)
         self.divsVEdit = QtGui.QLineEdit(self)
         self.equation = '(A + B * V) / (C + exp((V + D)/F))'
-        self.alphaText = u'Equation for forward rate  \u03B1 '
-        self.betaText = u'Equation for backward rate \u03B2 '
-        self.minfText = u'Equation for m\u221E '
-        self.taumText = u'Equation for \u03C4m '
+        self.alphaText = 'Equation for forward rate  \\u03B1 '
+        self.betaText = 'Equation for backward rate \\u03B2 '
+        self.minfText = 'Equation for m\\u221E '
+        self.taumText = 'Equation for \\u03C4m '
         self.alphaLabel = QtGui.QLabel(self.minfText, self)
         self.betaLabel = QtGui.QLabel(self.taumText, self)
         self.alphaEdit = QtGui.QLineEdit(self)
         self.betaEdit =  QtGui.QLineEdit(self)
         self.formCombo = QtGui.QComboBox(self)
-        self.formCombo.addItem(u'm\u221E - \u03C4m')
-        self.formCombo.addItem(u'\u03B1 - \u03B2')
+        self.formCombo.addItem('m\\u221E - \\u03C4m')
+        self.formCombo.addItem('\\u03B1 - \\u03B2')
         self.okButton = QtGui.QPushButton('OK', self)
         layout = QtGui.QGridLayout(self.inputPanel)
         layout.addWidget(self.minVLabel, 0, 0)
@@ -125,10 +125,10 @@ class GateEditor(QtGui.QWidget):
     a[ii] = %s
     b[ii] = %s
         """ % (symbol, a_expr, b_expr)            
-        print code
+        print(code)
         tree = compile(code, '<string>', 'exec')
         exec(tree)
-        print a, b
+        print((a, b))
         return {'min': vmin,
                 'max': vmax,
                 'divs': vdivs,
diff --git a/squid/squid.py b/squid/squid.py
index b7c2727e..dae8ff9d 100644
--- a/squid/squid.py
+++ b/squid/squid.py
@@ -303,7 +303,7 @@ class SquidAxon(moose.Compartment):
         self.temperature = celsius + CELSIUS_TO_KELVIN
 
     def use_defaults(self):
-        for field, value in SquidAxon.defaults.items():
+        for field, value in list(SquidAxon.defaults.items()):
             setattr(self, field, value)
 
 class SquidModel(moose.Neutral):
@@ -311,13 +311,13 @@ class SquidModel(moose.Neutral):
     def __init__(self, path):
         moose.Neutral.__init__(self, path)
         self.squid_axon = SquidAxon(path+'/squid_axon')
-        print self.squid_axon.Na_channel.Gbar, self.squid_axon.K_channel.Gbar
+        print((self.squid_axon.Na_channel.Gbar, self.squid_axon.K_channel.Gbar))
         self.current_clamp = moose.PulseGen(path+'/pulsegen')
         self.current_clamp.firstDelay = 5.0 # ms
         self.current_clamp.firstWidth = 40 # ms
         self.current_clamp.firstLevel = 0.1 # uA
         self.current_clamp.secondDelay = 1e9
-        print 'Current clamp connected:', moose.connect(self.current_clamp, 'output', self.squid_axon, 'injectMsg')
+        print(('Current clamp connected:', moose.connect(self.current_clamp, 'output', self.squid_axon, 'injectMsg')))
 
         self.Vm_table = moose.Table('%s/Vm' % (self.path))
         moose.connect(self.Vm_table, 'requestOut', self.squid_axon, 'getVm')
@@ -345,19 +345,19 @@ class SquidModel(moose.Neutral):
 
     def save_data(self):
         self.Vm_table.xplot('Vm.dat', 'Vm')
-        print 'Vm saved to Vm.dat'
+        print('Vm saved to Vm.dat')
         if hasattr(self, 'gK_table'):
             self.gK_table.xplot('gK.dat', 'gK')
             numpy.savetxt('K_alpha_n.dat', self.squid_axon.K_channel.alpha_m)
             numpy.savetxt('K_beta_n.dat', self.squid_axon.K_channel.beta_m)
-            print 'K conductance saved to gK.dat'
+            print('K conductance saved to gK.dat')
         if hasattr(self, 'gNa_table'):
             self.gNa_table.xplot('gNa.dat', 'gNa')
             numpy.savetxt('Na_alpha_m.dat', self.squid_axon.Na_channel.alpha_m)
             numpy.savetxt('Na_beta_m.dat', self.squid_axon.Na_channel.beta_m)
             numpy.savetxt('Na_alpha_h.dat', self.squid_axon.Na_channel.alpha_h)
             numpy.savetxt('Na_beta_h.dat', self.squid_axon.Na_channel.beta_h)
-            print 'Na conductance saved to gNa.dat'
+            print('Na conductance saved to gNa.dat')
 
             
         
diff --git a/squid/squid_demo.py b/squid/squid_demo.py
index 7207044f..d243b0f5 100644
--- a/squid/squid_demo.py
+++ b/squid/squid_demo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
  # -*- coding: utf-8 -*-
 # squidgui.py --- 
 # 
@@ -95,7 +95,7 @@ where P<sub>C</sub> is the permeability of the membrane to ion C.
 
 """
 
-tooltip_NaChan = u"""<h3>Na+ channel conductance</h3>
+tooltip_NaChan = """<h3>Na+ channel conductance</h3>
 <p/>
 The Na<sup>+</sup> channel conductance in squid giant axon is given by:
 
@@ -120,7 +120,7 @@ and time constant for steady state is:
 and similarly for h.
 """
 
-tooltip_KChan = u"""<h3>K+ channel conductance</h3>
+tooltip_KChan = """<h3>K+ channel conductance</h3>
 <p/>The K+ channel conductance in squid giant axon is given by:
 
 <p> G<sub>K</sub> = GÌ„<sub>K</sub> * n<sup>4</sup></p>
@@ -634,7 +634,7 @@ class SquidGui(QtGui.QMainWindow):
 
     def _runSlot(self):
         if moose.isRunning():
-            print 'Stopping simulation in progress ...'
+            print('Stopping simulation in progress ...')
             moose.stop()
         self._runtime = self.getFloatInput(self._runTimeEdit, self._runTimeLabel.text())
         self._overlayPlots(self._overlayAction.isChecked())
@@ -892,7 +892,7 @@ if __name__ == '__main__':
     QtGui.qApp = app
     squid_gui = SquidGui()
     squid_gui.show()
-    print squid_gui.size()
+    print((squid_gui.size()))
     sys.exit(app.exec_())
 
 # 
diff --git a/traub_2005/py/cell_test_util.py b/traub_2005/py/cell_test_util.py
index d0ba68e4..6e7d29c4 100644
--- a/traub_2005/py/cell_test_util.py
+++ b/traub_2005/py/cell_test_util.py
@@ -28,7 +28,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 
 from datetime import datetime
 import time
diff --git a/traub_2005/py/cells.py b/traub_2005/py/cells.py
index 530029c8..ab10380b 100644
--- a/traub_2005/py/cells.py
+++ b/traub_2005/py/cells.py
@@ -28,7 +28,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 import csv
 import numpy as np
 from collections import defaultdict
@@ -101,7 +101,7 @@ def adjust_chanlib(cdict):
     """Update the revarsal potentials for channels. Set the initial X
     value for AR channel. Set the tau for Ca pool."""
     channel_dict = init_chanlib()
-    for ch in channel_dict.values():
+    for ch in list(channel_dict.values()):
         config.logger.info('adjusting properties of %s' % (ch.path))
         if isinstance(ch, kchans.KChannel):
             ch.Ek = cdict['EK']
@@ -142,7 +142,7 @@ def read_prototype(celltype, cdict):
     leveldict = read_keyvals('%s/%s.levels' % (config.modelSettings.protodir, celltype))
     depths = read_keyvals('%s/%s.depths' % (config.modelSettings.protodir, celltype))
     depthdict = {}
-    for level, depthset in depths.items():
+    for level, depthset in list(depths.items()):
         if len(depthset) != 1:
             raise Exception('Depth set must have only one entry.')
         depthdict[level] = depthset.pop()
@@ -165,7 +165,7 @@ def assign_depths(cell, depthdict, leveldict):
     """
     if not depthdict:
         return
-    for level, depth in depthdict.items():
+    for level, depth in list(depthdict.items()):
         z = float(depth)
         complist = leveldict[level]
         for comp_number in complist:
@@ -187,15 +187,14 @@ class CellMeta(type):
                         break
             if annotation is not None:
                 info = moose.Annotator('%s/info' % (proto.path))
-                info.notes = '\n'.join('"%s": "%s"' % kv for kv in annotation.items())
+                info.notes = '\n'.join('"%s": "%s"' % kv for kv in list(annotation.items()))
             if 'soma_tauCa' in cdict:
                 moose.element(proto.path + '/comp_1/CaPool').tau = cdict['soma_tauCa']
             cdict['prototype'] = proto
         return type.__new__(cls, name, bases, cdict)
 
     
-class CellBase(moose.Neuron):
-    __metaclass__ = CellMeta
+class CellBase(moose.Neuron, CellMeta):
     annotation = {'cno': 'cno_0000020'}
     def __init__(self, path):
         if not moose.exists(path):
diff --git a/traub_2005/py/channel_test_util.py b/traub_2005/py/channel_test_util.py
index 29f70c38..95a0049b 100644
--- a/traub_2005/py/channel_test_util.py
+++ b/traub_2005/py/channel_test_util.py
@@ -27,7 +27,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 
 import uuid
 import unittest
@@ -57,15 +57,15 @@ def run_single_channel(channelname, Gbar, simtime, simdt=testutils.SIMDT, plotdt
     vm_file = 'data/%s_Vm.dat' % (channelname)
     gk_file = 'data/%s_Gk.dat' % (channelname)
     ik_file = 'data/%s_Ik.dat' % (channelname)
-    tseries = np.array(range(len(vm_data.vector))) * simdt
-    print('Vm:', len(vm_data.vector), 'Gk', len(gk_data.vector), 'Ik', len(ik_data.vector))
+    tseries = np.array(list(range(len(vm_data.vector)))) * simdt
+    print(('Vm:', len(vm_data.vector), 'Gk', len(gk_data.vector), 'Ik', len(ik_data.vector)))
     data = np.c_[tseries, vm_data.vector]
     np.savetxt(vm_file, data)
-    print('Saved Vm in', vm_file)
-    print(len(gk_data.vector), len(vm_data.vector))
+    print(('Saved Vm in', vm_file))
+    print((len(gk_data.vector), len(vm_data.vector)))
     data = np.c_[tseries, gk_data.vector]
     np.savetxt(gk_file, data)
-    print('Saved Gk in', gk_file)
+    print(('Saved Gk in', gk_file))
     data = np.c_[tseries, ik_data.vector]
     np.savetxt(ik_file, data)
     print('Saved Gk in', ik_file)
@@ -80,7 +80,7 @@ def compare_channel_data(series, channelname, param, simulator, x_range=None, pl
         raise ValueError('Unrecognised simulator: %s' % (simulator))
     try:
         ref_series = np.loadtxt(ref_file)
-    except IOError, e:
+    except IOError as e:
         print(e)
         return -1.0
     if plot:
diff --git a/traub_2005/py/channelbase.py b/traub_2005/py/channelbase.py
index a013558a..20ba21c5 100644
--- a/traub_2005/py/channelbase.py
+++ b/traub_2005/py/channelbase.py
@@ -154,7 +154,7 @@ class ChannelMeta(type):
             mstring.value = mstring_field[1]
         if 'annotation' in cdict:
             info = moose.Annotator('%s/info' % (proto.path))
-            info.notes = '\n'.join('%s: %s' % kv for kv in cdict['annotation'].items())
+            info.notes = '\n'.join('%s: %s' % kv for kv in list(cdict['annotation'].items()))
             # print proto.path, info.notes
         cdict['prototype'] = proto
         prototypes[name] = proto
@@ -162,10 +162,9 @@ class ChannelMeta(type):
         return type.__new__(cls, name, bases, cdict)
 
 
-class ChannelBase(moose.HHChannel):
+class ChannelBase(moose.HHChannel, ChannelMeta):
     annotation = {'cno': 'cno_0000047'}
     abstract = True
-    __metaclass__ = ChannelMeta
     def __init__(self, path, xpower=1, ypower=0, Ek=0.0):
         moose.HHChannel.__init__(self, path)
 
diff --git a/traub_2005/py/config.py b/traub_2005/py/config.py
index 7569af2d..02fd52b9 100644
--- a/traub_2005/py/config.py
+++ b/traub_2005/py/config.py
@@ -29,7 +29,7 @@
 
 # Code:
 
-from __future__ import print_function
+
 import settings
 import os
 
diff --git a/traub_2005/py/deadlock_bug.py b/traub_2005/py/deadlock_bug.py
index d876cd7d..760a6cef 100644
--- a/traub_2005/py/deadlock_bug.py
+++ b/traub_2005/py/deadlock_bug.py
@@ -28,7 +28,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 
 from collections import defaultdict
 import moose
@@ -68,7 +68,7 @@ def adjust_chanlib(cdict):
     """Update the revarsal potentials for channels. Set the initial X
     value for AR channel. Set the tau for Ca pool."""
     channel_dict = init_chanlib()
-    for ch in channel_dict.values():
+    for ch in list(channel_dict.values()):
         if isinstance(ch, kchans.KChannel):
             ch.Ek = cdict['EK']
         elif isinstance(ch, nachans.NaChannel):
@@ -106,7 +106,7 @@ def read_prototype(celltype, cdict):
     leveldict = read_keyvals('%s/%s.levels' % (config.modelSettings.protodir, celltype))
     depths = read_keyvals('%s/%s.depths' % (config.modelSettings.protodir, celltype))
     depthdict = {}
-    for level, depthset in depths.items():
+    for level, depthset in list(depths.items()):
         if len(depthset) != 1:
             raise Exception('Depth set must have only one entry.')
         depthdict[level] = depthset.pop()
@@ -128,7 +128,7 @@ def assign_depths(cell, depthdict, leveldict):
     """
     if not depthdict:
         return
-    for level, depth in depthdict.items():
+    for level, depth in list(depthdict.items()):
         z = float(depth)
         complist = leveldict[level]
         for comp_number in complist:
@@ -146,8 +146,7 @@ class CellMeta(type):
         return type.__new__(cls, name, bases, cdict)
 
     
-class CellBase(moose.Neutral):
-    __metaclass__ = CellMeta
+class CellBase(moose.Neutral, CellMeta):
     def __init__(self, path):
         if not moose.exists(path):
             path_tokens = path.rpartition('/')
diff --git a/traub_2005/py/display_morphology.py b/traub_2005/py/display_morphology.py
index 7722b23f..72cdbbbb 100644
--- a/traub_2005/py/display_morphology.py
+++ b/traub_2005/py/display_morphology.py
@@ -28,19 +28,24 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 
 """
+
 Display/save the topology of one or all cells in traub_2005 demo.
 
 command line options (all are optional):
--c celltype    : display topology of cell type 'celltype'. If unspecified, all cell types are displayed
--p filename    : save output to fiel specified by 'filename'
--l             : show labels of the compartments
--h,--help      : show this help
+
+    -c celltype    : display topology of cell type 'celltype'. If unspecified, 
+                    all cell types are displayed
+    -p filename    : save output to fiel specified by 'filename'
+    -l             : show labels of the compartments
+    -h,--help      : show this help
+
 """
+from __future__ import print_function
+
 import sys
-sys.path.append('../../../python')
 import os
 import numpy as np
 import matplotlib.pyplot as plt
@@ -117,7 +122,7 @@ def plot_cell_topology(cell, label=False):
     nx.draw_networkx_edges(g, pos, width=10*weights/max(weights), edge_color='gray', alpha=0.8)
     nx.draw_networkx_nodes(g, pos, with_labels=False,
                            nnode_size=node_size * 500, 
-                           node_color=map(lambda x: 'k' if x in axon else 'gray', g.nodes()), 
+                           node_color=['k' if x in axon else 'gray' for x in g.nodes()], 
                            linewidths=[1 if n.endswith('comp_1') else 0 for n in g.nodes()], 
                            alpha=0.8)
     if label:
@@ -131,6 +136,7 @@ import sys
 from getopt import getopt
 
 if __name__ == '__main__':
+    print(sys.argv)
     optlist, args = getopt(sys.argv[1:], 'lhp:c:', ['help'])
     celltype = ''
     pdf = ''
@@ -151,6 +157,7 @@ if __name__ == '__main__':
             print('-p  filename (optional) save outputin a pdf file named "filename".')
             print('-h,--help print this help')
             sys.exit(0)
+    print('args', optlist, args)
     figures = []
     if len(celltype) > 0:
         try:
@@ -160,12 +167,13 @@ if __name__ == '__main__':
             # print 'Label', label
             plot_cell_topology(cell, label=label)
         except KeyError:
-            print( '%s: no such cell type. Available are:' % (celltype))
-            for ii in cells.init_prototypes().keys():
-                print( ii)
+            print('%s: no such cell type. Available are:' % (celltype))
+            for ii in list(cells.init_prototypes().keys()):
+                print(ii, end=' ')
+            print() 
             sys.exit(1)    
     else:
-        for cell, proto in cells.init_prototypes().items():
+        for cell, proto in list(cells.init_prototypes().items()):
             figures.append(plt.figure())
             plot_cell_topology(proto, label=label)
     plt.axis('off')
diff --git a/traub_2005/py/dump_f_i_curves.py b/traub_2005/py/dump_f_i_curves.py
index 7135a4d8..bc9e77e3 100644
--- a/traub_2005/py/dump_f_i_curves.py
+++ b/traub_2005/py/dump_f_i_curves.py
@@ -1,112 +1,112 @@
-# dump_f_i_curves.py --- 
-# 
-# Filename: dump_f_i_curves.py
-# Description: 
-# Author: Subhasis Ray
-# Maintainer: 
-# Created: Tue Dec  8 13:11:01 2015 (-0500)
-# Version: 
-# Package-Requires: ()
-# Last-Updated: Wed Dec  9 12:28:06 2015 (-0500)
-#           By: Subhasis Ray
-#     Update #: 79
-# URL: 
-# Doc URL: 
-# Keywords: 
-# Compatibility: 
-# 
-# 
-
-# Commentary: 
-# 
-# 
-# 
-# 
-
-# Change Log:
-# 
-# 
-# 
-# 
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or (at
-# your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-# 
-# 
-
-# Code:
-
-"""Do a series of current steps on each celltype"""
-from __future__ import print_function
-import numpy as np
-import h5py as h5
-from collections import defaultdict
-
-import moose
-from moose import utils as mutils
-
-from cells import SpinyStellate
-from cells import DeepBasket
-from cells import DeepLTS
-
-
-simdt = 2.5e-6
-plotdt = 1e-4
-
-amps = np.array([-0.1, 0.1, 0.5, 1.0, 1.5])*1e-9
-
-def run_current_pulse(amps, delay=100e-3, dur=100e-3, trail=100e-3, outfile='f_i_curves_data.h5'):
-    models = []
-    model = moose.Neutral('/model')
-    data = moose.Neutral('/data')
-    ddict = defaultdict(list)
-    for ii, amp in enumerate(amps):
-        mc = moose.Neutral('{}/mc_{}'.format(model.path, ii))
-        models.append(mc)
-        stim = moose.PulseGen('{}/stim_{}'.format(mc.path, ii))
-        stim.delay[0] = delay
-        stim.width[0] = dur
-        stim.level[0] = amp
-        stim.delay[1] = 1e9 # make delay so large that it does not activate again
-        for celltype in [SpinyStellate, DeepBasket, DeepLTS]:
-            cell = celltype('{}/{}_{}'.format(mc.path, celltype.__name__, ii))
-            solver = moose.HSolve('{}/solver'.format(cell.path))
-            solver.dt = simdt
-            solver.target = cell.path
-            stim.connect('output', cell.soma, 'injectMsg')
-            tab = moose.Table('/data/Vm_{}'.format(cell.name))
-            ddict[ii].append(tab)
-            tab.connect('requestOut', cell.soma, 'getVm')
-    mutils.setDefaultDt(elecdt=simdt, plotdt2=plotdt)
-    mutils.assignDefaultTicks(modelRoot='/model', dataRoot='/data', solver='hsolve')
-    moose.reinit()
-    print('Finished scheduling')
-    moose.start(delay + dur + trail)
-    print('Finished simulation')
-    # Save data
-    fd = h5.File(outfile, 'w')    
-    for ii, tabs in ddict.items():
-        for tab in tabs:
-            print('Table', tab.name)
-            node = fd.create_dataset(tab.name, data=tab.vector)
-            node.attrs['current'] = amps[ii]
-            node.attrs['delay'] = delay
-            node.attrs['width'] = dur
-    fd.close()
-    print('Finished saving data in file', outfile)
-
-
-if __name__ == '__main__':
-    run_current_pulse(amps)
-
-# 
-# dump_f_i_curves.py ends here
+# dump_f_i_curves.py --- 
+# 
+# Filename: dump_f_i_curves.py
+# Description: 
+# Author: Subhasis Ray
+# Maintainer: 
+# Created: Tue Dec  8 13:11:01 2015 (-0500)
+# Version: 
+# Package-Requires: ()
+# Last-Updated: Wed Dec  9 12:28:06 2015 (-0500)
+#           By: Subhasis Ray
+#     Update #: 79
+# URL: 
+# Doc URL: 
+# Keywords: 
+# Compatibility: 
+# 
+# 
+
+# Commentary: 
+# 
+# 
+# 
+# 
+
+# Change Log:
+# 
+# 
+# 
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or (at
+# your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+# 
+# 
+
+# Code:
+
+"""Do a series of current steps on each celltype"""
+
+import numpy as np
+import h5py as h5
+from collections import defaultdict
+
+import moose
+from moose import utils as mutils
+
+from cells import SpinyStellate
+from cells import DeepBasket
+from cells import DeepLTS
+
+
+simdt = 2.5e-6
+plotdt = 1e-4
+
+amps = np.array([-0.1, 0.1, 0.5, 1.0, 1.5])*1e-9
+
+def run_current_pulse(amps, delay=100e-3, dur=100e-3, trail=100e-3, outfile='f_i_curves_data.h5'):
+    models = []
+    model = moose.Neutral('/model')
+    data = moose.Neutral('/data')
+    ddict = defaultdict(list)
+    for ii, amp in enumerate(amps):
+        mc = moose.Neutral('{}/mc_{}'.format(model.path, ii))
+        models.append(mc)
+        stim = moose.PulseGen('{}/stim_{}'.format(mc.path, ii))
+        stim.delay[0] = delay
+        stim.width[0] = dur
+        stim.level[0] = amp
+        stim.delay[1] = 1e9 # make delay so large that it does not activate again
+        for celltype in [SpinyStellate, DeepBasket, DeepLTS]:
+            cell = celltype('{}/{}_{}'.format(mc.path, celltype.__name__, ii))
+            solver = moose.HSolve('{}/solver'.format(cell.path))
+            solver.dt = simdt
+            solver.target = cell.path
+            stim.connect('output', cell.soma, 'injectMsg')
+            tab = moose.Table('/data/Vm_{}'.format(cell.name))
+            ddict[ii].append(tab)
+            tab.connect('requestOut', cell.soma, 'getVm')
+    mutils.setDefaultDt(elecdt=simdt, plotdt2=plotdt)
+    mutils.assignDefaultTicks(modelRoot='/model', dataRoot='/data', solver='hsolve')
+    moose.reinit()
+    print('Finished scheduling')
+    moose.start(delay + dur + trail)
+    print('Finished simulation')
+    # Save data
+    fd = h5.File(outfile, 'w')    
+    for ii, tabs in list(ddict.items()):
+        for tab in tabs:
+            print(('Table', tab.name))
+            node = fd.create_dataset(tab.name, data=tab.vector)
+            node.attrs['current'] = amps[ii]
+            node.attrs['delay'] = delay
+            node.attrs['width'] = dur
+    fd.close()
+    print(('Finished saving data in file', outfile))
+
+
+if __name__ == '__main__':
+    run_current_pulse(amps)
+
+# 
+# dump_f_i_curves.py ends here
diff --git a/traub_2005/py/fig_a2_fs.py b/traub_2005/py/fig_a2_fs.py
index 625a6228..db7bd222 100644
--- a/traub_2005/py/fig_a2_fs.py
+++ b/traub_2005/py/fig_a2_fs.py
@@ -49,7 +49,7 @@ Reproduce the experiment for Fig A2 in Traub et al 2005.
 
 FS (deep basket cell) with 0.5 nA current pusle simulated for 1 s
 """
-from __future__ import print_function
+
 
 import numpy as np
 import pylab
diff --git a/traub_2005/py/fig_a3.py b/traub_2005/py/fig_a3.py
index 393ecaf1..dfeecea8 100644
--- a/traub_2005/py/fig_a3.py
+++ b/traub_2005/py/fig_a3.py
@@ -105,7 +105,7 @@ def main():
                    np.vstack((t, inject, vm)).transpose())
         msg = 'Saved data for %g A current pulse in %s' % (a, fname)
         config.logger.info(msg)
-        print( msg)
+        print(msg)
         pylab.subplot(3,1,ii+1)
         pylab.title('%g nA' % (a*1e9))
         pylab.plot(t, vm, label='soma-Vm (mV)')
diff --git a/traub_2005/py/gui.py b/traub_2005/py/gui.py
index c77e6800..9241c11f 100644
--- a/traub_2005/py/gui.py
+++ b/traub_2005/py/gui.py
@@ -48,7 +48,7 @@
 """
 Display channel properties graphically
 """
-from __future__ import print_function
+
 from datetime import datetime
 from PyQt4 import QtCore, QtGui
 from matplotlib import mlab
@@ -115,7 +115,7 @@ class HHChanView(QtGui.QWidget):
             self.channelListWidget = QtGui.QListWidget(self)
             self.channelListWidget.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection)
         root = str(self.rootEdit.text())
-        for chan in self.getChannels(root).values():
+        for chan in list(self.getChannels(root).values()):
             self.channelListWidget.addItem(chan.name)
         self.update()
         return self.channelListWidget
@@ -154,7 +154,9 @@ class HHChanView(QtGui.QWidget):
         self.mhaxes.set_title('Activation/Inactivation')
         self.tauaxes = self.figure.add_subplot(2, 1, 2)
         self.tauaxes.set_title('Tau')
+        print((self.channels))
         for item in self.getChannelListWidget().selectedItems():
+            print((item.text()))
             chan = self.channels[str(item.text())]
             if chan.Xpower > 0:
                 path = '{}/gateX'.format(chan.path)
@@ -194,6 +196,19 @@ class NetworkXWidget(QtGui.QWidget):
         if len(sizes) == 0:
             print('Empty graph for cell. Make sure proto file has `*asymmetric` on top. I cannot handle symmetric compartmental connections')
             return
+        weights = np.array([g.edge[e[0]][e[1]]['weight'] for e in g.edges()])
+        pos = nx.graphviz_layout(g, prog='twopi')
+        xmin, ymin, xmax, ymax = 1e9, 1e9, -1e9, -1e9
+        for p in list(pos.values()):
+            if xmin > p[0]:
+                xmin = p[0]
+            if xmax < p[0]:
+                xmax = p[0]
+            if ymin > p[1]:
+                ymin = p[1]
+            if ymax < p[1]:
+                ymax = p[1]        
+        edge_widths = 10.0 * weights / max(weights)
         node_colors = ['k' if x in axon else 'gray' for x in g.nodes()]
         lw = [1 if n.endswith('comp_1') else 0 for n in g.nodes()]
         self.axes.clear()
@@ -300,6 +315,7 @@ class CellView(QtGui.QWidget):
 
     def displayCellMorphology(self, cellpath):
         cell = moose.element(cellpath)
+        print('HERE')
         graph = cell_to_graph(cell)
         self.getCellMorphologyWidget().displayGraph(graph)
 
@@ -319,8 +335,11 @@ class CellView(QtGui.QWidget):
                                            [1e9, 0, 0]])
         # moose.le(model_container)
         # moose.le(data_container)
+        print('11111')
+        print((model_container.path, data_container.path))
         params['modelRoot'] = model_container.path
         params['dataRoot'] = data_container.path
+        print('here')
         return params
 
     def displaySelected(self):
@@ -386,7 +405,7 @@ class CellView(QtGui.QWidget):
         self.vmAxes.legend()
         self.plotCanvas.draw()
         td = np.mean(tdlist)
-        print('Simulating %g s took %g s of computer time' % (simtime, td))
+        print(('Simulating %g s took %g s of computer time' % (simtime, td)))
         # self.plotFigure.tight_layout()
 
     def getPlotWidget(self):
diff --git a/traub_2005/py/test_capool.py b/traub_2005/py/test_capool.py
index eee8ce6c..672b243f 100644
--- a/traub_2005/py/test_capool.py
+++ b/traub_2005/py/test_capool.py
@@ -28,7 +28,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 
 import uuid
 import numpy as np
@@ -78,21 +78,21 @@ def run_capool(poolname, Gbar, simtime):
     gk_file = 'data/%s_Gk.dat' % (poolname)
     ik_file = 'data/%s_Ik.dat' % (poolname)
     ca_file = 'data/%s_Ca.dat' % (poolname)
-    tseries = np.array(range(len(vm_data.vector))) * simdt
-    print('Vm:', len(vm_data.vector), 'Gk', len(gk_data.vector), 'Ik', len(ik_data.vector))
+    tseries = np.array(list(range(len(vm_data.vector)))) * simdt
+    print(('Vm:', len(vm_data.vector), 'Gk', len(gk_data.vector), 'Ik', len(ik_data.vector)))
     data = np.c_[tseries, vm_data.vector]
     np.savetxt(vm_file, data)
-    print('Saved Vm in', vm_file)
+    print(('Saved Vm in', vm_file))
     data = np.c_[tseries, gk_data.vector]
     np.savetxt(gk_file, data)
-    print('Saved Gk in', gk_file)
+    print(('Saved Gk in', gk_file))
     data = np.c_[tseries, ik_data.vector]
     np.savetxt(ik_file, data)
-    print('Saved Ik in', ik_file)
-    print('>>', len(ca_data.vector))
+    print(('Saved Ik in', ik_file))
+    print(('>>', len(ca_data.vector)))
     data = np.c_[tseries, ca_data.vector]
     np.savetxt(ca_file, data)
-    print('Saved [Ca2+] in', ca_file)
+    print(('Saved [Ca2+] in', ca_file))
     return params
     
 
@@ -103,7 +103,7 @@ class TestCaPool(ChannelTestBase):
     vm = np.array(params['Vm'].vector)
     gk = np.array(params['Gk'].vector)
     ca = np.array(params['Ca'].vector)
-    print(len(ca))
+    print(le(ca))
     tseries = np.arange(0, len(vm), 1.0) * simdt
     
     def testCaPool_Vm_Neuron(self):
diff --git a/traub_2005/py/test_kchans.py b/traub_2005/py/test_kchans.py
index 0eb5eddb..416e4a83 100644
--- a/traub_2005/py/test_kchans.py
+++ b/traub_2005/py/test_kchans.py
@@ -27,7 +27,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 
 import uuid
 import unittest
@@ -196,19 +196,19 @@ def run_cadep_channel(channelname, Gbar, simtime):
     gk_file = 'data/%s_Gk.dat' % (channelname)
     ik_file = 'data/%s_Ik.dat' % (channelname)
     ca_file = 'data/%s_Ca.dat' % (channelname)
-    tseries = np.array(range(len(vm_data.vector))) * simdt
-    print('Vm:', len(vm_data.vector), 'Gk', len(gk_data.vector), 'Ik', len(ik_data.vector))
+    tseries = np.array(list(range(len(vm_data.vector)))) * simdt
+    print(('Vm:', len(vm_data.vector), 'Gk', len(gk_data.vector), 'Ik', len(ik_data.vector)))
     data = np.c_[tseries, vm_data.vector]
     np.savetxt(vm_file, data)
-    print('Saved Vm in', vm_file)
+    print(('Saved Vm in', vm_file))
     data = np.c_[tseries, gk_data.vector]
     np.savetxt(gk_file, data)
-    print('Saved Gk in', gk_file)
+    print(('Saved Gk in', gk_file))
     data = np.c_[tseries, ik_data.vector]
     np.savetxt(ik_file, data)
-    print('Saved Ik in', ik_file)
+    print(('Saved Ik in', ik_file))
     np.savetxt(ca_file, data)
-    print('Saved [Ca2+] in', ca_file)
+    print(('Saved [Ca2+] in', ca_file))
     return params
 
         
diff --git a/traub_2005/py/test_nachans.py b/traub_2005/py/test_nachans.py
index b96eb1b6..e2c91e50 100644
--- a/traub_2005/py/test_nachans.py
+++ b/traub_2005/py/test_nachans.py
@@ -28,12 +28,12 @@
 # 
 
 # Code:
+
 from __future__ import print_function
 
 import os
 os.environ['NUMPTHREADS'] = '1'
 import sys
-sys.path.append('../../../python')
 import numpy as np
 import testutils
 from testutils import *
@@ -50,7 +50,7 @@ class TestNaF(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
 
     def testNaF_Vm_Moose(self):
         print('Testing MOOSE Vm  ...',)
@@ -65,7 +65,7 @@ class TestNaF(ChannelTestBase):
         print('OK')
 
     def testNaF_Vm_Neuron(self):
-        print('Testing NEURON Vm  ...', end='')
+        print('Testing NEURON Vm  ...', end=' ')
         data = np.c_[self.tseries, self.vm]
         err = compare_channel_data(data, self.channelname, 'Vm', 'neuron', x_range=(simtime/10.0, simtime))
         self.assertLess(err, 0.01)        
@@ -83,7 +83,7 @@ class TestNaF_TCR(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
     def testNaF_TCR_Vm_Moose(self):
         print('Testing MOOSE Vm  ...', end='')
         err = compare_channel_data(self.vm, TestNaF_TCR.channelname, 'Vm', 'moose', x_range=(simtime/10.0, simtime))
@@ -116,15 +116,15 @@ class TestNaF2(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
     def testNaF2_Vm_Moose(self):
-        print('Testing MOOSE Vm  ...', end='')
+        print('Testing MOOSE Vm  ...', end=' ')
         err = compare_channel_data(self.vm, TestNaF2.channelname, 'Vm', 'moose', x_range=(simtime/10.0, simtime))
         self.assertLess(err, 0.01)
-        print('OK', end='')
+        print('OK')
         
     def testNaF2_Gk_Moose(self):
-        print('Testing MOOSE Gk  ...', end='')
+        print('Testing MOOSE Gk  ...', end=' ')
         err = compare_channel_data(self.gk, TestNaF2.channelname, 'Gk', 'moose', x_range=(simtime/10.0, simtime))
         self.assertLess(err, 0.05)
         print('OK')
@@ -149,7 +149,7 @@ class TestNaF2_nRT(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
     def testNaF2_nRT_Vm_Moose(self):
         print('Testing MOOSE Vm  ...', end='')
         err = compare_channel_data(self.vm, TestNaF2_nRT.channelname, 'Vm', 'moose', x_range=(simtime/10.0, simtime))
@@ -181,7 +181,7 @@ class TestNaP(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
     def testNaP_Vm_Moose(self):
         print('Testing MOOSE Vm  ...', end='')
         err = compare_channel_data(self.vm, TestNaP.channelname, 'Vm', 'moose', x_range=(simtime/10.0, simtime))
@@ -214,7 +214,7 @@ class TestNaPF(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
     def testNaPF_Vm_Moose(self):
         print('Testing MOOSE Vm  ...', end='')
         err = compare_channel_data(self.vm, TestNaPF.channelname, 'Vm', 'moose', x_range=(simtime/10.0, simtime))
@@ -247,7 +247,7 @@ class TestNaPF_SS(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
     def testNaPF_SS_Vm_Moose(self):
         print('Testing MOOSE Vm  ...', end='')
         err = compare_channel_data(self.vm, TestNaPF_SS.channelname, 'Vm', 'moose', x_range=(simtime/10.0, simtime))
@@ -280,7 +280,7 @@ class TestNaPF_TCR(ChannelTestBase):
     params = run_single_channel(channelname, 1e-9, simtime)
     vm = np.asarray(params['Vm'].vector)        
     gk = np.asarray(params['Gk'].vector)
-    tseries = np.array(range(0, len(params['Vm'].vector))) * simdt
+    tseries = np.array(list(range(0, len(params['Vm'].vector)))) * simdt
     def testNaPF_TCR_Vm_Moose(self):
         print('Testing MOOSE Vm  ...', end='')
         err = compare_channel_data(self.vm, TestNaPF_TCR.channelname, 'Vm', 'moose', x_range=(simtime/10.0, simtime))
@@ -288,7 +288,7 @@ class TestNaPF_TCR(ChannelTestBase):
         print('OK')
         
     def testNaPF_TCR_Gk_Moose(self):
-        print('Testing MOOSE Gk  ...', end='')
+        print('Testing MOOSE Gk  ...', end=' ')
         err = compare_channel_data(self.gk, TestNaPF_TCR.channelname, 'Gk', 'moose', x_range=(simtime/10.0, simtime))
         self.assertLess(err, 0.05)
         print('OK')
diff --git a/traub_2005/py/test_singlecomp.py b/traub_2005/py/test_singlecomp.py
index decd56dd..3412806c 100644
--- a/traub_2005/py/test_singlecomp.py
+++ b/traub_2005/py/test_singlecomp.py
@@ -29,7 +29,7 @@
 #
 
 # Code:
-from __future__ import print_function
+
 
 import os
 os.environ['NUMPTHREADS'] = '1'
@@ -142,7 +142,7 @@ class TestSingleComp(unittest.TestCase):
         tab = moose.Table('%s/Vm' % (self.data.path))
         self.tables['Vm'] = tab
         moose.connect(tab, 'requestOut', self.soma, 'getVm')
-        for channelname, conductance in channel_density.items():
+        for channelname, conductance in list(channel_density.items()):
             chanclass = eval(channelname)
             channel = insert_channel(self.soma, chanclass, conductance, density=True)
             if issubclass(chanclass, KChannel):
@@ -189,8 +189,8 @@ class TestSingleComp(unittest.TestCase):
             nrndata = np.loadtxt('../nrn/data/singlecomp_Vm.dat')
             vm_axis.plot(nrndata[:,0], nrndata[:,1], label='Vm (mV) - nrn')
             ca_axis.plot(nrndata[:,0], nrndata[:,2], label='Ca (mM) - nrn')
-        except IOError, e:
-            print( e)
+        except IOError as e:
+            print(e)
         tseries = np.linspace(0, simtime, len(self.tables['Vm'].vector)) * 1e3
         # plotcount = len(channel_density) + 1
         # rows = int(np.sqrt(plotcount) + 0.5)
diff --git a/traub_2005/py/test_tcr.py b/traub_2005/py/test_tcr.py
index b148bf69..c6d1c499 100644
--- a/traub_2005/py/test_tcr.py
+++ b/traub_2005/py/test_tcr.py
@@ -28,7 +28,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 import unittest
 from cell_test_util import setup_current_step_model, SingleCellCurrentStepTest
 import testutils
@@ -80,9 +80,9 @@ class TestTCR(SingleCellCurrentStepTest):
         tab = moose.Table('%s/command' % (self.data_container.path))
         moose.connect(tab, 'requestOut', clamp, 'getCommand')
         for ii in moose.wildcardFind('/##[TYPE=VClamp]'):
-            print(ii.path)
+            print((ii.path))
         self.runsim(simtime)
-        print(tab, len(tab.vector))
+        print((tab, len(tab.vector)))
         pylab.plot(pylab.linspace(0, simtime, len(tab.vector)), tab.vector, 'kx')
         self.plot_vm()
 
diff --git a/traub_2005/py/testutils.py b/traub_2005/py/testutils.py
index b3d6b68e..d6dff454 100644
--- a/traub_2005/py/testutils.py
+++ b/traub_2005/py/testutils.py
@@ -28,7 +28,7 @@
 # 
 
 # Code:
-from __future__ import print_function
+
 
 import os
 os.environ['NUMPTHREADS'] = '1'
@@ -335,11 +335,11 @@ def compare_cell_dump(left, right, rtol=1e-3, atol=1e-8, row_header=True, col_he
     right_end = False
     while True:
         try:
-            left_row = left_reader.next()
+            left_row = next(left_reader)
         except StopIteration:
             left_end = True
         try:
-            right_row = right_reader.next()
+            right_row = next(right_reader)
         except StopIteration:
             right_end = True
         if left_end and not right_end:
@@ -359,11 +359,11 @@ def compare_cell_dump(left, right, rtol=1e-3, atol=1e-8, row_header=True, col_he
                 left = float(left_row[key])
                 right = float(right_row[key])
                 if not np.allclose(float(left), float(right), rtol=rtol, atol=atol):
-                    print( 'Mismatch in row:%s, column:%s. Values: %g <> %g' % (index, key, left, right))
+                    print(('Mismatch in row:%s, column:%s. Values: %g <> %g' % (index, key, left, right)))
                     ret = False
-            except ValueError, e:
-                print( e)
-                print( 'Row:', index, 'Key:', key, left_row[key], right_row[key])
+            except ValueError as e:
+                print(e)
+                print(('Row:', index, 'Key:', key, left_row[key], right_row[key]))
         index = index + 1
     return ret
 
diff --git a/traub_2005/py/trbconfig.py b/traub_2005/py/trbconfig.py
index 63814c31..134537e7 100644
--- a/traub_2005/py/trbconfig.py
+++ b/traub_2005/py/trbconfig.py
@@ -29,7 +29,7 @@
 # Code:
 
 from datetime import datetime
-import ConfigParser as configparser
+import configparser as configparser
 import logging
 import numpy
 import os
diff --git a/tutorials/ChemicalBistables/findSteadyState.py b/tutorials/ChemicalBistables/findSteadyState.py
index b53c94bd..21c545ce 100644
--- a/tutorials/ChemicalBistables/findSteadyState.py
+++ b/tutorials/ChemicalBistables/findSteadyState.py
@@ -50,73 +50,74 @@ import numpy
 import moose
 
 def displayPlots():
-		for x in moose.wildcardFind( '/model/graphs/conc#/#' ):
-			t = numpy.arange( 0, x.vector.size, 1 ) #sec
-			pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
+    for x in moose.wildcardFind( '/model/graphs/conc#/#' ):
+        t = numpy.arange( 0, x.vector.size, 1 ) #sec
+        pylab.plot( t, x.vector, label=x.name )
+    pylab.legend()
+    pylab.show()
 
 def getState( ksolve, state ):
-		state.randomInit()
-		moose.start( 0.1 ) # Run the model for 2 seconds.
-		state.settle()
-                '''
-		scale = 1.0 / ( 1e-15 * 6.022e23 )
-		for x in ksolve.nVec[0]:
-			print x * scale,
-		# print ksolve.nVec[0]
-		print state.nIter, state.status, state.stateType, state.nNegEigenvalues, state.nPosEigenvalues, state.solutionStatus
-                 '''
-		moose.start( 20.0 ) # Run model for 10 seconds, just for display
+    state.randomInit()
+    moose.start( 0.1 ) # Run the model for 2 seconds.
+    state.settle()
+
+    '''
+    scale = 1.0 / ( 1e-15 * 6.022e23 )
+    for x in ksolve.nVec[0]:
+            print x * scale,
+    # print ksolve.nVec[0]
+    print state.nIter, state.status, state.stateType, state.nNegEigenvalues, state.nPosEigenvalues, state.solutionStatus
+    '''
+    moose.start( 20.0 ) # Run model for 10 seconds, just for display
 
 
 def main():
-		# Schedule the whole lot
-		moose.setClock( 4, 0.1 ) # for the computational objects
-		moose.setClock( 5, 0.2 ) # clock for the solver
-		moose.setClock( 8, 1.0 ) # for the plots
-		# The wildcard uses # for single level, and ## for recursive.
-		#compartment = makeModel()
-                moose.loadModel( '../../genesis/M1719.g', '/model', 'ee' )
-                compartment = moose.element( 'model/kinetics' )
-                compartment.name = 'compartment'
-		ksolve = moose.Ksolve( '/model/compartment/ksolve' )
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = compartment
-		stoich.ksolve = ksolve
-		#ksolve.stoich = stoich
-		stoich.path = "/model/compartment/##"
-		state = moose.SteadyState( '/model/compartment/state' )
-		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
-		moose.useClock( 8, '/model/graphs/#', 'process' )
+    # Schedule the whole lot
+    moose.setClock( 4, 0.1 ) # for the computational objects
+    moose.setClock( 5, 0.2 ) # clock for the solver
+    moose.setClock( 8, 1.0 ) # for the plots
+    # The wildcard uses # for single level, and ## for recursive.
+    #compartment = makeModel()
+    moose.loadModel( '../../genesis/M1719.g', '/model', 'ee' )
+    compartment = moose.element( 'model/kinetics' )
+    compartment.name = 'compartment'
+    ksolve = moose.Ksolve( '/model/compartment/ksolve' )
+    stoich = moose.Stoich( '/model/compartment/stoich' )
+    stoich.compartment = compartment
+    stoich.ksolve = ksolve
+    #ksolve.stoich = stoich
+    stoich.path = "/model/compartment/##"
+    state = moose.SteadyState( '/model/compartment/state' )
+    moose.useClock( 5, '/model/compartment/ksolve', 'process' )
+    moose.useClock( 8, '/model/graphs/#', 'process' )
 
-		moose.reinit()
-		state.stoich = stoich
-		#state.showMatrices()
-		state.convergenceCriterion = 1e-7
+    moose.reinit()
+    state.stoich = stoich
+    #state.showMatrices()
+    state.convergenceCriterion = 1e-7
 
-		for i in range( 0, 50 ):
-			getState( ksolve, state )
-		
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+    for i in range( 0, 50 ):
+        getState( ksolve, state )
+    
+    moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		b = moose.element( '/model/compartment/b' )
-		c = moose.element( '/model/compartment/c' )
+    b = moose.element( '/model/compartment/b' )
+    c = moose.element( '/model/compartment/c' )
 
-		# move most molecules over to b
-		b.conc = b.conc + c.conc * 0.95
-		c.conc = c.conc * 0.05
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+    # move most molecules over to b
+    b.conc = b.conc + c.conc * 0.95
+    c.conc = c.conc * 0.05
+    moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# move most molecules back to a
-		c.conc = c.conc + b.conc * 0.95
-		b.conc = b.conc * 0.05
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+    # move most molecules back to a
+    c.conc = c.conc + b.conc * 0.95
+    b.conc = b.conc * 0.05
+    moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# Iterate through all plots, dump their contents to data.plot.
-		displayPlots()
+    # Iterate through all plots, dump their contents to data.plot.
+    displayPlots()
 
-		quit()
+    quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
diff --git a/tutorials/ChemicalBistables/mapkFB.py b/tutorials/ChemicalBistables/mapkFB.py
index 7770f407..36c3d0d4 100644
--- a/tutorials/ChemicalBistables/mapkFB.py
+++ b/tutorials/ChemicalBistables/mapkFB.py
@@ -13,6 +13,9 @@ import matplotlib.image as mpimg
 import pylab
 import numpy
 import sys
+import os
+
+scriptDir = os.path.dirname( os.path.realpath( __file__ ) )
 
 def main():
         """
@@ -34,37 +37,39 @@ def main():
         'turn off'
         by setting the system calcium levels to zero for a while. This
         is a somewhat unphysiological manipulation!
+
         """
+
         solver = "gsl"  # Pick any of gsl, gssa, ee..
         #solver = "gssa"  # Pick any of gsl, gssa, ee..
-	mfile = '../../genesis/acc35.g'
-	runtime = 2000.0
-	if ( len( sys.argv ) == 2 ):
-                solver = sys.argv[1]
-	modelId = moose.loadModel( mfile, 'model', solver )
+        mfile = os.path.join( scriptDir, '..', '..', 'genesis' , 'acc35.g' )
+        runtime = 2000.0
+        if ( len( sys.argv ) == 2 ):
+            solver = sys.argv[1]
+        modelId = moose.loadModel( mfile, 'model', solver )
         # Increase volume so that the stochastic solver gssa 
         # gives an interesting output
         compt = moose.element( '/model/kinetics' )
         compt.volume = 5e-19 
 
-	moose.reinit()
-	moose.start( 500 ) 
+        moose.reinit()
+        moose.start( 500 ) 
         moose.element( '/model/kinetics/PDGFR/PDGF' ).concInit = 0.0001
-	moose.start( 400 ) 
+        moose.start( 400 ) 
         moose.element( '/model/kinetics/PDGFR/PDGF' ).concInit = 0.0
-	moose.start( 2000 ) 
+        moose.start( 2000 ) 
         moose.element( '/model/kinetics/Ca' ).concInit = 0.0
-	moose.start( 500 ) 
+        moose.start( 500 ) 
         moose.element( '/model/kinetics/Ca' ).concInit = 0.00008
-	moose.start( 2000 ) 
+        moose.start( 2000 ) 
 
-	# Display all plots.
+        # Display all plots.
         img = mpimg.imread( 'mapkFB.png' )
         fig = plt.figure( figsize=(12, 10 ) )
         png = fig.add_subplot( 211 )
         imgplot = plt.imshow( img )
         ax = fig.add_subplot( 212 )
-	x = moose.wildcardFind( '/model/#graphs/conc#/#' )
+        x = moose.wildcardFind( '/model/#graphs/conc#/#' )
         t = numpy.arange( 0, x[0].vector.size, 1 ) * x[0].dt
         ax.plot( t, x[0].vector, 'b-', label=x[0].name )
         ax.plot( t, x[1].vector, 'c-', label=x[1].name )
@@ -77,4 +82,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/tutorials/ChemicalBistables/propagationBis.py b/tutorials/ChemicalBistables/propagationBis.py
index a4a5f9c6..add79df3 100644
--- a/tutorials/ChemicalBistables/propagationBis.py
+++ b/tutorials/ChemicalBistables/propagationBis.py
@@ -50,70 +50,70 @@ import matplotlib.image as mpimg
 import moose
 
 def makeModel():
-		# create container for model
-		r0 = 1e-6	# m
-		r1 = 0.5e-6	# m. Note taper.
-		num = 200
-		diffLength = 1e-6 # m
-		comptLength = num * diffLength	# m
-		diffConst = 20e-12 # m^2/sec
-		concA = 1 # millimolar
-		diffDt = 0.02  # for the diffusion
-		chemDt = 0.2   # for the reaction
+                # create container for model
+                r0 = 1e-6        # m
+                r1 = 0.5e-6        # m. Note taper.
+                num = 200
+                diffLength = 1e-6 # m
+                comptLength = num * diffLength        # m
+                diffConst = 20e-12 # m^2/sec
+                concA = 1 # millimolar
+                diffDt = 0.02  # for the diffusion
+                chemDt = 0.2   # for the reaction
                 mfile = '../../genesis/M1719.g'
 
-		model = moose.Neutral( 'model' )
-		compartment = moose.CylMesh( '/model/kinetics' )
+                model = moose.Neutral( 'model' )
+                compartment = moose.CylMesh( '/model/kinetics' )
 
-		# load in model
+                # load in model
                 modelId = moose.loadModel( mfile, '/model', 'ee' )
-		a = moose.element( '/model/kinetics/a' )
-		b = moose.element( '/model/kinetics/b' )
-		c = moose.element( '/model/kinetics/c' )
+                a = moose.element( '/model/kinetics/a' )
+                b = moose.element( '/model/kinetics/b' )
+                c = moose.element( '/model/kinetics/c' )
 
                 ac = a.concInit
                 bc = b.concInit
                 cc = c.concInit
 
-		compartment.r0 = r0
-		compartment.r1 = r1
-		compartment.x0 = 0
-		compartment.x1 = comptLength
-		compartment.diffLength = diffLength
-		assert( compartment.numDiffCompts == num )
+                compartment.r0 = r0
+                compartment.r1 = r1
+                compartment.x0 = 0
+                compartment.x1 = comptLength
+                compartment.diffLength = diffLength
+                assert( compartment.numDiffCompts == num )
 
-		# Assign parameters
+                # Assign parameters
                 for x in moose.wildcardFind( '/model/kinetics/##[ISA=PoolBase]' ):
                     #print 'pools: ', x, x.name
                     x.diffConst = diffConst
 
-		# Make solvers
-		ksolve = moose.Ksolve( '/model/kinetics/ksolve' )
-		dsolve = moose.Dsolve( '/model/dsolve' )
+                # Make solvers
+                ksolve = moose.Ksolve( '/model/kinetics/ksolve' )
+                dsolve = moose.Dsolve( '/model/dsolve' )
                 # Set up clocks.
-		moose.setClock( 10, diffDt )
+                moose.setClock( 10, diffDt )
                 for i in range( 11, 17 ):
-		    moose.setClock( i, chemDt )
-
-		stoich = moose.Stoich( '/model/kinetics/stoich' )
-		stoich.compartment = compartment
-		stoich.ksolve = ksolve
-		stoich.dsolve = dsolve
-		stoich.path = "/model/kinetics/##"
-                print 'dsolve.numPools, num = ', dsolve.numPools, num
+                    moose.setClock( i, chemDt )
+
+                stoich = moose.Stoich( '/model/kinetics/stoich' )
+                stoich.compartment = compartment
+                stoich.ksolve = ksolve
+                stoich.dsolve = dsolve
+                stoich.path = "/model/kinetics/##"
+                print(('dsolve.numPools, num = ', dsolve.numPools, num))
                 b.vec[num-1].concInit *= 1.01 # Break symmetry.
 
 def main():
                 runtime = 100
                 displayInterval = 2
-		makeModel()
-		dsolve = moose.element( '/model/dsolve' )
-		moose.reinit()
-		#moose.start( runtime ) # Run the model for 10 seconds.
+                makeModel()
+                dsolve = moose.element( '/model/dsolve' )
+                moose.reinit()
+                #moose.start( runtime ) # Run the model for 10 seconds.
 
-		a = moose.element( '/model/kinetics/a' )
-		b = moose.element( '/model/kinetics/b' )
-		c = moose.element( '/model/kinetics/c' )
+                a = moose.element( '/model/kinetics/a' )
+                b = moose.element( '/model/kinetics/b' )
+                c = moose.element( '/model/kinetics/c' )
 
                 img = mpimg.imread( 'propBis.png' )
                 #imgplot = plt.imshow( img )
@@ -143,7 +143,7 @@ def main():
                     timeLabel.set_text( "time = %d" % t )
                     fig.canvas.draw()
 
-                print 'Swapping concs of b and c in half the cylinder'
+                print('Swapping concs of b and c in half the cylinder')
                 for i in range( b.numData/2 ):
                     temp = b.vec[i].conc
                     b.vec[i].conc = c.vec[i].conc
@@ -159,10 +159,10 @@ def main():
                     fig.canvas.draw()
 
                 print( "Hit 'enter' to exit" )
-                raw_input()
+                eval(input())
 
 
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/tutorials/ChemicalBistables/scaleVolumes.py b/tutorials/ChemicalBistables/scaleVolumes.py
index dec21247..ca9e8ce6 100644
--- a/tutorials/ChemicalBistables/scaleVolumes.py
+++ b/tutorials/ChemicalBistables/scaleVolumes.py
@@ -126,7 +126,7 @@ def main():
     for vol in ( 1e-19, 1e-20, 1e-21, 3e-22, 1e-22, 3e-23, 1e-23 ):
         # Set the volume
         compt.volume = vol
-        print 'vol = ', vol, ', a.concInit = ', a.concInit, ', a.nInit = ', a.nInit
+        print(('vol = ', vol, ', a.concInit = ', a.concInit, ', a.nInit = ', a.nInit))
 
         moose.reinit()
         moose.start( 100.0 ) # Run the model for 100 seconds.
@@ -147,8 +147,8 @@ def main():
         # Iterate through all plots, dump their contents to data.plot.
         displayPlots()
         pylab.show( block=False )
-        print 'vol = ', vol, 'hit enter to go to next plot'
-        raw_input()
+        print(('vol = ', vol, 'hit enter to go to next plot'))
+        eval(input())
 
     quit()
 
diff --git a/tutorials/ChemicalBistables/simpleBis.py b/tutorials/ChemicalBistables/simpleBis.py
index 346f0a4b..34e2510a 100644
--- a/tutorials/ChemicalBistables/simpleBis.py
+++ b/tutorials/ChemicalBistables/simpleBis.py
@@ -25,116 +25,116 @@ import moose
 import sys
 
 def makeModel():
-		# create container for model
-		model = moose.Neutral( 'model' )
-		compartment = moose.CubeMesh( '/model/compartment' )
-		compartment.volume = 1e-21
-		# the mesh is created automatically by the compartment
-		mesh = moose.element( '/model/compartment/mesh' ) 
-
-		# create molecules and reactions
-		a = moose.Pool( '/model/compartment/a' )
-		b = moose.Pool( '/model/compartment/b' )
-		c = moose.Pool( '/model/compartment/c' )
-		enz1 = moose.Enz( '/model/compartment/b/enz1' )
-		enz2 = moose.Enz( '/model/compartment/c/enz2' )
-		cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
-		cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
-		reac = moose.Reac( '/model/compartment/reac' )
-
-		# connect them up for reactions
-		moose.connect( enz1, 'sub', a, 'reac' )
-		moose.connect( enz1, 'prd', b, 'reac' )
-		moose.connect( enz1, 'enz', b, 'reac' )
-		moose.connect( enz1, 'cplx', cplx1, 'reac' )
-
-		moose.connect( enz2, 'sub', b, 'reac' )
-		moose.connect( enz2, 'prd', a, 'reac' )
-		moose.connect( enz2, 'enz', c, 'reac' )
-		moose.connect( enz2, 'cplx', cplx2, 'reac' )
-
-		moose.connect( reac, 'sub', a, 'reac' )
-		moose.connect( reac, 'prd', b, 'reac' )
-
-		# connect them up to the compartment for volumes
-		#for x in ( a, b, c, cplx1, cplx2 ):
-		#			moose.connect( x, 'mesh', mesh, 'mesh' )
-
-		# Assign parameters
-		a.concInit = 1
-		b.concInit = 0
-		c.concInit = 0.01
-		enz1.kcat = 0.4
-		enz1.Km = 4
-		enz2.kcat = 0.6
-		enz2.Km = 0.01
-		reac.Kf = 0.001
-		reac.Kb = 0.01
-
-		# Create the output tables
-		graphs = moose.Neutral( '/model/graphs' )
-		outputA = moose.Table ( '/model/graphs/concA' )
-		outputB = moose.Table ( '/model/graphs/concB' )
-
-		# connect up the tables
-		moose.connect( outputA, 'requestOut', a, 'getConc' );
-		moose.connect( outputB, 'requestOut', b, 'getConc' );
-
-		# Schedule the whole lot
-		moose.setClock( 4, 0.01 ) # for the computational objects
-		moose.setClock( 8, 1.0 ) # for the plots
-		# The wildcard uses # for single level, and ## for recursive.
-		moose.useClock( 4, '/model/compartment/##', 'process' )
-		moose.useClock( 8, '/model/graphs/#', 'process' )
+                # create container for model
+                model = moose.Neutral( 'model' )
+                compartment = moose.CubeMesh( '/model/compartment' )
+                compartment.volume = 1e-21
+                # the mesh is created automatically by the compartment
+                mesh = moose.element( '/model/compartment/mesh' ) 
+
+                # create molecules and reactions
+                a = moose.Pool( '/model/compartment/a' )
+                b = moose.Pool( '/model/compartment/b' )
+                c = moose.Pool( '/model/compartment/c' )
+                enz1 = moose.Enz( '/model/compartment/b/enz1' )
+                enz2 = moose.Enz( '/model/compartment/c/enz2' )
+                cplx1 = moose.Pool( '/model/compartment/b/enz1/cplx' )
+                cplx2 = moose.Pool( '/model/compartment/c/enz2/cplx' )
+                reac = moose.Reac( '/model/compartment/reac' )
+
+                # connect them up for reactions
+                moose.connect( enz1, 'sub', a, 'reac' )
+                moose.connect( enz1, 'prd', b, 'reac' )
+                moose.connect( enz1, 'enz', b, 'reac' )
+                moose.connect( enz1, 'cplx', cplx1, 'reac' )
+
+                moose.connect( enz2, 'sub', b, 'reac' )
+                moose.connect( enz2, 'prd', a, 'reac' )
+                moose.connect( enz2, 'enz', c, 'reac' )
+                moose.connect( enz2, 'cplx', cplx2, 'reac' )
+
+                moose.connect( reac, 'sub', a, 'reac' )
+                moose.connect( reac, 'prd', b, 'reac' )
+
+                # connect them up to the compartment for volumes
+                #for x in ( a, b, c, cplx1, cplx2 ):
+                #                        moose.connect( x, 'mesh', mesh, 'mesh' )
+
+                # Assign parameters
+                a.concInit = 1
+                b.concInit = 0
+                c.concInit = 0.01
+                enz1.kcat = 0.4
+                enz1.Km = 4
+                enz2.kcat = 0.6
+                enz2.Km = 0.01
+                reac.Kf = 0.001
+                reac.Kb = 0.01
+
+                # Create the output tables
+                graphs = moose.Neutral( '/model/graphs' )
+                outputA = moose.Table ( '/model/graphs/concA' )
+                outputB = moose.Table ( '/model/graphs/concB' )
+
+                # connect up the tables
+                moose.connect( outputA, 'requestOut', a, 'getConc' );
+                moose.connect( outputB, 'requestOut', b, 'getConc' );
+
+                # Schedule the whole lot
+                moose.setClock( 4, 0.01 ) # for the computational objects
+                moose.setClock( 8, 1.0 ) # for the plots
+                # The wildcard uses # for single level, and ## for recursive.
+                moose.useClock( 4, '/model/compartment/##', 'process' )
+                moose.useClock( 8, '/model/graphs/#', 'process' )
 
 def displayPlots():
-		for x in moose.wildcardFind( '/model/graphs/conc#' ):
-				t = numpy.arange( 0, x.vector.size, 1 ) #sec
-				pylab.plot( t, x.vector, label=x.name )
-		pylab.legend()
-		pylab.show()
+                for x in moose.wildcardFind( '/model/graphs/conc#' ):
+                                t = numpy.arange( 0, x.vector.size, 1 ) #sec
+                                pylab.plot( t, x.vector, label=x.name )
+                pylab.legend()
+                pylab.show()
 
 def main():
                 solver = "gsl"
-		makeModel()
+                makeModel()
                 if ( len ( sys.argv ) == 2 ):
                     solver = sys.argv[1]
-		stoich = moose.Stoich( '/model/compartment/stoich' )
-		stoich.compartment = moose.element( '/model/compartment' )
+                stoich = moose.Stoich( '/model/compartment/stoich' )
+                stoich.compartment = moose.element( '/model/compartment' )
                 if ( solver == 'gssa' ):
-		    gsolve = moose.Gsolve( '/model/compartment/ksolve' )
-		    stoich.ksolve = gsolve
+                    gsolve = moose.Gsolve( '/model/compartment/ksolve' )
+                    stoich.ksolve = gsolve
                 else:
-		    ksolve = moose.Ksolve( '/model/compartment/ksolve' )
-		    stoich.ksolve = ksolve
-		stoich.path = "/model/compartment/##"
-		#solver.method = "rk5"
-		#mesh = moose.element( "/model/compartment/mesh" )
-		#moose.connect( mesh, "remesh", solver, "remesh" )
-		moose.setClock( 5, 1.0 ) # clock for the solver
-		moose.useClock( 5, '/model/compartment/ksolve', 'process' )
+                    ksolve = moose.Ksolve( '/model/compartment/ksolve' )
+                    stoich.ksolve = ksolve
+                stoich.path = "/model/compartment/##"
+                #solver.method = "rk5"
+                #mesh = moose.element( "/model/compartment/mesh" )
+                #moose.connect( mesh, "remesh", solver, "remesh" )
+                moose.setClock( 5, 1.0 ) # clock for the solver
+                moose.useClock( 5, '/model/compartment/ksolve', 'process' )
 
-		moose.reinit()
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                moose.reinit()
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		a = moose.element( '/model/compartment/a' )
-		b = moose.element( '/model/compartment/b' )
+                a = moose.element( '/model/compartment/a' )
+                b = moose.element( '/model/compartment/b' )
 
-		# move most molecules over to b
-		b.conc = b.conc + a.conc * 0.9
-		a.conc = a.conc * 0.1
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                # move most molecules over to b
+                b.conc = b.conc + a.conc * 0.9
+                a.conc = a.conc * 0.1
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# move most molecules back to a
-		a.conc = a.conc + b.conc * 0.99
-		b.conc = b.conc * 0.01
-		moose.start( 100.0 ) # Run the model for 100 seconds.
+                # move most molecules back to a
+                a.conc = a.conc + b.conc * 0.99
+                b.conc = b.conc * 0.01
+                moose.start( 100.0 ) # Run the model for 100 seconds.
 
-		# Iterate through all plots, dump their contents to data.plot.
-		displayPlots()
+                # Iterate through all plots, dump their contents to data.plot.
+                displayPlots()
 
-		quit()
+                quit()
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/tutorials/ChemicalBistables/strongBis.py b/tutorials/ChemicalBistables/strongBis.py
index db7299f7..04d234bb 100644
--- a/tutorials/ChemicalBistables/strongBis.py
+++ b/tutorials/ChemicalBistables/strongBis.py
@@ -15,66 +15,66 @@ import numpy
 import sys
 
 def main():
-	"""
-	This example illustrates loading, and running a kinetic model 
-	for a bistable system, defined in kkit format. 
-	Defaults to the deterministic gsl method, you can pick the 
-	stochastic one by 
+        """
+        This example illustrates loading, and running a kinetic model 
+        for a bistable system, defined in kkit format. 
+        Defaults to the deterministic gsl method, you can pick the 
+        stochastic one by 
 
-	    ``python filename gssa``
+            ``python filename gssa``
 
-	The model starts out equally poised between sides **b** and **c**. 
-	Then there is a small molecular 'tap' to push it over to **b**.
-	Then we apply a moderate push to show that it is now very stably in
-	this state. it takes a strong push to take it over to **c**.
-	Then it takes a strong push to take it back to **b**.
-	This is a good model to use as the basis for running stochastically
-	and examining how state stability is affected by changing volume.
-	"""
+        The model starts out equally poised between sides **b** and **c**. 
+        Then there is a small molecular 'tap' to push it over to **b**.
+        Then we apply a moderate push to show that it is now very stably in
+        this state. it takes a strong push to take it over to **c**.
+        Then it takes a strong push to take it back to **b**.
+        This is a good model to use as the basis for running stochastically
+        and examining how state stability is affected by changing volume.
+        """
 
-	solver = "gsl"  # Pick any of gsl, gssa, ee..
-	#solver = "gssa"  # Pick any of gsl, gssa, ee..
-	#moose.seed( 1234 ) # Needed if stochastic.
-	mfile = '../../genesis/M1719.g'
-	runtime = 100.0
-	if ( len( sys.argv ) >= 2 ):
+        solver = "gsl"  # Pick any of gsl, gssa, ee..
+        #solver = "gssa"  # Pick any of gsl, gssa, ee..
+        #moose.seed( 1234 ) # Needed if stochastic.
+        mfile = '../../genesis/M1719.g'
+        runtime = 100.0
+        if ( len( sys.argv ) >= 2 ):
                 solver = sys.argv[1]
-	modelId = moose.loadModel( mfile, 'model', solver )
+        modelId = moose.loadModel( mfile, 'model', solver )
         # Increase volume so that the stochastic solver gssa 
         # gives an interesting output
         compt = moose.element( '/model/kinetics' )
         compt.volume = 0.2e-19 
         r = moose.element( '/model/kinetics/equil' )
 
-	moose.reinit()
-	moose.start( runtime ) 
+        moose.reinit()
+        moose.start( runtime ) 
         r.Kf *= 1.1 # small tap to break symmetry
-	moose.start( runtime/10 ) 
+        moose.start( runtime/10 ) 
         r.Kf = r.Kb
-	moose.start( runtime ) 
+        moose.start( runtime ) 
 
         r.Kb *= 2.0 # Moderate push does not tip it back.
-	moose.start( runtime/10 ) 
+        moose.start( runtime/10 ) 
         r.Kb = r.Kf
-	moose.start( runtime ) 
+        moose.start( runtime ) 
 
         r.Kb *= 5.0 # Strong push does tip it over
-	moose.start( runtime/10 ) 
+        moose.start( runtime/10 ) 
         r.Kb = r.Kf
-	moose.start( runtime ) 
+        moose.start( runtime ) 
         r.Kf *= 5.0 # Strong push tips it back.
-	moose.start( runtime/10 ) 
+        moose.start( runtime/10 ) 
         r.Kf = r.Kb
-	moose.start( runtime ) 
+        moose.start( runtime ) 
 
 
-	# Display all plots.
+        # Display all plots.
         img = mpimg.imread( 'strongBis.png' )
         fig = plt.figure( figsize=(12, 10 ) )
         png = fig.add_subplot( 211 )
         imgplot = plt.imshow( img )
         ax = fig.add_subplot( 212 )
-	x = moose.wildcardFind( '/model/#graphs/conc#/#' )
+        x = moose.wildcardFind( '/model/#graphs/conc#/#' )
         dt = moose.element( '/clock' ).tickDt[18]
         t = numpy.arange( 0, x[0].vector.size, 1 ) * dt
         ax.plot( t, x[0].vector, 'r-', label=x[0].name )
@@ -87,4 +87,4 @@ def main():
 
 # Run the 'main' if this script is executed standalone.
 if __name__ == '__main__':
-	main()
+        main()
diff --git a/tutorials/ChemicalOscillators/TuringOneDim.py b/tutorials/ChemicalOscillators/TuringOneDim.py
index 1860ceea..4a202a63 100644
--- a/tutorials/ChemicalOscillators/TuringOneDim.py
+++ b/tutorials/ChemicalOscillators/TuringOneDim.py
@@ -160,7 +160,7 @@ def main():
         fig.canvas.draw()
 
     print( "Hit 'enter' to exit" )
-    raw_input()
+    eval(input())
 
 
 
diff --git a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000.py b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000.py
index b5ea3f10..14a20558 100644
--- a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000.py
+++ b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -159,11 +159,11 @@ class ExcInhNetBase:
         t1 = time.time()
         print('reinit MOOSE')
         moose.reinit()
-        print('reinit time t = ', time.time() - t1)
+        print(('reinit time t = ', time.time() - t1))
         t1 = time.time()
         print('starting')
         moose.start(self.simtime)
-        print('runtime, t = ', time.time() - t1)
+        print(('runtime, t = ', time.time() - t1))
 
         if plotif:
             self._plot()
diff --git a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian.py b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian.py
index 7cc9062c..c67de7b3 100644
--- a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian.py
+++ b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 '''
 The LIF network is based on:
 Ostojic, S. (2014).
@@ -107,12 +107,12 @@ con_i = Synapses(Pi,neurons,'',pre='v_post+=-g*J',clock=clocksyn)
 random.seed(100) # set seed for reproducibility of simulations
 for i in range(0,N):
     ## draw excC number of neuron indices out of NmaxExc neurons
-    preIdxs = random.sample(range(NE),excC)
+    preIdxs = random.sample(list(range(NE)),excC)
     ## connect these presynaptically to i-th post-synaptic neuron
     for synnum,preIdx in enumerate(preIdxs):
         con_e[preIdx,i]=True
     ## draw inhC=C-excC number of neuron indices out of inhibitory neurons
-    preIdxs = random.sample(range(N-NE),C-excC)
+    preIdxs = random.sample(list(range(N-NE)),C-excC)
     ## connect these presynaptically to i-th post-synaptic neuron
     for synnum,preIdx in enumerate(preIdxs):
         con_i[preIdx,i]=True
@@ -135,21 +135,21 @@ popm_e = PopulationRateMonitor(Pe,bin=1.*ms)
 popm_i = PopulationRateMonitor(Pi,bin=1.*ms)
 
 # voltage monitor
-sm_e_vm = StateMonitor(Pe,'v',record=range(10),clock=clocknrn)
+sm_e_vm = StateMonitor(Pe,'v',record=list(range(10)),clock=clocknrn)
 
 # ###########################################
 # Simulate
 # ###########################################
 
-print "Setup complete, running for",simtime,"at dt =",dt,"s."
+print(("Setup complete, running for",simtime,"at dt =",dt,"s."))
 t1 = time.time()
 run(simtime,report='text')
-print 'inittime + runtime, t = ', time.time() - t1
+print(('inittime + runtime, t = ', time.time() - t1))
 
-print "For g,J =",g,J,"mean exc rate =",\
-    sm_e.nspikes/float(Nmon_exc)/(simtime/second),'Hz.'
-print "For g,J =",g,J,"mean inh rate =",\
-    sm_i.nspikes/float(Nmon-Nmon_exc)/(simtime/second),'Hz.'
+print(("For g,J =",g,J,"mean exc rate =",\
+    sm_e.nspikes/float(Nmon_exc)/(simtime/second),'Hz.'))
+print(("For g,J =",g,J,"mean inh rate =",\
+    sm_i.nspikes/float(Nmon-Nmon_exc)/(simtime/second),'Hz.'))
 
 # ###########################################
 # Analysis functions
diff --git a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2.py b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2.py
index 1b66c617..8f854a6d 100644
--- a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2.py
+++ b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 '''
 The LIF network is based on:
 Ostojic, S. (2014).
@@ -107,9 +107,9 @@ conn_i = []
 conn_j = []
 for j in range(0,N):
     ## draw excC number of neuron indices out of NmaxExc neurons
-    preIdxsE = random.sample(range(NE),excC)
+    preIdxsE = random.sample(list(range(NE)),excC)
     ## draw inhC=C-excC number of neuron indices out of inhibitory neurons
-    preIdxsI = random.sample(range(NE,N),C-excC)
+    preIdxsI = random.sample(list(range(NE,N)),C-excC)
     ## connect these presynaptically to i-th post-synaptic neuron
     ## choose the synapses object based on whether post-syn nrn is exc or inh
     conn_i += preIdxsE
@@ -132,17 +132,17 @@ sm = SpikeMonitor(P)
 popm = PopulationRateMonitor(P)
 
 # voltage monitor
-sm_vm = StateMonitor(P,'v',record=range(10)+range(NE,NE+10))
+sm_vm = StateMonitor(P,'v',record=list(range(10))+list(range(NE,NE+10)))
 
 # ###########################################
 # Simulate
 # ###########################################
 
-print "Setup complete, running for",simtime,"at dt =",dt,"s."
+print(("Setup complete, running for",simtime,"at dt =",dt,"s."))
 t1 = time.time()
 run(simtime,report='text')
 device.build(directory='output', compile=True, run=True, debug=False)
-print 'inittime + runtime, t = ', time.time() - t1
+print(('inittime + runtime, t = ', time.time() - t1))
 
 #print "For g,J =",g,J,"mean exc rate =",\
 #    sm_e.num_spikes/float(NE)/(simtime/second),'Hz.'
@@ -201,7 +201,7 @@ title(str(N)+" exc & inh neurons")
 xlim([0,simtime/second])
 xlabel("")
 
-print "plotting firing rates"
+print("plotting firing rates")
 subplot(232)
 # firing rates
 timeseries = arange(0,simtime/second+dt,dt)
@@ -227,7 +227,7 @@ ylim(0,300)
 xlabel("Time (s)")
 ylabel("Hz")
 
-print "plotting pop firing rates"
+print("plotting pop firing rates")
 # Population firing rates
 subplot(233)
 timeseries = arange(0,simtime/second,dt)
diff --git a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2_slow_2pops_4syns.py b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2_slow_2pops_4syns.py
index 8e1dcdb4..dccfd6f5 100644
--- a/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2_slow_2pops_4syns.py
+++ b/tutorials/ExcInhNet/ExcInhNet_Ostojic2014_Brunel2000_brian2_slow_2pops_4syns.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 '''
 The LIF network is based on:
 Ostojic, S. (2014).
@@ -108,13 +108,13 @@ con_ii = Synapses(Pi,Pi,'',pre='v_post+=-g*J')
 #con_i.connect_random(sparseness=sparseness_i)
 ## Connections from some Exc/Inh neurons to each neuron
 random.seed(100) # set seed for reproducibility of simulations
-print "Creating connections (very slow, use the optimized script)"
+print("Creating connections (very slow, use the optimized script)")
 for i in range(0,N):
-    if i%100==0: print "Connecting post syn nrn",i
+    if i%100==0: print(("Connecting post syn nrn",i))
     ## draw excC number of neuron indices out of NmaxExc neurons
-    preIdxsE = random.sample(range(NE),excC)
+    preIdxsE = random.sample(list(range(NE)),excC)
     ## draw inhC=C-excC number of neuron indices out of inhibitory neurons
-    preIdxsI = random.sample(range(N-NE),C-excC)
+    preIdxsI = random.sample(list(range(N-NE)),C-excC)
     ## connect these presynaptically to i-th post-synaptic neuron
     ## choose the synapses object based on whether post-syn nrn is exc or inh
     if i<NE:
@@ -141,21 +141,21 @@ popm_e = PopulationRateMonitor(Pe)
 popm_i = PopulationRateMonitor(Pi)
 
 # voltage monitor
-sm_e_vm = StateMonitor(Pe,'v',record=range(10))
+sm_e_vm = StateMonitor(Pe,'v',record=list(range(10)))
 
 # ###########################################
 # Simulate
 # ###########################################
 
-print "Setup complete, running for",simtime,"at dt =",dt,"s."
+print(("Setup complete, running for",simtime,"at dt =",dt,"s."))
 t1 = time.time()
 run(simtime,report='text')
-print 'inittime + runtime, t = ', time.time() - t1
+print(('inittime + runtime, t = ', time.time() - t1))
 
-print "For g,J =",g,J,"mean exc rate =",\
-    sm_e.num_spikes/float(NE)/(simtime/second),'Hz.'
-print "For g,J =",g,J,"mean inh rate =",\
-    sm_i.num_spikes/float(NI)/(simtime/second),'Hz.'
+print(("For g,J =",g,J,"mean exc rate =",\
+    sm_e.num_spikes/float(NE)/(simtime/second),'Hz.'))
+print(("For g,J =",g,J,"mean inh rate =",\
+    sm_i.num_spikes/float(NI)/(simtime/second),'Hz.'))
 
 # ###########################################
 # Analysis functions
@@ -214,7 +214,7 @@ xlim([0,simtime/second])
 title(str(NI)+" inh neurons")
 subplot(232)
 
-print "plotting firing rates"
+print("plotting firing rates")
 # firing rates
 timeseries = arange(0,simtime/second+dt,dt)
 num_to_plot = 10
@@ -239,7 +239,7 @@ ylim(0,300)
 xlabel("Time (s)")
 ylabel("Hz")
 
-print "plotting pop firing rates"
+print("plotting pop firing rates")
 # Population firing rates
 subplot(233)
 timeseries = arange(0,simtime/second,dt)
diff --git a/tutorials/ExcInhNetCaPlasticity/ExcInhNet_HigginsGraupnerBrunel2014.py b/tutorials/ExcInhNetCaPlasticity/ExcInhNet_HigginsGraupnerBrunel2014.py
index 760771e1..1340067d 100644
--- a/tutorials/ExcInhNetCaPlasticity/ExcInhNet_HigginsGraupnerBrunel2014.py
+++ b/tutorials/ExcInhNetCaPlasticity/ExcInhNet_HigginsGraupnerBrunel2014.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 #/**********************************************************************
 #** This program is part of 'MOOSE', the
 #** Messaging Object Oriented Simulation Environment.
@@ -241,11 +241,11 @@ class ExcInhNetBase:
         t1 = time.time()
         print('reinit MOOSE -- takes a while ~20s.')
         moose.reinit()
-        print('reinit time t = ', time.time() - t1)
+        print(('reinit time t = ', time.time() - t1))
         t1 = time.time()
         print('starting run ...')
         moose.start(self.simtime)
-        print('runtime, t = ', time.time() - t1)
+        print(('runtime, t = ', time.time() - t1))
 
         if plotif:
             self._plot()
diff --git a/tutorials/Rdesigneur/cells/CA1.morph.xml.REMOVED.git-id b/tutorials/Rdesigneur/cells/CA1.morph.xml.REMOVED.git-id
deleted file mode 100644
index b422b192..00000000
--- a/tutorials/Rdesigneur/cells/CA1.morph.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-dcae7ae96b2922a1e00f701d1ddbb26c114ae5d9
\ No newline at end of file
diff --git a/tutorials/Rdesigneur/chans/CA1.morph.xml.REMOVED.git-id b/tutorials/Rdesigneur/chans/CA1.morph.xml.REMOVED.git-id
deleted file mode 100644
index be0ea2fb..00000000
--- a/tutorials/Rdesigneur/chans/CA1.morph.xml.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-2a3815b394f8bcb4b6450081d9ba45d20abdf3cf
\ No newline at end of file
diff --git a/tutorials/Rdesigneur/rdes_ex3.2.py b/tutorials/Rdesigneur/rdes_ex3.2.py
index fc453ebd..e91f7898 100644
--- a/tutorials/Rdesigneur/rdes_ex3.2.py
+++ b/tutorials/Rdesigneur/rdes_ex3.2.py
@@ -62,7 +62,7 @@ rdes = rd.rdesigneur(
 rdes.buildModel()
 
 for i in moose.wildcardFind( "/model/elec/#/Na" ):
-    print i.parent.name, i.Gbar
+    print(i.parent.name, i.Gbar)
 
 moose.reinit()
 
diff --git a/unsorted/ksolve_with_heavy_load.py b/unsorted/ksolve_with_heavy_load.py
index f7bbd62c..5eff870e 100644
--- a/unsorted/ksolve_with_heavy_load.py
+++ b/unsorted/ksolve_with_heavy_load.py
@@ -35,7 +35,7 @@ def add_table(elem):
 
 def plot( numPlots ):
     global records_ 
-    toPlots = records_.keys()[0:numPlots]
+    toPlots = list(records_.keys())[0:numPlots]
     newPlots = {}
     for i in toPlots:
         newPlots[i] = records_[i]
diff --git a/util/moogli_viewer.py b/util/moogli_viewer.py
index 7d123edd..ec1b71cc 100644
--- a/util/moogli_viewer.py
+++ b/util/moogli_viewer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+
 # -*- coding: utf-8 -*-
 
 """
@@ -38,12 +38,12 @@ class MorphologyEditor(moogli.MorphologyViewer):
         self._timer = QtCore.QTimer(self)
 
     def start(self):
-        self._timer.timeout.connect(self.next)
+        self._timer.timeout.connect(self.__next__)
         self._timer.start(0)
 
     @QtCore.pyqtSlot()
     def show(self):
-        self._timer.timeout.connect(self.next)
+        self._timer.timeout.connect(self.__next__)
         super(MorphologyEditor, self).show()
         self._timer.start(0)
 
@@ -52,7 +52,7 @@ class MorphologyEditor(moogli.MorphologyViewer):
         self._timer.stop()
         super(MorphologyEditor, self).hide()
 
-    def next(self):
+    def __next__(self):
         self.frame()
         info_id = self.select_info.get_id()
         info_event = self.select_info.get_event_type()
@@ -175,7 +175,7 @@ class MoogliViewer(QWidget):
         self.morphology          =  self.createMorphology(self.geometry)
 
         self.morphology.set_compartment_order(
-            map(lambda x : x.path, self.compartmentOrder)
+            [x.path for x in self.compartmentOrder]
                                            )
 
         self.vms = np.empty(len(self.compartmentOrder), dtype=np.float, order='C')
diff --git a/util/pymoose.py b/util/pymoose.py
index bea52516..735883f3 100644
--- a/util/pymoose.py
+++ b/util/pymoose.py
@@ -34,12 +34,12 @@ def listmsg(pymoose_object):
     """Print a list of the messages on this object.
 
     """
-    print 'Incoming messages:'
+    print('Incoming messages:')
     for msg in pymoose_object.inMessages():
-        print msg
-    print 'Outgoing messages:'
+        print(msg)
+    print('Outgoing messages:')
     for msg in pymoose_object.outMessages():
-        print msg
+        print(msg)
 
 # 
 # pymoose.py ends here
-- 
GitLab