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 seaborn as sns | |
import matplotlib.pylab as plt | |
import pandas as pd | |
import csv | |
import datetime | |
reader = csv.reader(open('StatePopulations.csv')) | |
statePopulations = {} |
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
echo "Clearing old data..." | |
rm -rf covid-19-data/ | |
rm us-states.csv | |
echo "Getting new data..." | |
git clone https://github.com/nytimes/covid-19-data | |
echo "Done." | |
cp covid-19-data/us-states.csv . | |
echo "Starting..." |
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
#!/usr/bin/env python | |
rh = { | |
"username": "", | |
"password": "", | |
} | |
config = { | |
"statusEmailAddress": "[email protected]", | |
"buyLimit": 0.0075, |
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
class coin: | |
purchasedPrice = 0.0 | |
numHeld = 0.0 | |
numBought = 0.0 | |
name = "" | |
lastBuyOrder = "" | |
timeBought = "" | |
def __init__(self, name=""): | |
print("Creating coin " + name) |
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
# generate moving averages | |
for c in self.coinList: | |
colName = c + "-MA" | |
self.data[colName] = self.data[c].shift(1).rolling(window=self.movingAverageWindows).mean() | |
colName = c + "-RSI" | |
self.data[colName] = talib.RSI(self.data[c].values, timeperiod = self.rsiWindow) |
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
def buy(self, c, price): | |
#we are already in the process of a buy, don't submit another | |
if self.boughtIn == True: | |
print("Previous buy incomplete.") | |
return | |
availableCash = self.getCash() | |
if availableCash == -1: | |
print("Got an exception checking for available cash, canceling buy.") |
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
# Calculate wheel speeds in m/s | |
#reference https://snapcraft.io/blog/your-first-robot-the-driver-4-5 | |
left_wheel_vel = data.linear.x - ((data.angular.z * wheel_base) / 2.0) | |
right_wheel_vel = data.linear.x + ((data.angular.z * wheel_base) / 2.0) | |
# convert the required wheel speeds in m/s into rpms | |
c = math.pi * wheel_diameter # wheel circumference in meters | |
right_rpm = int((right_wheel_vel / c) * 60.0 * gear_ratio) | |
left_rpm = int((left_wheel_vel / c) * 60.0 * gear_ratio) |
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
def l_tick_cb(msg): | |
global wheel_diameter | |
global l_distance | |
global l_vel | |
ticks = msg.data | |
l_distance = ((ticks / 32.0) / 56.0) * (math.pi * wheel_diameter) | |
l_vel = l_distance * 20.0 | |
l_rpm_actual = (ticks / 32.0) * 20.0 * 60.0 | |
#print("l_vel: " + str(l_vel)) |
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
# compute the overall motion of the robot since last update | |
vec_v = (r_vel + l_vel) / 2.0 | |
ang_vel = (r_vel - l_vel) / wheel_base | |
# decompose into x, y components of velocity vector | |
vx = vec_v * math.cos(ang_vel) | |
# calculate angular velocity | |
vy = vec_v * math.sin(ang_vel) |
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
str2str -in ntrip://username:password@caster_ip_address:port/ODOT_VRS_RTCM3 -n 1 -b 1 -out serial://ttyACM0:38400:8:n:1 |
OlderNewer