This file contains hidden or 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
# Interactive tuner for broadband coax-waveguide launcher | |
# Analytic formulae from Slater, / Microwave Transmission / | |
# Amar, version 7, 2013-04-09 | |
# Changes: | |
# v2: S-parameters and Smith plot | |
# v3: polar smith plot | |
# v4: S and T matrices to get at S12 phase, objectized circuit description. Reverted to cartesian smith plot. | |
# v5: double launcher configuration, freed up 'a' as parameter | |
# v6: cleaned up code, parameters are general and swappable now, plotting and tuning is modular | |
# v7: phase and amplitude sensitivity plots |
This file contains hidden or 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 test2(x): | |
""" Sieve of Eratosthenes """ | |
p = [] | |
mask = range(2,x-1) | |
while len(mask)>0: | |
p.append(mask[0]) | |
del mask[::p[-1]] | |
return p |
This file contains hidden or 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 pylab as plt | |
import numpy as np | |
def primes(x): | |
p = [] | |
mask = range(2,x-1) | |
while len(mask)>0: | |
p.append(mask[0]) | |
del mask[::p[-1]] |
This file contains hidden or 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
# Evaluating zeta functions using Parseval sums | |
# Amar | |
# version 1, Aug 2013 | |
from sympy import * | |
from sympy import init_printing | |
init_printing() | |
n = symbols('n',integer=True) | |
s = symbols('s',rational=True) |
This file contains hidden or 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
# Display webcam image, plus plasma diagnostics | |
# version 2, 2013-09-25 | |
# Amar | |
# Changelog: | |
# v2: Very slight modification of http://matplotlib.org/examples/animation/dynamic_image.html | |
import numpy as np | |
import cv2 | |
import time | |
import matplotlib.animation as animation |
This file contains hidden or 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
# Filtering utilities | |
import numpy as np | |
from numpy import pi | |
from numpy import fft | |
from scipy import signal | |
import scipy.signal as sig | |
import pylab as plt | |
#### Functions ################# |
This file contains hidden or 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
# Bloch sphere | |
# Amar Vutha, 2013-08-31 | |
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
import numpy as np | |
# Basic Bloch sphere | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') |
This file contains hidden or 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 os, subprocess | |
os.chdir("c:/Program Files (x86)/eSpeak/command_line/") | |
speakString = "This parrot is no more. It has ceased to be. It's expired and gone to meet its maker. This is a late parrot. It's a stiff. Bereft of life, it rests in peace. If you hadn't nailed it to the perch, it would be pushing up the daisies. It's rung down the curtain and joined the choir invisible. This is an ex-parrot." | |
subprocess.call(["espeak","-ven+f5",`speakString`]) |
This file contains hidden or 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
# Controlling the MixNV (Windfreak Technologies) rf synthesizer | |
# Amar Vutha | |
# version 1 | |
import serial | |
import numpy as np | |
import time | |
usbPort = "/dev/ttyACM0" | |
sleepTime = 0.01 |
This file contains hidden or 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
# Plot log files | |
# version 3 | |
# Amar | |
# Changes: v2: 2012/11/27: Date & time display using native matplotlib, instead of unix timestamp | |
# v3: 2013/10/10: Rewritten completely using matplotlib animation, and slider for selectable range | |
import numpy as np | |
import random | |
import os | |
os.chdir("c:/data/googledrive/logs") |
OlderNewer