Skip to content

Instantly share code, notes, and snippets.

View mundya's full-sized avatar

Andrew Mundy mundya

View GitHub Profile
@mundya
mundya / inspinnuator.py
Last active December 29, 2015 03:09
InSpiNNuator - Pretend to be a SpiNNaker board transmitting UDP packets to a host. Packets resemble those produced by io_printf.
import random, struct, socket, time
def generate_packet( data ):
"""Generates a random SpiNNaker UDP Packet with a random
chip x, y and core (taken from some sensible range)."""
# Pick x, y, core
x = random.randint( 0, 4 )
y = random.randint( 0, 4 )
core = random.randint( 0, 17 )
@mundya
mundya / decoders-sigmoids.ipynb
Last active December 30, 2015 11:09
An attempt to build a working NEF example from scratch. Currently only for 1 dimension, but will work on `n` dimensions as soon as possible.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mundya
mundya / basic-presentation-1.tex
Last active January 2, 2016 23:09
Introductory presentation for the (unofficial) University of Manchester Beamer theme.
%% Declare the document type
%% `t` means "align content to the top of the slide"
\documentclass[t]{beamer}
%% Include the theme
\usetheme{UniversityOfManchester}
%% Set some document properties
\title{Saluto Mondo}
\subtitle{New Beamer Theme}
"""Attempt #1 at organizing neuron models
- We specify types of neurons using subclasses of Neuron
- This includes things like LIF vs HH and also Float vs Fixed, Rate vs Spiking
- We build a NeuronPool object which actually has code for running neurons
- We keep a list of known Neuron types around so if we're asked for just
a Rate neuron, we can pick the first on on the list that matches
Modified from @tcstewar's original to remove a fixed point divide.
import collections
Route = collections.namedtuple('Route', 'key mask sources targets')
RoutingEntry = collections.namedtuple('RoutingEntry',
'key mask targets defaultable')
KeyMask = collections.namedtuple('KeyMask', 'key mask')
def crush_table(routes, masks):
"""Reduce the size of a routing table.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""Support utilities for COMP28512.
(C) University of Manchester 2015
Author: Andrew Mundy
Revisions
---------
31/01/2015:
Included `get_pesq_scores` and generally neatened.
05/02/2015:
"""Frequency masking experiment for COMP28512.
(C) University of Manchester 2015
Author: Andrew Mundy
"""
from __future__ import print_function
import comp28512_utils
from IPython import display
from matplotlib import pyplot as plt
import numpy as np
import argparse
from rig.machine_control import MachineController
import sys
def count_dropped_mc(hostname):
"""Retrieve a count of the dropped packets on a given SpiNNaker machine."""
# Construct a controller for the machine
mc = MachineController(hostname)