This file contains hidden or 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
############################################################## | |
# | |
# read_totem_data.R | |
# | |
# Import script | |
# | |
# Parses raw Totem Sensor accelerometer data in R | |
# And looks for peaks (steps, cycles, repeats) | |
# |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
## IPython Reset | |
#from IPython import get_ipython | |
#get_ipython().magic('reset -sf') | |
############################################################################## | |
import numpy as np |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
#from IPython import get_ipython | |
#get_ipython().magic('reset -sf') | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import json | |
############################################################################## |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import urllib,json,codecs | |
#change to pymongo for greater compatibility | |
import iopro | |
def getobs( x, max = 5, err=0 ): | |
if (err==0): |
This file contains hidden or 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
library(ggplot2) | |
library(jsonlite) | |
library(rmongodb) | |
setwd("C:/Users/User/Desktop/LiF") | |
BASE_URL = "http://localhost:8080" | |
key = "51fc58011" | |
question_nr = 2626 | |
customers <- 4000 |
This file contains hidden or 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
library(Cairo) | |
library(ggplot2) | |
library(animation) | |
############################## configuration ############################## | |
# set working directory | |
setwd("C:/Users/robin/Desktop/Monopolist") |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
#from IPython import get_ipython | |
#get_ipython().magic('reset -sf') | |
import sys,random | |
import ujson as json | |
import asyncio,aiohttp,pymongo | |
import numpy as np |
This file contains hidden or 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
# Implementation of Lock in Feedback. | |
# -*- coding: utf-8 -*- | |
from libs.base import * | |
import numpy as np | |
import ujson as json | |
import sys | |
class Lif: | |
def __init__(self, theta, x0=1.0, A=1.4, T=100, gamma=.004, omega=0.8, lifversion=2): |
This file contains hidden or 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 matrixpush(m, row): | |
if not np.all(np.isfinite(values[:,0])): | |
i = np.count_nonzero(np.logical_not(np.isnan(values[:,0]))) | |
m[i,] = row | |
else: | |
m = np.vstack([m,row]) | |
m = m[1:,] | |
return(m) |
This file contains hidden or 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
for t in range(0,stream): | |
x = x0 + amplitude*np.cos(omega * t) | |
y = amplitude*np.cos(omega * t)*getobs(x,5,variance) | |
values = matrixpush(values, np.array([t,x,y])) | |
if np.all(np.isfinite(values[:,0])): | |
x0 = x0 + learnrate * sum( values[:,2] ) / inttime |