Skip to content

Instantly share code, notes, and snippets.

t = model.swizzle(model.swizzle(y)).clone()
t[0, :, 0, 0] = torch.arange(0, 16)
def even_odd(x, dim=1):
evens, odds = x.view(x.size()), x.view(x.size())
odd_offset = np.asscalar(np.prod(x.size()[dim + 1:]))
shape, stride = list(x.size()), list(x.stride())
shape[dim] = shape[dim] // 2
stride[dim] *= 2
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
np.seterr(all='raise')
matfile = sio.loadmat('state_meas_data.mat')
measurements = np.nan_to_num(matfile['z'].T, 150)
states = matfile['X'].T
# RenderDoc Python scripts, powered by IronPython 2.7.4.1000
# The 'pyrenderdoc' object is the Core class instance.
# The 'renderdoc' module is available, as the matching namespace in C#
from collections import defaultdict
lastDraw = pyrenderdoc.CurDrawcalls[len(pyrenderdoc.CurDrawcalls) - 1]
draws = []
for eventID in range(0, lastDraw.eventID): # lastDraw.eventID
curdraw = pyrenderdoc.GetDrawcall(eventID)
if curdraw == None:
import numpy as np
import re
import sys
from tqdm import tqdm
TAG_CHAR = np.array([202021.25], np.float32)
'''
Load a PFM file into a Numpy array. Note that it will have
a shape of H x W, not W x H. Returns a tuple containing the
#!/bin/bash
rm ChairsSDHom_release_TRAIN.list ChairsSDHom_release_TEST.list 2> /dev/null
cd ./data/train
paste -d ' ' <(awk -v d="${PWD}" '{printf d;printf "/t0/";print;}' <(ls t0 -1)) <(awk -v d="${PWD}" '{printf d;printf "/t1/";print;}' <(ls t1 -1)) <(awk -v d="${PWD}" '{printf d;printf "/";print;}' <(ls flow/*.flo -1)) > ChairsSDHom_release_TRAIN.list
mv ChairsSDHom_release_TRAIN.list ../../
cd ../../data/test
paste -d ' ' <(awk -v d="${PWD}" '{printf d;printf "/t0/";print;}' <(ls t0 -1)) <(awk -v d="${PWD}" '{printf d;printf "/t1/";print;}' <(ls t1 -1)) <(awk -v d="${PWD}" '{printf d;printf "/";print;}' <(ls flow/*.flo -1)) > ChairsSDHom_release_TEST.list
mv ChairsSDHom_release_TEST.list ../../
// Start the module
// Fake a state
// Wait for the module to publish it's response
// Check to see if that response was expected
// Fake a new state and do it again.
// End the module
State testArray = [
{sensors : {pos, barometer, gps...}, controls : {control1, control2}},
{sensors : {pos, barometer, gps...}, controls : {control1, control2}}]
@el3ment
el3ment / parser
Created May 15, 2014 17:22
Create list of links from XML Sitemap
var html = "";
var links = [];
$('url loc').each(function(i, e){
links.push(e.innerHTML);
});
links.sort();
$(links).each(function(i, e){
html += "<li><a href='"+e+"'>"+e.replace("http://www.lonestarpercussion.com/", "").replace("/", " / ").replace(/\-/g, " ").replace(/ ?\/ ?$/,"")+"</a></li>";
});
//SMS
var ourMessages = $('sms[address*="2094842514"]')
var csvData = "";
for(var i = 0; i < ourMessages.length; i++){
csvData += "" + $(ourMessages[i]).attr('body') + "|" + $(ourMessages[i]).attr('address') + "|" + $(ourMessages[i]).attr('type') + "|" + $(ourMessages[i]).attr('readable_date') + "|" + $(ourMessages[i]).attr('contact_name') + "<br>"
}
$('smses').html(csvData)