Skip to content

Instantly share code, notes, and snippets.

View shhong's full-sized avatar
😘
In need of a kiss

Sungho Hong shhong

😘
In need of a kiss
View GitHub Profile
#!/bin/bash
set -e
IVVER=18
NRNVER=r1059
XQVER=2.7.5
READLINE=/usr/local/opt/readline/
PYTHONBIN=/usr/bin/python
NRNDIR=/Applications/NEURON-$NRNVER
@shhong
shhong / ml.mod
Created June 15, 2012 07:19
Morris-Lecar neuron
TITLE Morris-Lecar spiking dynamics
COMMENT
Written by Sungho Hong
Computational Neuroscience Unit
Okinawa Institute of Science and Technology
shhong@oist.jp
ENDCOMMENT
@shhong
shhong / ball_quiz_simulation.py
Created July 8, 2011 05:32
Probability puzzle and simulation
#!/usr/bin/env python
"""
This script is for a Monte Carlo simulation of the following puzzle: you
first put a white ball in a bag containing another "original" ball with
unknown color, which can be black or white with probability of 1/2. The
question is what is the probability that the original ball was white if
you pick one of two balls in the bag randomly and the chosen ball is
white. As a matter of fact, this problem is equivalent to finding the
probability of choosing a white ball out of one black and two white
balls, which should be 2/3.
@shhong
shhong / gist:1048340
Created June 27, 2011 05:10
Wang-Buzsaki model in NEURON
TITLE Wang-Buzsaki model
COMMENT
Sungho Hong, CNS Unit, Okinawa Inst Sci Tech. Mar 2008
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
@shhong
shhong / nsb_entropy.py
Last active May 19, 2023 11:45
NSB entropy in python
#!/usr/bin/env python
"""
nsb_entropy.py
June, 2011 written by Sungho Hong, Computational Neuroscience Unit, Okinawa Institute of
Science and Technology
May, 2019 updated to Python 3 by Charlie Strauss, Los Alamos National Lab
This script is a python version of Mathematica functions by Christian Mendl
@shhong
shhong / cvxopt_macosx_setup.py
Created October 7, 2010 02:26
setup.py for cvxopt using Accelerate.framework in Mac instead of ATLAS.
from distutils.core import setup, Extension
from glob import glob
# directory containing libblas and liblapack
ATLAS_LIB_DIR = '/usr/lib'
# Set to 1 if you are using the random number generators in the GNU
# Scientific Library.
BUILD_GSL = 0
from numpy import mod, median
from numpy import pi
from numpy import vstack, hstack
def restrict_phase(theta):
return mod(theta+pi, 2*pi)-pi
def drmap(i,j, uu):
x = restrict_phase(uu[i,1:-1]-uu[j,1:-1])
x = pickle.load(open('final.no.40.pkl','r'))
In [383]: cgm = loadtxt('/Users/shhong/CGM/hwidth_HHLS_40.dat').tolist()
In [384]: l = []
In [385]: for k in cgm:
l.append([(int(k[0]), int(k[1])), k[2]])
.....:
.....: