diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09ba14d --- /dev/null +++ b/.gitignore @@ -0,0 +1,62 @@ +# Created by .ignore support plugin (hsz.mobi) +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + + diff --git a/arduino-laser/laser.py b/arduino-laser/laser.py index 9d3cc04..46a728c 100644 --- a/arduino-laser/laser.py +++ b/arduino-laser/laser.py @@ -19,13 +19,16 @@ cleaning up """ -import sys, serial, struct -import pyaudio -import numpy -import math +import struct from time import sleep import argparse +import numpy + +import serial +import pyaudio + + # manual test for sending motor speeds def manualTest(ser): print('staring manual test...') diff --git a/arduino-laser/test_fft.py b/arduino-laser/test_fft.py index 00bea57..5e43679 100644 --- a/arduino-laser/test_fft.py +++ b/arduino-laser/test_fft.py @@ -8,13 +8,13 @@ """ +import math + import numpy as np -import sys + from matplotlib import pyplot -from time import sleep -import argparse import pyaudio -import math + N = 4096 diff --git a/ascii/ascii.py b/ascii/ascii.py index 93fdde2..0bd7eca 100644 --- a/ascii/ascii.py +++ b/ascii/ascii.py @@ -6,12 +6,12 @@ Author: Mahesh Venkitachalam """ -import sys, random, argparse -import numpy as np -import math +import argparse +import numpy as np from PIL import Image + # gray scale level values from: # http://paulbourke.net/dataformats/asciiart/ diff --git a/autos/autos.py b/autos/autos.py index be52256..4a866bc 100644 --- a/autos/autos.py +++ b/autos/autos.py @@ -6,9 +6,12 @@ Author: Mahesh Venkitachalam """ -import sys, random, argparse +import random +import argparse + from PIL import Image, ImageDraw + # create spacing/depth example def createSpacingDepthExample(): tiles = [Image.open('test/a.png'), Image.open('test/b.png'), diff --git a/boids/boids.py b/boids/boids.py index 5f55145..9c258ce 100644 --- a/boids/boids.py +++ b/boids/boids.py @@ -6,14 +6,18 @@ Author: Mahesh Venkitachalam """ -import sys, argparse +import argparse import math + import numpy as np -import matplotlib.pyplot as plt -import matplotlib.animation as animation -from scipy.spatial.distance import squareform, pdist, cdist from numpy.linalg import norm +import matplotlib.pyplot as plt +import matplotlib.animation as animation + +from scipy.spatial.distance import squareform +from scipy.spatial.distance import pdist + width, height = 640, 480 class Boids: diff --git a/common/glutils.py b/common/glutils.py index c8362cb..fd25ceb 100644 --- a/common/glutils.py +++ b/common/glutils.py @@ -6,15 +6,16 @@ Some OpenGL utilities. """ -import OpenGL -from OpenGL.GL import * -from OpenGL.GL.shaders import * +import math -import numpy, math +import numpy import numpy as np - from PIL import Image +from OpenGL.GL import * +from OpenGL.GL.shaders import * + + def loadTexture(filename): """load OpenGL 2D texture from given image file""" img = Image.open(filename) diff --git a/conway/conway.py b/conway/conway.py index 1499c0f..8bf95cc 100644 --- a/conway/conway.py +++ b/conway/conway.py @@ -6,11 +6,14 @@ Author: Mahesh Venkitachalam """ -import sys, argparse +import argparse + import numpy as np -import matplotlib.pyplot as plt + +import matplotlib.pyplot as plt import matplotlib.animation as animation + ON = 255 OFF = 0 vals = [ON, OFF] diff --git a/karplus/ks.py b/karplus/ks.py index 2a398da..f84ce4d 100644 --- a/karplus/ks.py +++ b/karplus/ks.py @@ -7,13 +7,19 @@ Author: Mahesh Venkitachalam """ -import sys, os -import time, random -import wave, argparse, pygame -import numpy as np +import os +import time +import random +import wave +import argparse from collections import deque + +import numpy as np + +import pygame from matplotlib import pyplot as plt + # show plot of algorithm in action? gShowPlot = False diff --git a/karplus/sine.py b/karplus/sine.py index da1a032..ffcc344 100644 --- a/karplus/sine.py +++ b/karplus/sine.py @@ -6,8 +6,11 @@ Author: Mahesh Venkitachalam """ +import wave +import math + import numpy as np -import wave, math + sRate = 44100 nSamples = sRate * 5 diff --git a/particle-system/box.py b/particle-system/box.py index af4d724..8019386 100644 --- a/particle-system/box.py +++ b/particle-system/box.py @@ -6,12 +6,12 @@ Author: Mahesh Venkitachalam """ -import sys, random, math -import OpenGL -from OpenGL.GL import * import numpy + +from OpenGL.GL import * import glutils + strVS = """ #version 330 core diff --git a/particle-system/ps.py b/particle-system/ps.py index 9207ed5..91990d6 100644 --- a/particle-system/ps.py +++ b/particle-system/ps.py @@ -6,12 +6,15 @@ Description: A particle system class """ -import sys, random, math -import OpenGL -from OpenGL.GL import * +import random +import math + import numpy + +from OpenGL.GL import * import glutils + strVS = """ #version 330 core diff --git a/particle-system/psmain.py b/particle-system/psmain.py index be72496..4f88bb5 100644 --- a/particle-system/psmain.py +++ b/particle-system/psmain.py @@ -6,15 +6,15 @@ Description: A particle system """ -import sys, os, math, numpy -import OpenGL +import os + from OpenGL.GL import * -import numpy from ps import ParticleSystem, Camera from box import Box import glutils import glfw + class PSMaker: """GLFW Rendering window class for Particle System""" def __init__(self): diff --git a/photomosaic/photomosaic.py b/photomosaic/photomosaic.py index 781e32a..8f89d51 100644 --- a/photomosaic/photomosaic.py +++ b/photomosaic/photomosaic.py @@ -6,11 +6,15 @@ Author: Mahesh Venkitachalam """ -import sys, os, random, argparse -from PIL import Image +import os +import random +import argparse import imghdr + +from PIL import Image import numpy as np + def getAverageRGBOld(image): """ Given PIL Image, return average value of color as (r, g, b) diff --git a/piweather/piweather.py b/piweather/piweather.py index 8551c88..e0abe87 100644 --- a/piweather/piweather.py +++ b/piweather/piweather.py @@ -6,13 +6,16 @@ Author: Mahesh Venkitachalam """ -from bottle import route, run, request, response +import argparse + +from bottle import route, run, request + from bottle import static_file -import random, argparse + import RPi.GPIO as GPIO -from time import sleep import Adafruit_DHT + @route('/hello') def hello(): return "Hello Bottle World!" diff --git a/playlist/playlist.py b/playlist/playlist.py index c4d55df..5c624f3 100644 --- a/playlist/playlist.py +++ b/playlist/playlist.py @@ -8,12 +8,13 @@ Website: electronut.in """ -import re, argparse -import sys -from matplotlib import pyplot +import argparse import plistlib + import numpy as np +from matplotlib import pyplot + def findCommonTracks(fileNames): """ diff --git a/simplegl/simpleglfw.py b/simplegl/simpleglfw.py index 89c4dbd..a5ac728 100644 --- a/simplegl/simpleglfw.py +++ b/simplegl/simpleglfw.py @@ -7,12 +7,13 @@ Author: Mahesh Venkitachalam """ -import OpenGL -from OpenGL.GL import * +import math +import os -import numpy, math, sys, os -import glutils +import numpy +from OpenGL.GL import * +import glutils import glfw strVS = """ diff --git a/spirograph/spiro.py b/spirograph/spiro.py index 8894a79..b5fe39f 100644 --- a/spirograph/spiro.py +++ b/spirograph/spiro.py @@ -7,15 +7,16 @@ Website: electronut.in """ -import sys, random, argparse -import numpy as np +import argparse import math import turtle import random -from PIL import Image -from datetime import datetime +from datetime import datetime from fractions import gcd +from PIL import Image + + # A class that draws a spirograph class Spiro: # constructor diff --git a/volrender/makedata.py b/volrender/makedata.py index c4e6ee1..1ec2fe1 100644 --- a/volrender/makedata.py +++ b/volrender/makedata.py @@ -6,10 +6,13 @@ Author: Mahesh Venkitachalam """ -import sys, os +import os + import numpy as np + import Image + def makeSphereCuboid(): """create a volume with a sphere and a cuboid inside""" Nx, Ny, Nz = 256, 256, 256 diff --git a/volrender/raycast.py b/volrender/raycast.py index 84e7a55..475ae12 100644 --- a/volrender/raycast.py +++ b/volrender/raycast.py @@ -7,15 +7,11 @@ the Ray Casting method. """ +import math -import OpenGL from OpenGL.GL import * from OpenGL.GL.shaders import * -import numpy as np -import math, sys - -import raycube, glutils, volreader strVS = """ #version 330 core diff --git a/volrender/raycube.py b/volrender/raycube.py index 3f77975..39530ca 100644 --- a/volrender/raycube.py +++ b/volrender/raycube.py @@ -6,12 +6,11 @@ Generates texture that has the cube/ray computation. """ -import OpenGL +import numpy + from OpenGL.GL import * from OpenGL.GL.shaders import * -import numpy, math, sys -import volreader, glutils strVS = """ #version 330 core diff --git a/volrender/slicerender.py b/volrender/slicerender.py index bf397e1..fd84f90 100644 --- a/volrender/slicerender.py +++ b/volrender/slicerender.py @@ -7,12 +7,11 @@ of a Volumetric data set. """ -import OpenGL +import numpy + from OpenGL.GL import * from OpenGL.GL.shaders import * -import numpy, math, sys -import volreader, glutils strVS = """ # version 330 core diff --git a/volrender/volreader.py b/volrender/volreader.py index 1e072e7..6a0abb9 100644 --- a/volrender/volreader.py +++ b/volrender/volreader.py @@ -7,13 +7,12 @@ """ import os + import numpy as np from PIL import Image -import OpenGL from OpenGL.GL import * -from scipy import misc def loadVolume(dirName): """read volume from directory as a 3D texture""" diff --git a/volrender/volrender.py b/volrender/volrender.py index f047cdd..0aa6d89 100644 --- a/volrender/volrender.py +++ b/volrender/volrender.py @@ -7,11 +7,14 @@ """ -import sys, argparse, os +import argparse +import os + from slicerender import * from raycast import * import glfw + class RenderWin: """GLFW Rendering window class""" def __init__(self, imageDir):