This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deleting a line in matplot lib | |
fig = figure() | |
ax = fig.add_subplot(111) | |
x = linspace(0,10) | |
plot(x, sin(x), label='sin') | |
plot(x, cos(x), label='cos') | |
# Deleting the last one | |
del ax.lines[1] | |
draw() # updating the fig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_new_dir(self, prefix="./", root="Sims"): | |
""" | |
Create the directory where to put the simulation | |
""" | |
self.dirRoot = os.path.join(prefix, root) | |
today = datetime.date.today() | |
free = False | |
index = 0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save_node(self, h5file_holder, group_path, section_name, variables, | |
detail=''): | |
"""Save a node to the h5file. | |
h5file_holder: The holder of the h5file | |
group_path: Where in the hierarchy the leaf has to be saved | |
section_name: The name of the section which the variables belong to | |
variables: The dictionary of the variable | |
""" | |
found = False | |
target_group = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cyl_example.py | |
from enthought.tvtk.tools import visual | |
def draw_cyl(coords): | |
x_ax = coords['x1'] -coords['x0'] | |
y_ax = coords['y1'] -coords['y0'] | |
z_ax = coords['z1'] -coords['z0'] | |
cyl = visual.Cylinder(pos=(coords['x0'],coords['y0'],coords['z0']), | |
axis=(x_ax,y_ax,z_ax), radius=1, length=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from mayavi import mlab | |
class Animator(object): | |
def __init__(self): | |
self.scalar_active_attribute = None | |
def add_scalar_array(self, dataset, tube, scalar_data, scalar_data_name): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parameters file for simulation. | |
{ | |
"dt" : 0.025, # integration dt [ms] | |
"dict_ampa_s1" : | |
{"t_stim" : 0.130, # t_stim [s] | |
"numbers" : 4, # number | |
"delay" : 0.1, # delay [s] | |
"type" : "ampa" # , type | |
}, | |
"dict_ampa_s2" : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from shutil import copyfile | |
import numpy as np | |
# Getting the qt in before mayavi | |
from PyQt4 import QtGui | |
app = QtGui.QApplication.instance() | |
from enthought.mayavi import mlab | |
# Offscreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run_model_in_neuronvisio(model_dir): | |
if os.path.exists(os.path.join (model_dir, 'mosinit.hoc')): | |
os.chdir(model_dir) | |
#TODO: We should check if the file is already compiled, | |
# and call the right executable according to the system. | |
call(['nrnivmodl']) | |
from neuron import gui # to not freeze neuron gui | |
from neuron import h | |
from neuronvisio.controls import Controls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is a check to make sure the sip and the Qstrings play nicely in Windows, | |
where the PySide is using the new Python API (Python 3) | |
http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg19702.html | |
http://stackoverflow.com/questions/1400858/how-to-create-qstring-in-pyqt4 | |
This could be easily removed when we move to Python 3 | |
""" | |
if os.name == 'nt': | |
import sip | |
sip.setapi('QString', 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-e git+https://mattions@github.com/mattions/mayavi.git@fix-21#egg=mayavi | |
-e git+https://github.com/enthought/traitsui.git#egg=traitsui | |
ipython==0.12 |
OlderNewer