Skip to content

Instantly share code, notes, and snippets.

@zubinmehta
zubinmehta / rolling_window.py
Created June 3, 2020 15:41 — forked from seberg/rolling_window.py
Multidimensional rolling_window for numpy
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple
#On an ec2 machine find it's public dns host name
curl -s http://169.254.169.254/latest/meta-data/public-hostname
@zubinmehta
zubinmehta / ga
Created February 12, 2012 08:01
ga code
COURSES=[]
DAYS = 5
DAILY_SLOTS = 5
import random
import numpy
import itertools
class Course(object):
counter = 0
def __init__(self, prof, students=set([])):