Skip to content

Instantly share code, notes, and snippets.

#include "Rcpp.h"
using namespace std;
using namespace Rcpp;
NumericMatrix lowPass6xDecX(NumericMatrix src)
{
const int ws = src.ncol(), h = src.nrow();
const int h2 = h * 2, h3 = h * 3, h4 = h * 4, h5 = h * 5;
int wr = ws / 2;
#include "Rcpp.h"
using namespace std;
using namespace Rcpp;
/*
inline unsigned char saturate( float x )
{
return x > 255.0f ? 255
: x < 0.0f ? 0
// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#include <Rcpp.h>
using namespace Rcpp;
// GaussianSubsample
NumericMatrix GaussianSubsample(NumericMatrix img);
RcppExport SEXP gazetools_GaussianSubsample(SEXP imgSEXP) {
#include "Rcpp.h"
using namespace std;
using namespace Rcpp;
/*
inline unsigned char saturate( float x )
{
return x > 255.0f ? 255
: x < 0.0f ? 0
import pickle
import os
from riotwatcher import RiotWatcher
with open (os.path.expanduser("~/.riot.key"), "r") as keyfile:
w = RiotWatcher(keyfile.read().replace('\n', ''))
champions = w.get_all_champions()
championsStatic = w.static_get_champion_list()
champNameLookup = {}
setwd("~/cogback/cogback/Projects/Tetris/Rational Tetris/Analyses/Hope_2014")
require(lmer)
require(lmerTest)
fx <- read.table("allFixations3.dat",header=T)
# 1 intercept (mean fixation duration) for each subject, but each subject shares the same
# estimate for the affect of game_number, level and the their interaction
m1 <- lmer(fixation.duration~game_number*level+(1|id),fx)
.by <- "episode_number"
.call <- as.call(quote(order()))
.call[]] <- as.quoted(c(by,"-layer","parent","dist"))
require(ggplot2)
require(data.table)
require(parallel)
load_all("~/gazetools")
aTan <- function(x1,y1,x2,y2) {
y = (y2-y1)
x = (x2-x1)
a <- abs(atan(y/x)) * (180/pi)
if (y>=0 && x<0) {
vincent <- function(vec, N) {
qs <- quantile(vec, seq(0, 1, length.out=N))
v <- tapply(vec, findInterval(vec, qs), mean)
names(v) <- sapply(names(qs),function(x) as.numeric(sub("%","",x)))
v
}
# v <- vincent(rgamma(10000,1,1), 20)
require(data.table)
d <- data.table(foo=c(0,1,2,3,4),bar=c(5,6,7,8,9))
f1 <- function(a, b) {
(a**b)%%2
}
f2 <- function(d, a, b) {
as.logical(f1(d[,a,with=F],d[,b,with=F]))