This file contains 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 math | |
from math import cos, sin, sqrt, atan2, acos | |
def PatchFunction(thetaInDeg, phiInDeg, Freq, W, L, h, Er): | |
""" | |
Taken from Design_patchr | |
Calculates total E-field pattern for patch as a function of theta and phi | |
Patch is assumed to be resonating in the (TMx 010) mode. | |
E-field is parallel to x-axis |
This file contains 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
""" Functions dealing with rectangular patch antenna.""" | |
import math | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from sph2cart1 import sph2cart1 | |
from cart2sph1 import cart2sph1 | |
from math import cos, sin, sqrt | |
from mpl_toolkits.mplot3d import Axes3D | |
This file contains 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
""" | |
Function to calculate peak directivity. | |
Also includes some examples that are used to check result. | |
""" | |
from math import sin, sqrt, pi, log10, radians | |
import numpy as np | |
import patch | |
def SqrtSinPattern(Theta, Phi, *args): |
This file contains 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
""" | |
Returns the efficiency of a rectangular microstrip patch as a percentage. Based on ArrayCalc calc_patchr_eff.m. | |
References: | |
Microstrip Antennas, I.J Bahl and P.Bhartia, Published Atrech House, Page 60 | |
Advances in Microstrip and Printed Antennas", Lee and Chen (Ch5) | |
Some useful numbers : | |
CONDUCTORS DIELECTRICS |
This file contains 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 ArrayFactor(ElementArray, Freq): | |
""" | |
Summation of field contributions from each element in array, at frequency freq at theta 0°-95°, phi 0°-360°. | |
Element = xPos, yPos, zPos, ElementAmplitude, ElementPhaseWeight | |
Returns arrayFactor[theta, phi, elementSum] | |
""" | |
arrayFactor = np.ones((360, 95)) | |
Lambda = 3e8 / Freq |
This file contains 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 FieldSumPatch(ElementArray, Freq, W, L, h, Er): | |
""" | |
Summation of field contributions from each patch element in array, at frequency freq for theta 0°-95°, phi 0°-360°. | |
Element = xPos, yPos, zPos, ElementAmplitude, ElementPhaseWeight | |
Returns arrayFactor[theta, phi, elementSum] | |
""" | |
arrayFactor = np.ones((360, 95)) | |
Lambda = 3e8 / Freq |
This file contains 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 FieldSumHorn(ElementArray, Freq): | |
""" | |
Summation of field contributions from each horn element in array, at frequency freq for theta 0°-95°, phi 0°-360°. | |
Horn pattern estimate using cos q(theta) function. | |
Element = xPos, yPos, zPos, ElementAmplitude, ElementPhaseWeight | |
Returns arrayFactor[theta, phi, elementSum] | |
""" | |
arrayFactor = np.ones((360, 95)) |
This file contains 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
""" | |
13/07/18 | |
Reads csv file and plots lat/lng positions. | |
Markers are coloured to match satellite number when signal > -100 or are coloured red when signal = -100 | |
""" | |
import cartopy.crs as ccrs | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from datetime import datetime | |
import traceback |
This file contains 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 redis | |
import time | |
import traceback | |
def RedisCheck(): | |
try: | |
r = redis.StrictRedis(host='localhost', port=6379) # Connect to local Redis instance | |
p = r.pubsub() # See https://github.com/andymccurdy/redis-py/#publish--subscribe |
This file contains 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 WorkCheck(): | |
try: | |
# HERE SOME INITIAL WORK IS DONE THAT SCRIPTS 1 & 2 NEED TO WAIT FOR | |
# IDs SERIAL PORTS | |
# SAVE TO db | |
r = redis.StrictRedis(host='localhost', port=6379) # Connect to local Redis instance | |
p = r.pubsub() # See https://github.com/andymccurdy/redis-py/#publish--subscribe |