Skip to content

Instantly share code, notes, and snippets.

View cheelee's full-sized avatar

Chee Wai Lee cheelee

View GitHub Profile
@cheelee
cheelee / gist:f92aef6aa8cc4294c4498c9ceb55a41b
Created August 9, 2018 02:29
Accessing the Series constructs in a WCON PANDAS Dataframe.
# WCON data source: https://zenodo.org/record/1034927/files/unc-80%20(e1069)%20nRHO-1%20QT309%20on%20food%20L_2011_11_11__13_12___3___4.wcon.zip
#
# WCON is kind of broken right now, so I won't bother to describe the software stack. To get it to work, some hackery involving dependencies are required.
# https://github.com/openworm/tracker-commons
#
from wcon import WCONWorms
# Assuming file properly renamed
>>> worm = WCONWorms.load_from_file('../static/example.wcon')
Loading file: ../static/example.wcon
# Loaded object's data field is a PANDAS dataframe
@cheelee
cheelee / gist:ca1c5ebf817f3ac3a81c01587d7f5b40
Created July 27, 2017 06:55
20170727 - Fresh Geppetto Installation error
Downloading: http://repository.springsource.com/maven/bundles/release/org/geppetto/core/0.2.7/core-0.2.7.pom
Downloading: http://repository.springsource.com/maven/bundles/external/org/geppetto/core/0.2.7/core-0.2.7.pom
Downloading: http://repository.springsource.com/maven/libraries/release/org/geppetto/core/0.2.7/core-0.2.7.pom
Downloading: http://repository.springsource.com/maven/libraries/external/org/geppetto/core/0.2.7/core-0.2.7.pom
Downloading: https://repo.maven.apache.org/maven2/org/geppetto/core/0.2.7/core-0.2.7.pom
[WARNING] The POM for org.geppetto:core:jar:0.2.7 is missing, no dependency information available
Downloading: http://repository.springsource.com/maven/bundles/release/org/geppetto/core/0.2.7/core-0.2.7.jar
Downloading: http://repository.springsource.com/maven/bundles/external/org/geppetto/core/0.2.7/core-0.2.7.jar
Downloading: http://repository.springsource.com/maven/libraries/release/org/geppetto/core/0.2.7/core-0.2.7.jar
Downloading: http://repository.springsource.com/maven/libraries/e
@cheelee
cheelee / gist:188c5b125be77c21c13436692c40a5a2
Created July 27, 2017 06:53
Steps taken - Fresh Geppetto Installation
Python 2.7 - via homebrew
Virgo server for Tomcat - http://www.eclipse.org/downloads/download.php?file=/virgo/release/VP/3.6.4.RELEASE/virgo-tomcat-server-3.6.4.RELEASE.zip
gunzip -a virgo-tomcat-server-3.6.4.RELEASE.zip -d /usr/local
Maven - via homebrew
Tomcat - via homebrew
export MVN_HOME="$(brew --prefix maven)/libexec"
export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)"
export SERVER_HOME="$(/usr/local/virgo-tomcat-server-3.7.1.RELEASE)"
@cheelee
cheelee / gist:22db3e9edaddae15486ad51f8c24fd8e
Created May 10, 2017 10:19
Output to mutable assignment in exec() for Python 2 and Python 3
Arya:temp cheelee$ python test-exec-good.py
BEFORE - bar
6
INSIDE - num
7
AFTER - bar
7
Arya:temp cheelee$ python3 test-exec-good.py
BEFORE - bar
6
@cheelee
cheelee / gist:d39a0eb551a0e7b2a8bf6f7d0b1b6a77
Created May 10, 2017 10:17
Assignment to mutable constructs in exec() work for both Python 2 and Python 3
import sys
def foo(op, val):
num = [1];
exec('num[0] = num[0] ' + op + ' val;');
print("INSIDE - num");
print(num[0]);
return num[0];
if len(sys.argv) != 2:
@cheelee
cheelee / gist:4615a7fd3e9c3fd42fa4977adb107c9c
Created May 10, 2017 10:13
Output to bad exec() for Python 2 versus Python 3
Arya:temp cheelee$ python test-exec-nogood.py
BEFORE - bar
6
INSIDE - num
7
AFTER - bar
7
Arya:temp cheelee$ python3 test-exec-nogood.py
BEFORE - bar
6
@cheelee
cheelee / gist:3467692691c8bdb19e9b5013237429e8
Created May 10, 2017 10:09
Direct assignment to local variables different for Python 2 and 3
import sys
def foo(op, val):
num = 1;
exec('num = num ' + op + ' val;');
print("INSIDE - num");
print(num);
return num;
if len(sys.argv) != 2:
@cheelee
cheelee / test_blog_embed.txt
Last active June 15, 2016 13:23
Testing Gist Embedding in Blogspot
// Testing embedded C++ code in blogspot via gist. Making this comment extra long so I can either see this wrap or the scroll bar.
int foo=0;
int bar(int x) {
return 5*x;
}
class Foobar {
public:
Foobar() {};
~Foobar() {};
void foobar() {};
@cheelee
cheelee / gist:acae42cc6ea5823fd80235c61fd80d31
Created May 26, 2016 15:04
HH Tutorial Alternative Miniconda Build Attempt
# AWS EC2 t2.micro instances seem to get stuck on matplotlib using this - may be low on memory or disk space? (1Gb each)
# Test sequence successfully completed on a VirtualBox image of Ubuntu 14.04 LTS running on Mac OS X with no real resource limits
# Pre-instructions: UPDATE SYSTEM
#export LC_ALL=en_US.UTF-8 # Only needed for AWS EC2
#export LANG=en_US.UTF-8 # Only needed for AWS EC2
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
@cheelee
cheelee / gist:b6ffd97c09aa635cdb33b1adf88a87f4
Created May 26, 2016 15:01
HHCellNetwork.net.nml Example Failure
(hh_tutorial)cheelee@OwatWcon:~/pyNeuroML/examples/test_data$ pynml-channelanalysis -ivCurve HHCellNetwork.net.nml
pyNeuroML >>>
pyNeuroML >>> Analysing channels from files: ['HHCellNetwork.net.nml']
pyNeuroML >>>
pyNeuroML >>> Skipping passiveChan in HHCellNetwork.net.nml as it has no channels (probably passive conductance)
Traceback (most recent call last):
File "/home/cheelee/miniconda3/envs/hh_tutorial/bin/pynml-channelanalysis", line 9, in <module>
load_entry_point('pyNeuroML==0.1.12', 'console_scripts', 'pynml-channelanalysis')()
File "/home/cheelee/miniconda3/envs/hh_tutorial/lib/python3.5/site-packages/pyneuroml/analysis/NML2ChannelAnalysis.py", line 616, in main
run(a=args)