Skip to content

Instantly share code, notes, and snippets.

View rgerkin's full-sized avatar

Richard C Gerkin rgerkin

View GitHub Profile
@rgerkin
rgerkin / pandas-to-markdown.py
Created February 15, 2019 22:07
This takes a pandas dataframe and renders the Markdown in the output of a Jupyter code cell
#!pip install --user tabulate # Install the tabulate package
from tabulate import tabulate
import numpy as np
import pandas as pd
import IPython.display as d
# Some random data
data = np.random.rand(10,4)
# Columns A, B, C, D
columns = [chr(x) for x in range(65,69)]
@rgerkin
rgerkin / LEMS_2007One_nrn.py
Created October 10, 2017 06:45
Auto-generated NEURON file for LEMS_2007One.xml LEMS file
'''
Neuron simulator export for:
Components:
RS (Type: izhikevich2007Cell: v0=-0.06 (SI voltage) k=7.0E-7 (SI conductance_per_voltage) vr=-0.06 (SI voltage) vt=-0.04 (SI voltage) vpeak=0.035 (SI voltage) a=30.0 (SI per_time) b=-2.0E-9 (SI conductance) c=-0.05 (SI voltage) d=1.0E-10 (SI current) C=1.0E-10 (SI capacitance))
RS_Iext (Type: pulseGenerator: delay=0.5 (SI time) duration=1.0 (SI time) amplitude=1.0E-10 (SI current))
net1 (Type: network)
sim1 (Type: Simulation: length=1.6 (SI time) step=2.5E-6 (SI time))
from sklearn.cross_validation import ShuffleSplit
from sklearn.ensemble import RandomForestRegressor
n_features = [1,2,3,4,5,10,33,100,333,1000,3333,10000] # The numbers we agreed on.
n_splits = 10 # The number of splits we agreed on.
n_obs = int(X_all.shape[0]/2) # X_all is my matrix of all the training and leaderboard molecule features, including the leak.
# It has two (consecutive) rows for each molecule, the first is the weaker concentration and the second
# is the stronger one.
shuffle_split = ShuffleSplit(n_obs,n_splits,test_size=0.17,random_state=0) # This reproduces the splits I put on GitHub.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
chmod +x miniconda.sh
./miniconda.sh -b
export PATH=~/miniconda/bin:$PATH
conda update --yes conda
conda install --yes python=2.7 atlas numpy scipy matplotlib
sudo apt-get update
sudo apt-get install gcc libxml2-dev libxslt-dev python-dev lib32z1-dev
sudo apt-get install default-jre
pip install -U git+https://github.com/neuralensemble/libNeuroML@development
class RateTest(sciunit.Test):
def __init__(self, mean, std, input_current):
self.mean, self.std, self.input_current = mean, std, input_current
required_capabilities = (
neurounit.Capabilities.ReceivesCurrent,
neurounit.Capabilities.ProducesFiringRate
)
def run_test(self, model):
class RateTest(sciunit.Test):
def __init__(self, mean, std, input_current):
self.mean, self.std, self.input_current = mean, std, input_current
required_capabilities = (
neurounit.Capabilities.ReceivesCurrent,
neurounit.Capabilities.ProducesFiringRate
)
def run_test(self, model):