Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@subhacom
subhacom / colab_bug.ipynb
Last active June 8, 2019 18:02
Demonstration of a bug where colab misses out some cells created in Jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@subhacom
subhacom / hh_squid.py
Created October 29, 2018 16:38
Python implementation of Hodgkin and Huxley's squid giant axon model using scipy ode solver.
# hh_squid.py ---
# Author: Subhasis Ray
# Created: Fri Oct 26 10:21:21 2018 (-0400)
# Last-Updated: Mon Oct 29 12:32:49 2018 (-0400)
# By: Subhasis Ray
# Version: $Id$
# Code:
"""A python implementation of Hodgkin-Huxley`s Squid Giant Axon model."""
@subhacom
subhacom / lzcomplexity.c
Created September 13, 2018 19:14
A small C program to compute Lempel-Ziv complexity of a string
/* lzcomplexity.c ---
* Author: Subhasis Ray
* Created: Thu Sep 13 11:54:21 2018 (-0400)
* Last-Updated: Thu Sep 13 14:01:18 2018 (-0400)
* By: Subhasis Ray
* Version: $Id$
/* This implements the algorithm described by Casper and Schu"ster, 1987, Physical Review A:
"Easily calculable measure for the complexity of spatiotemporal patterns". */
/* Code: */
#include <stdio.h>
@subhacom
subhacom / vtk_size_color.py
Created August 9, 2018 18:25
Simple script showing how to set size and color of glyphs using different scalar arrays
# vtk_size_color.py ---
# Author: Subhasis Ray
# Created: Thu Aug 9 11:04:16 2018 (-0400)
# Last-Updated: Thu Aug 9 14:24:15 2018 (-0400)
# By: Subhasis Ray
# Version: $Id$
# Code:
"""Test simultaneous radius and color settings in glyph.
@subhacom
subhacom / line_color_anim.py
Last active July 20, 2018 15:19
Minimal example of spheres and lines animated by changing colors based on scalar value
# line_color_anim.py ---
# Author: Subhasis Ray
# Created: Thu Jul 19 16:58:58 2018 (-0400)
# Last-Updated: Fri Jul 20 11:18:41 2018 (-0400)
# By: Subhasis Ray
# Version: $Id$
# Code:
"""Short example of animating line colors with color transfer function
@subhacom
subhacom / biomodelsclient.py
Last active November 4, 2015 20:29
This is a Python implementation to query the webservice of biomodels database (https://www.ebi.ac.uk/biomodels-main/) I originally wrote for the MOOSE gui (https://github.com/BhallaLab/moose-gui) back in 2010. This gist is updated to work with Python3 and PyQt4 and provides a client class as well as a graphical widget for downloading models.
# biomodelsclient.py ---
#
# Filename: biomodelsclient.py
# Description:
# Author: Subhasis Ray (original client & widget),
# GV Harsharani (pickled cache).
# Maintainer:
# Created: Tue Mar 2 07:57:39 2010 (+0530)
# Version:
# Last-Updated: Wed Nov 04 15:02:32 2015 (EDT)
@subhacom
subhacom / cpmd5.sh
Last active September 25, 2023 16:59
rsync and md5sum: Use rsync to copy a directory and then generate a file containing the md5sum of all the files in source directory. Finally do a check of the md5sum of the target.
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Usage: $0 source dest [md5file]"
echo "Copy source directory into dest directory and put md5 sum of the files in source in md5file. "
echo "If no md5 file is unspecified it is created in current directory"
echo
exit 0
fi
source=$1
target=$2
@subhacom
subhacom / ranksurprise.py
Created December 19, 2012 12:03
Detect bursts in spiketimes using Rank-Surprise method by Boris Gourevitch and Jos J. Eggermont. Although we use the word spike trains specific to Neuroscience, it is essentially a series of event times t0, t1, t2, ... tn and inter-spike-interval (ISI) is the interval between these events (t1-t0, t2-t1, ...). Reference: Gourevitch, B. & Eggermon…
# ranksurprise.py ---
#
# Filename: ranksurprise.py
# Description: Rank-surprise (RS) algorithm for burst identification.
# Author: Subhasis Ray
# Maintainer:
# Created: Thu Dec 13 15:03:05 2012 (+0530)
# Version:
# Last-Updated: Wed Dec 19 17:31:45 2012 (+0530)
# By: subha