Skip to content

Instantly share code, notes, and snippets.

View CamDavidsonPilon's full-sized avatar
:shipit:
Learning bio brb

Cameron Davidson-Pilon CamDavidsonPilon

:shipit:
Learning bio brb
View GitHub Profile
# -*- coding: utf-8 -*-
from __future__ import annotations
import signal
from pioreactor.automations import LEDAutomationContrib
from pioreactor.automations import events
from pioreactor.actions.led_intensity import LED_Channel
__plugin_summary__ = "An LED automation for ON/OFF cycles"
__plugin_version__ = "0.0.2"
__plugin_name__ = "Light Dark Cycle LED automation"
@CamDavidsonPilon
CamDavidsonPilon / install_pioreactor_as_leader.sh
Last active March 31, 2021 17:59
TODO: make these absolute paths
#!/bin/bash
sudo apt update
sudo apt install -y git
git clone https://github.com/Pioreactor/pioreactor.git --depth 1
cd pioreactor
make install-leader
#!/bin/bash
sudo apt update
sudo apt install -y git
git clone https://github.com/Pioreactor/pioreactor.git --depth 1
cd pioreactor
make install-worker-from-args newHostname=$1
#!/bin/bash
sudo apt update
sudo apt install -y git
git clone https://github.com/Pioreactor/pioreactor.git --depth 1
cd pioreactor
make install-leader-as-worker
votes scaled_prob
64.02877697841728 0
79.85611510791367 0
93.52517985611513 0
107.19006190396522 0.0
120.14388489208633 0
135.97122302158274 0
151.07913669064752 0
159.70386481512466 0.011627906976744207
173.36038146227202 0.02906976744186074
@CamDavidsonPilon
CamDavidsonPilon / nodered.json
Last active June 30, 2020 18:11
Part of tempeh.io blog post
[
{
"id": "328cb8d0.ad53d8",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "e064c4c9.ed0b18",
import time
import board
import adafruit_dht
from paho.mqtt import publish
# Initial the dht device, with data pin connected to:
dhtDevice = adafruit_dht.DHT22(board.D21)
while True:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Our model is
log(cell/ml) = alpha * (secchi stick depth) + intercept + Noise
However, our cell/mL comes from a noisy hemocytometer, and our
depth measured with the secchi stick is also noisy. Our goal is
still to infer alpha & intercept as well as possible, so we can
dump the hemocytometer.
# test previous algorithm
actuals = pd.read_csv("https://gist.githubusercontent.com/csaid/a57c4ebaa1c7b0671cdc9692638ea4c4/raw/ad1709938834d7bc88b62ff0763733502eb6a329/shower_problem_tau_samples.csv")
DELTA = 0.1
def survival_function(t, lambda_=50., rho=1.5):
# Assume simple Weibull model
return np.exp(-(t/lambda_) ** rho)