View qhourly_tides.txt
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date,asl | |
2013-06-02 00:00:00,0.816 | |
2013-06-02 00:15:00,0.845 | |
2013-06-02 00:30:00,0.865 | |
2013-06-02 00:45:00,0.902 | |
2013-06-02 01:00:00,0.94 | |
2013-06-02 01:15:00,0.983 | |
2013-06-02 01:30:00,1.023 | |
2013-06-02 01:45:00,1.086 |
View altitude.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View osgb_50_numpy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Converts Ordnance Survey Terrian 50 United Kingdom data to a simple NumPy array of terrain altitudes | |
# The original OS data is freely downloadable from: https://www.ordnancesurvey.co.uk/business-government/products/terrain-50 | |
# Directly converts the zipped terrain file to a NPZ file | |
# Resulting array is a (24600, 13200) array of float64 | |
# Requirements: | |
# * pycrs | |
# * lxml | |
import os, sys |
View compute_itr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.metrics import confusion_matrix | |
from collections import defaultdict | |
def itr(confusion_matrix, timings, eps=1e-8): | |
"""Take a confusion matrix of the form | |
(actual) a b c d | |
(intended) | |
a 10 0 1 9 |
View plot_connected_points.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib.collections import LineCollection | |
def plot_connected_pairs(a,b,*args,**kwargs): | |
""" | |
Draw lines between two arrays of 2D points. | |
a and b must be the same shape, both [N,2] arrays to be plotted. | |
Parameters: | |
----------- | |
a: [N,2] array of points to plot from |
View bivariate_matplotlib.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bivariate colormaps in matplotlib | |
import numpy as np | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
## Bivariate colormapping | |
from scipy.interpolate import RegularGridInterpolator |
View trace_frame.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
class tracked: | |
"""Class to remember the execution frame | |
that a function call was made in.""" | |
def __init__(self, fn): | |
self.fn = fn | |
View differentiable_sort.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def softmax(a,b): | |
return np.log(np.exp(a)+np.exp(b)) | |
def softmin(a,b): | |
return -softmax(-a, -b) | |
def softrank(a, b): | |
return softmin(a,b), softmax(a,b) |
View tqdm_train_loop.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm.auto import trange, tqdm | |
def tqdm_train_loop(train_fn, num_epochs, train_loader, val_fn=None): | |
# each epoch | |
with trange(num_epochs, unit="epoch") as epoch_t: | |
for epoch in epoch_t: | |
# each batch | |
with tqdm(train_loader, leave=False, unit='batch', postfix='') as batch_t: | |
for batch_idx, (features, targets) in enumerate(batch_t): | |
cost = train_fn(features, labels) | |
batch_t.postfix = f"cost {cost.item():.2f}" |
View prime_dance.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
from collections import defaultdict | |
import colorsys | |
import munkres # provides Hungarian algorithm | |
import scipy.spatial.distance as dist | |
import functools | |
import os |
NewerOlder