Skip to content

Instantly share code, notes, and snippets.

View jasonmhite's full-sized avatar

Jason Hite jasonmhite

View GitHub Profile
#!/usr/bin/env python3
import paho.mqtt.client as mqtt
from influxdb import InfluxDBClient
TOPIC = "/sensors/#"
DB_SRV = {
"host": "#.#.#.#",
"username": "#",
"password": "#",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Text.Parsec
import Text.Parsec.String
import Text.Parsec.Char
import Control.Monad
import Data.List
import Data.Either
#!/usr/bin/env python3
import paho.mqtt.client as mqtt
from influxdb import InfluxDBClient
from math import isnan
MQTT_ADDR = 'raspi'
TOPIC = "/sensors/#"
DB_SRV = {
"host": "###",
import gefry3 # My model code
import pymc
import numpy as np
import seaborn as sb
from scipy.stats import multivariate_normal
# P is an object that encompasses the geometry and problem, can be
# called to compute detector response
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from scipy.optimize import minimize
def least_squares(A, b, x0): # Least-squares solution for Ax=b, initial guess of x0
return minimize(
lambda x: np.linalg.norm(A.dot(x) - b),
x0,
)
def least_squares_tikhonov(A, b, alpha, x0): # Least squares for Ax=b with simple Tikhonov regularization
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jasonmhite
jasonmhite / solid_angle.py
Last active January 12, 2018 19:06
Computation of the solid angle of an oriented right triangle in free space
##################################################################################
# Copyright (c) 2018, Jason M. Hite
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
@jasonmhite
jasonmhite / bme280.py
Created August 20, 2018 17:04
BMP280 pyFTDI
import pyftdi as F
from pyftdi import i2c
from ctypes import c_short
from time import sleep
import atexit
### Some utility functions