Tutorial: Making NEURON Vector.play() + SaveState.restore() + CVODE work

Here is a working example of running a NEURON simulation of a cell to steady state, saving that state, restoring it in a new simulation, and using the Vector.play method to stimulate the cell with an arbitrary waveform. All this while using the variable integration method CVODE. First, build the cell, and run it to … Continue reading Tutorial: Making NEURON Vector.play() + SaveState.restore() + CVODE work

FFMPEG Cheat Sheet

  Create animated GIF (with nice colors) from a sequence of images named "img (0...N).jpg". Use "%0Nd.jpg" for 0-padded numbered files. set pattern="%04d.jp2" ffmpeg -i %pattern% -vf palettegen palette.png ffmpeg -i %pattern% -i palette.png -lavfi "fps=15, paletteuse" out.gif

NEURON Cheat Sheet

Compile all .mod files in directory nrnivmodl #NRN IV MOD L Use variable step integration h.cvode_active(1) # or 0 for fixed, note the _ h.cvode.atol(0.01) # for tolerance 0.001 is default Run sim till a specific time h.continuerun(tstop) Record value e.g. memb pot vVector = h.Vector() vVector.record(section(0.5)._ref_v) #Use h._ref_t for time #Then, after h.run() vVector.to_pyton() … Continue reading NEURON Cheat Sheet

Ruby Cheat Sheet

Upper/lower case version of a string "test".downcase "test".upcase Check if a string contains another string my_string.include? "target" Replace in string stringVar.gsub("replacewhat","withthis") # add ! to replace in-place Length of array arrVar.length Try/Catch exception handling begin error_code_here() rescue handle_error() end Ternary/conditional operator: result = condition ? if_true : if_false

Python Cheat Sheet

Create Anaconda environment conda create -n envName python=2.7 Change Anaconda Python environment *NIX: source activate p2/p3 WIN: activate p2/3/pb35 Cython re-build files python setup.py build_ext --inplace Get cmd parameter:  sys.argv[1+] Get absolute path:  os.path.abspath(relativePath)   Get file parent folder:  os.path.dirname(filePath)   Get list of directory files (just file names): os.listdir(dirPath) # note no os.path Delete … Continue reading Python Cheat Sheet