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
/* | |
Bookmarklet to download image / movie from tadpoles | |
Sources: | |
https://gist.github.com/sfrdmn/8834747 by sfrdmn, unlicenced but I hope you won't sue me :3 | |
https://stackoverflow.com/a/49500465/2550406 by Leeroy, CC-BY-SA | |
*/ | |
;(function() { | |
// Probably should do some validation, but whatever | |
var images = [window.location.href + "?d=t"] |
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
var simulateMouseEvent = function(element, eventName, coordX, coordY) { | |
element.dispatchEvent(new MouseEvent(eventName, { | |
view: window, | |
bubbles: true, | |
cancelable: true, | |
clientX: coordX, | |
clientY: coordY, | |
button: 0 | |
})); | |
}; |
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
/* | |
Bookmarklet to download image / movie from tadpoles | |
Sources: | |
https://gist.github.com/sfrdmn/8834747 by sfrdmn, unlicenced but I hope you won't sue me :3 | |
https://stackoverflow.com/a/49500465/2550406 by Leeroy, CC-BY-SA | |
*/ | |
;(function() { | |
// Probably should do some validation, but whatever | |
var l = document.links; |
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 cg(A, b, x0=None, maxiter=None, tol=1e-5): | |
x = x0 or np.zeros_like(b) | |
k = 0 | |
kmax = maxiter or len(b) | |
r = b - A @ x | |
p = r | |
d_o = np.dot(r, r) | |
d_n = d_o |
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
diff --git a/pid.txt b/pid.txt | |
index e453170..3015dbf 100644 | |
--- a/pid.txt | |
+++ b/pid.txt | |
@@ -1,6 +1,6 @@ | |
-def _PID_update(self, dt): | |
+def _Predictive_PID_update(self, dt): | |
''' | |
- This instantiates the PID control algorithms. | |
+ This instantiates the Predictive PID control algorithms. |
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
diff --git a/vent/controller/control_module.py b/vent/controller/control_module.py | |
index 3a7b724..ff819f3 100644 | |
--- a/vent/controller/control_module.py | |
+++ b/vent/controller/control_module.py | |
@@ -610,17 +610,18 @@ class ControlModuleBase: | |
self._DATA_VOLUME += dt * self._DATA_Qout # Integrate what has happened within the last few seconds from flow out | |
self._DATA_PRESSURE = np.mean(self._DATA_PRESSURE_LIST) | |
+ self.__control_signal_in = self._adaptivecontroller.feed(self._DATA_PRESSURE, now) | |
+ |
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
diff --git a/vent/controller/control_module.py b/vent/controller/control_module.py | |
index 3a7b724..ff819f3 100644 | |
--- a/vent/controller/control_module.py | |
+++ b/vent/controller/control_module.py | |
@@ -610,17 +610,18 @@ class ControlModuleBase: | |
self._DATA_VOLUME += dt * self._DATA_Qout # Integrate what has happened within the last few seconds from flow out | |
self._DATA_PRESSURE = np.mean(self._DATA_PRESSURE_LIST) | |
+ self.__control_signal_in = self._adaptivecontroller.feed(self._DATA_PRESSURE, now) | |
+ |
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
diff --git a/wilhelm/control/eastman.py b/wilhelm/control/eastman.py | |
index a3d1ade..1defdbb 100644 | |
--- a/wilhelm/control/eastman.py | |
+++ b/wilhelm/control/eastman.py | |
@@ -27,13 +27,23 @@ grad_loss = jax.grad(counterfact_loss, (0, 1)) | |
def rolls_by_eastman(env_true, env_sim, U_old, k, K, X_old, D, F, alpha, w_is): | |
- H, M, lr, C = 3, 3, 0.001, 1. | |
+ H, M, lr, C = 3, 3, 0.1, 1. |
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
""" | |
Predicts final votes by taking current votes, % counted, and current margin. | |
Two pro-Trump biases: | |
1. Does not factor in mail-in bias | |
2. We strip off the ">" in ">98%". Many more of the small counties (which are R) have reported | |
""" | |
import bs4 | |
import requests |
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 bs4 | |
import requests | |
import pandas as pd | |
def scrape(state): | |
soup = bs4.BeautifulSoup(requests.get(f"https://www.foxnews.com/elections/2020/general-results/state/{state}").content.decode("utf-8")) | |
section = soup.find_all("section", class_="is-president")[0] | |
section = section.find_all("div", class_="race-table")[0] | |
tables = section.find_all("table") | |