Theory and simulation of integrate-and-fire neurons driven by shot noise (Droste & Lindner 2017)

 Download zip file 
Help downloading and running models
This archive contains source code for the paper "Exact analytical results for integrate-and-fire neurons driven by excitatory shot noise" by Droste and Lindner, 2017. Specifically, it contains a Python implementation of the analytical formulas derived in that paper (allowing to calculate firing rate, CV and stationary voltage distribution of general integrate-and-fire neurons driven by excitatory shot noise, as well as power spectrum and rate-response of leaky integrate-and-fire neurons with such input) and C++ code implementing a Monte-Carlo simulation to estimate these quantities. A sample Jupyter notebook to play around with the analytics is included, as are scripts to reproduce the figures from the paper.
1 . Droste F, Lindner B (2017) Exact analytical results for integrate-and-fire neurons driven by excitatory shot noise J. Comp. Neurosci.
Citations  Citation Browser
Model Information (Click on a link to find other models with that property)
Model Type:
Brain Region(s)/Organism:
Cell Type(s): Abstract integrate-and-fire leaky neuron; Abstract theta neuron;
Gap Junctions:
Simulation Environment: C or C++ program; Python;
Model Concept(s):
Implementer(s): Droste, Felix [fedro at];
import json
from parameter_sets import Evaluator
from param_scan import pint_ureg
from datetime import datetime 

dtfmt = "%Y-%m-%d %H:%M:%S.%f"

def json_dumper(o):
        if hasattr(o, "tolist"):
                o = o.tolist()
                return o
            except (AttributeError, TypeError):
                pass # if it's a pint Quantity that does not contain an array
        if hasattr(o, "to_json"):
            return o.to_json()
        if hasattr(o, "strftime"):
            return o.strftime(dtfmt)
        if hasattr(o, "dimensionless"): # it seems to be a pint Quantity
            if o.dimensionless:
                return float(o)
                return "{:~}".format(o).strip()
        return o.__repr__()
        #return o.__dict__()
    except Exception as e:
        print o
        raise e

def parse_item(it):
    if isinstance(it, basestring):
        # first, try reading a DateTime. pint's parser is a bit too forgiving and will happily read that as a dimensionless value if we don't catch it before
            it = datetime.strptime(it, dtfmt)
            return it
        except ValueError:
        # try reading a pint Quantity, if pint exists (i.e. pint_ureg was created at module init)
        if pint_ureg is not None:
                it = pint_ureg.Quantity(it)
                return it
            except: #(pint.UndefinedUnitError):
        # apparently not a Quantity, Evaluator?
        for when in ['before_unroll', 'after_unroll']:
            if hasattr(it, "startswith") and it.startswith("eval_%s(" % when):
                it = Evaluator(it[6+len(when):-1], when)
    return it

def json_hook(o):
    if o.has_key("value"): # if a dict has the entry "value", we assume that is what matters and ignore the rest, which may carry info for the generation of c++ param parsing
        return o["value"] 
    for k, v in o.items():
        if isinstance(v, list):
            o[k] = [parse_item(it) for it in v]
            o[k] = parse_item(v)
    return o