Skip to content

Instantly share code, notes, and snippets.

View cversek's full-sized avatar

Craig Versek cversek

  • Northeastern University
  • Boston, MA
View GitHub Profile
import time, socket
doc = """
<!DOCTYPE html>
<html>
<head> <title>ESP8266 Pins</title> </head>
<body> <h1>ESP8266 Pins</h1>
<table border="1"> <tr><th>Pin</th><th>Value</th></tr> s </table>
@cversek
cversek / README.md
Created June 10, 2016 02:12
These are simple pygame based pendulum physics simulations.

auth: Craig Wm. Versek (cversek@gmail.com) dates: gist created 2016/06/09 based directly from code written circa 2008 while I was a PhD candidate at UMass Amherst

These are simple pygame based pendulum physics simulations that started with a simple idea: perform the numerical integration (the "physics") within an infinite generator loop, supplying the parameters to the graphics rendering code on demand. The thought was to separate the number crunching from the application at large and simplify its organization and portability. The code can be configured to use one of a few numerical integration methods by swapping generators with the same interface. pygame is the only dependency that needs to be installed.

phys_gen.py illustrates the basic concept with no bells & whistles (nor graphics).

pendulum.py is a pygame driven simple pendulum interactive simulation -- try clicking and dragging the bob. Can use Heun, Steormer_Verlet, or RK4 methods.

doubled_pedulum.py has two double pendula running in

@cversek
cversek / cmap_gaussianHSV.py
Last active December 17, 2015 14:09
Tunable Gaussian HSV Colormap
import numpy as np
import matplotlib
def make_cmap_guassianHSV( num_segs = 100, #number of segments
bandwidth = 0.25,
red_center = 1.00,
green_center = 0.75,
blue_center = 0.50,
name = "gaussianHSV"
):
@cversek
cversek / jeffs_HSV_colormap_demo.py
Last active December 17, 2015 13:29
Jeff's HSV Colormap in Matplotlib
from pylab import *
cdict = {
'red' : ((0.00, 0.00, 0.00),
(0.20, 0.00, 0.00),
(0.40, 0.00, 0.00),
(0.60, 0.00, 0.00),
(0.80, 1.00, 1.00),
(1.00, 1.00, 1.00)),
'green': ((0.00, 0.00, 0.00),
(0.20, 0.00, 0.00),
@cversek
cversek / stuporblue_ndvi.py
Last active December 17, 2015 13:19
Compute NDVI from StuporBlue Image
################################################################################
# this is code to compute NDVI from Blue (Visible channel) and Red (Infrared)
# such as pictures taken with "SuperBlue" camera
from PIL import Image
import numpy
img = Image.open("IMG_0512.JPG")
imgR, imgG, imgB = img.split() #get channels
#convert to double precision floating point..is this overkill? probably, could try 'float32' or 'float16'
arrR = numpy.asarray(imgR).astype('float64')