Skip to content

Instantly share code, notes, and snippets.

@iscadar
iscadar / mynetlib.py
Created July 22, 2012 13:37
A collection of functions for the generation of neural networks and the setup of various experiments.
##A collection of functions for the generation of
##neural networks and the setup of various experiments.
##by Alexandros Kourkoulas-Chondrorizos
##v0.1
from scipy import *
from scipy.signal import *
from matplotlib.pyplot import *
from matplotlib.mlab import *
import scipy.cluster.hierarchy as sch
@iscadar
iscadar / pend_4rk.py
Created July 7, 2012 10:47
A pendulum simulation using fourth order Runge-Kutta integration
from scipy import *
from matplotlib.pyplot import *
##A pendulum simulation using fourth order
##Runge-Kutta integration
##v0.1
##Alexandros Kourkoulas Chondrorizos
ts=.05 #time step size
td=40 #trial duration
te=int(td/ts) #no of timesteps
@iscadar
iscadar / pend_eul.py
Created July 7, 2012 10:45
A pendulum simulation using Euler integration
from scipy.integrate import *
from scipy import *
from matplotlib.pyplot import *
##A pendulum simulation
##v0.2
##Alexandros Kourkoulas Chondrorizos
th=pi/4#((rand()*2)-1)*pi #initial angle
om=0 #initial angular velocity
u=0 #torque
@iscadar
iscadar / mat_reorder.py
Created May 10, 2011 16:14
Visualising the structural and functional connectivity of a neural network.
##Visualising the structural and functional connectivity
##of a neural network.
##by Alexandros Kourkoulas-Chondrorizos
##v0.1
##This is a simple function that calculates the covariance
##matrix of a neural network based on its activity. It then
##reorders the covariance matrix to obtain a depiction of
##functional connectivity and based on that reordering also
##rearranges the connectivity matrix in order to obtain a
##clearer picture of its structural connectivity. Put simply,
@iscadar
iscadar / ga.py
Created April 7, 2011 15:26
A simple genetic algorithm
##A simple genetic algorithm
##by Alexandros Kourkoulas-Chondrorizos
##v0.1
##This is one of the simplest versions of a GA out there.
##You can use it to set up any kind of evolutionary experiment
##and it's a great starting point for designing more complex
##and sophisticated GAs. Note that the function eval_ind() that
##is called in the code below isn't a real function. It's only
##a placeholder for whatever your fitness function happens to be.
@iscadar
iscadar / stim_rec.py
Created March 26, 2011 14:54
A simple function for stimulus estimation/reconstruction in a neural system using a Wiener-Kolmogorov filter.
##A simple function for stimulus estimation/reconstruction
##in a neural system using a Wiener-Kolmogorov filter
##by Alexandros Kourkoulas-Chondorizos
##v0.3
##This function takes two 1-by-N arrays as input, the input
##signal presented to the neuron or neural net and the neural
##response. It also takes two integers nfft and tstep, where
##nfft is the number of data points used in each block for the
##FFT and tstep is the sampling frequency. nfft must be even
##and a power of 2 is most efficient. tstep is an integer
@iscadar
iscadar / netgen.py
Created March 13, 2011 10:13
This is a simple function that generates a variety of network connectivities and consequently architectures anywhere from a three-layer feedforward network to a neural pool of dynamics. It supports recurrent connections, lateral and self-connections, feed
##A generic network connectivity architecture
##by Alexandros Kourkoulas-Chondrorizos
##v0.2
##This is a simple function that generates a variety
##of network connectivities and consequently architectures
##anywhere from a three-layer feedforward network
##to a neural pool of dynamics. It supports recurrent
##connections, lateral and self-connections, feedforward
##connections (obviously), any degree of sparsity (0 to
##100% connectivity) and both excitatory and inhibitory connections.