def convertSP(pySp, newSeed):
columnDim = pySp._columnDimensions<EOL>inputDim = pySp._inputDimensions<EOL>numInputs = pySp.getNumInputs()<EOL>numColumns = pySp.getNumColumns()<EOL>cppSp = CPPSpatialPooler(inputDim, columnDim)<EOL>cppSp.setPotentialRadius(pySp.getPotentialRadius())<EOL>cppSp.setPotentialPct(pySp.getPotentialPct())<EOL>cppSp.setGlobalInhibition(pySp.getGlobalInhibition())<EOL>numActiveColumnsPerInhArea = pySp.getNumActiveColumnsPerInhArea()<EOL>localAreaDensity = pySp.getLocalAreaDensity()<EOL>if (numActiveColumnsPerInhArea > <NUM_LIT:0>):<EOL><INDENT>cppSp.setNumActiveColumnsPerInhArea(numActiveColumnsPerInhArea)<EOL><DEDENT>else:<EOL><INDENT>cppSp.setLocalAreaDensity(localAreaDensity)<EOL><DEDENT>cppSp.setStimulusThreshold(pySp.getStimulusThreshold())<EOL>cppSp.setInhibitionRadius(pySp.getInhibitionRadius())<EOL>cppSp.setDutyCyclePeriod(pySp.getDutyCyclePeriod())<EOL>cppSp.setBoostStrength(pySp.getBoostStrength())<EOL>cppSp.setIterationNum(pySp.getIterationNum())<EOL>cppSp.setIterationLearnNum(pySp.getIterationLearnNum())<EOL>cppSp.setSpVerbosity(pySp.getSpVerbosity())<EOL>cppSp.setUpdatePeriod(pySp.getUpdatePeriod())<EOL>cppSp.setSynPermTrimThreshold(pySp.getSynPermTrimThreshold())<EOL>cppSp.setSynPermActiveInc(pySp.getSynPermActiveInc())<EOL>cppSp.setSynPermInactiveDec(pySp.getSynPermInactiveDec())<EOL>cppSp.setSynPermBelowStimulusInc(pySp.getSynPermBelowStimulusInc())<EOL>cppSp.setSynPermConnected(pySp.getSynPermConnected())<EOL>cppSp.setMinPctOverlapDutyCycles(pySp.getMinPctOverlapDutyCycles())<EOL>boostFactors = numpy.zeros(numColumns).astype(realType)<EOL>pySp.getBoostFactors(boostFactors)<EOL>cppSp.setBoostFactors(boostFactors)<EOL>overlapDuty = numpy.zeros(numColumns).astype(realType)<EOL>pySp.getOverlapDutyCycles(overlapDuty)<EOL>cppSp.setOverlapDutyCycles(overlapDuty)<EOL>activeDuty = numpy.zeros(numColumns).astype(realType)<EOL>pySp.getActiveDutyCycles(activeDuty)<EOL>cppSp.setActiveDutyCycles(activeDuty)<EOL>minOverlapDuty = numpy.zeros(numColumns).astype(realType)<EOL>pySp.getMinOverlapDutyCycles(minOverlapDuty)<EOL>cppSp.setMinOverlapDutyCycles(minOverlapDuty)<EOL>for i in range(numColumns):<EOL><INDENT>potential = numpy.zeros(numInputs).astype(uintType)<EOL>pySp.getPotential(i, potential)<EOL>cppSp.setPotential(i, potential)<EOL>perm = numpy.zeros(numInputs).astype(realType)<EOL>pySp.getPermanence(i, perm)<EOL>cppSp.setPermanence(i, perm)<EOL><DEDENT>pySp._random = NupicRandom(newSeed)<EOL>cppSp.seed_(newSeed)<EOL>return cppSp<EOL>
Given an instance of a python spatial_pooler return an instance of the CPP
spatial_pooler with identical parameters.