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
from skyfield.api import load | |
from scipy import optimize | |
from datetime import datetime | |
from dateutil import tz | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def earthPosition(t1): |
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(data.table) | |
library(gridExtra) | |
library(zoo) | |
babyTiming<-function(ExpectedDate="2016/02/29",DateofInterest="2016/02/2015",VacationDuration=14){ | |
DateofInterest<-as.Date(DateofInterest) | |
ExpectedDate<-as.Date(ExpectedDate) | |
currentDate<-Sys.Date() | |
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(data.table) | |
library(lubridate) | |
library(stringr) | |
options(stringsAsFactors = FALSE) | |
# Data Source: Statistics Canada (Table 358-163) | |
#(http://www5.statcan.gc.ca/cansim/a26?lang=eng&retrLang=eng&id=3580163&&pattern=&stByVal=1&p1=1&p2=31&tabMode=dataTable&csid=) |
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(data.table) | |
library(lubridate) | |
# Source: https://stats.oecd.org/index.aspx?queryid=350 | |
dt.gdp<-data.table(read.csv("~/Downloads/QNA_10102015180610407.csv")) | |
dt.gdp[,Year:=substr(TIME,1,4),] | |
dt.gdp[,Qtr:=substr(TIME,7,7),] | |
dt.gdp[,Month:=as.numeric(Qtr)*3-1,] |
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(data.table) | |
# Metric Table | |
dt.forceCarb<-data.table(expand.grid(Pressure_bar=seq(0,2,by=0.1),Temperature_C=seq(0,25,by=1))) | |
dt.forceCarb[,CO2_gl := (Pressure_bar+1.013)*(2.71828182845904^(-10.73797+(2617.25/(Temperature_C+273.15))))*10,] | |
dt.forceCarb[,CO2_vol:=CO2_gl/1.96,] | |
dt.forceCarb[,Carbonation:="Over-Carbonated",] | |
dt.forceCarb[CO2_vol<4,Carbonation:="Highly Carbonated (Lambics / Wheat Beers)",] |
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(png) | |
#test<-readPNG("~/Desktop/StormTrooper-loading.png") | |
#test<-round(test*9,0) | |
#for(i in 1:48){ | |
# message(paste0(paste0(test[i,1:48,1],collapse=","),",")) | |
#} | |
test<-matrix(data = c( |
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) | |
r2d2.pixels<-matrix(data = c( | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
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) | |
f1=jitter(sample(c(2,3),1));f2=jitter(sample(c(2,3),1));f3=jitter(sample(c(2,3),1));f4=jitter(sample(c(2,3),1)) | |
d1=runif(1,0,1e-02);d2=runif(1,0,1e-02);d3=runif(1,0,1e-02);d4=runif(1,0,1e-02) | |
p1=runif(1,0,pi);p2=runif(1,0,pi);p3=runif(1,0,pi);p4=runif(1,0,pi) | |
xt = function(t) exp(-d1*t)*sin(t*f1+p1)+exp(-d2*t)*sin(t*f2+p2) | |
yt = function(t) exp(-d3*t)*sin(t*f3+p3)+exp(-d4*t)*sin(t*f4+p4) | |
t=seq(1, 100, by=.001) | |
dat=data.frame(t=t, x=xt(t), y=yt(t)) | |
ggplot(dat,aes(x=x,y=y))+geom_point(cex=0.2)+theme_bw()+theme(line = element_blank(), |
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
sunPosition <- function(year, month, day, hour=12, min=0, sec=0, | |
lat=46.5, long=6.5) { | |
twopi <- 2 * pi | |
deg2rad <- pi / 180 | |
# Get day of the year, e.g. Feb 1 = 32, Mar 1 = 61 on leap years | |
month.days <- c(0,31,28,31,30,31,30,31,31,30,31,30) | |
day <- day + cumsum(month.days)[month] | |
leapdays <- year %% 4 == 0 & (year %% 400 == 0 | year %% 100 != 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
# AB River Data | |
# Packages | |
require(data.table) | |
require(ggplot2) | |
require(reshape) | |
require(gridExtra) | |
# Load data (to maintain history, after AEnv removes older data...) | |
if(file.exists("river_data.Rda")){load("river_data.Rda")} |
NewerOlder