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
""" | |
Given a labyrinth bounded in Reuleaux's Triangle (or any triangle), let each V be any of the 3 vertices | |
and C be any of the 7 circuits. There are 3*7=21 segments in this labyrinth, and a path through it can be described | |
by going from one point (v_i, c_j) to some other point (v_k, c_l) where the following rules apply: | |
1. From a given starting point, one can either | |
a. traverse along the same circuit but different vertice (ie j = l), or | |
b. switch back along a neighboring circuit (ie l = c +/- 1) | |
2. Each segment can be traversed only once, implying points can be arrived at more than once only if as a switchback | |
in a neighboring tridant |
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
""" | |
Uses `flask_restful` and creates a Blueprint to be used by a parent project (ie a larger API project where | |
`/grafana/` endpoints are used by Grafana's SimpleJson plugin) | |
""" | |
from flask import Flask, request, jsonify, json, abort, Blueprint | |
from flask_cors import CORS, cross_origin | |
import flask_restful | |
import pandas as pd |
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
/* | |
Copyright 2011 Martin Hawksey | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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 math | |
class Welford(object): | |
""" Implements Welford's algorithm for computing a running mean | |
and standard deviation as described at: | |
http://www.johndcook.com/standard_deviation.html | |
can take single values or iterables | |
Properties: | |
mean - returns the mean |
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
""" MemcacheDataSource Class to pull data from memcache on demand for a simulation, minimizing data load time for a | |
simulation, and allowing Memcached stock data to be shared by multiple parallel simulations. | |
The MemCacheData class implements methods to act in compliance with the `zipline.algorithm.TradingAlgorithm.sources` | |
object: https://github.com/quantopian/zipline/blob/0.9.0/zipline/algorithm.py | |
This means implementing the following methods (with line numbers per v0.9.0 linked above): | |
* `sids` (Line 562) | |
* iterator (or generator) methods (439) like: | |
- '__iter__' |