Helios.waitTimes = [] timeSteps = [] frame = Helios.getFrame() #frame.append(wiggleCircle(elapsed)) #frame.append(wiggleCircle(elapsed, timeFactor = 1.2, # timeOffset = 2.0, numPoints = 500, baseRadius = 0.3, # circleSpin = -0.1, blanks=2.0, waveSize = 0)) #rectX = math.sin(elapsed) * 0.3 #rectY = math.cos(elapsed) * 0.3 #frame.append(rect(rectX, rectY)) boundingBox = rect(-1, -1, 2, 2, 200) #frame.append(clem.getPoints(frameNum, scaleX = 1.0, scaleY = 1.0, # ySkipRatio = 4.0, xSkipRatio = 2.0, brightnessDwell = 8), # blankGap = 0, dwellStart = 0, dwellEnd = 0) #frame.append(circle()) frame.append(clock.getPoints(curTime)) #frame.append(boundingBox) statusAttempts = Helios.waitForDac() Helios.draw(frame) lastTime = curTime
# lamda = c/fc; # BlindRange_m = c*T/2/PulseCompressionGain; # UnambiguousRange_m = c*PRI/2; # RangeResolution_m = c/(2*B); # UnambiguousVelocity_cms = PRF/2*lamda/2*100; # ## Generate the transmit pulse # Generate Transmit signal Tx_Signal = zeros(1, size(t,2)); for Count_PulseNum = 1: NumPulses tdn = PRI * (Count_PulseNum - 1); Tx_Signal = Tx_Signal + cos(2*pi*(fc*(t - T/2 - tdn) + 0.5 * K * (t - T/2 - tdn)**2) ) * rect( (t - T/2 - tdn)/T ); end figure; plot(t, Tx_Signal); xlabel('Time (s)'); ylabel('Transmit Signal'); # soundsc(Tx_Signal, fs, 24); # 24 bit sound, sampled at 44.1 kHz # Generate the transmit pulse NumSamplesTxPulse = ceil(T/ts); # number of samples of the transmit pulse Tx_p = Tx_Signal(1: NumSamplesTxPulse); # transmit pulse only ## Testing Chirp t = 0: ts: T-ts;
def petits_rect(A, eps): centres, rayons = disque(A, eps) n, r = np.shape(A) centre2 = [] rayons2 = [] tmp2 = [] max_r = [] min_r = [] max_i = [] min_i = [] liste = np.zeros((n, n)) tmp = np.zeros((n, n)) for i in range(n): for j in range(i, n): dist = np.sqrt((((centres[i].real) - (centres[j].real))**2) + ((centres[i].imag) - (centres[j].imag))**2) if (dist < rayons[i] + rayons[j]): liste[i, j] = 1 liste[j, i] = 1 while ((tmp != liste).any()): tmp = liste for i in range(n): for j in range(n): if (liste[i, j] == 1): for k in range(n): if (liste[i, k] == 1 & k != j): liste[j, k] = 1 if (liste[k, j] == 1 & k != i): liste[k, i] = 1 i = 1 while (i < n): if (i in tmp2): i = i + 1 else: for j in range(n): if (liste[i, j] == 1): centre2.append(centres[i]) centre2.append(centres[j]) rayons2.append(rayons[i]) rayons2.append(rayons[j]) tmp2.append(j) i = i + 1 maxre, minre, maxim, minim = rect(centre2, rayons2) max_r.append(maxre) min_r.append(minre) max_i.append(maxim) min_i.append(minim) centre2 = [] rayons2 = [] #Calcule la taille des petits rects s = np.size(max_r) taille_rect = np.zeros(s) for i in range(s): taille_rect.itemset(i, (max_r[i] - min_r[i]) * (max_i[i] - min_i[i])) #Calcule la taille du grand rect grand_rect_max_r, grand_rect_min_r, grand_rect_max_i, grand_rect_min_i = rect( centres, rayons) taille_grand_rect = (grand_rect_max_r - grand_rect_min_r) * ( grand_rect_max_i - grand_rect_min_i) #m_scalar to re-calcule new "m" m_scalar = min(taille_rect.item( np.argmax(taille_rect)), taille_grand_rect) / max( taille_rect.item(np.argmax(taille_rect)), taille_grand_rect) return max_r, min_r, max_i, min_i, m_scalar #, max_r_grand_rect,min_r_grand_rect,max_i_grand_rect,min_i_grand_rect
from control import * from menu import * from rect import rect, point, size from sound import * rPString("hello") rCString("goodbye") # rMenuItem("Hello") rMenuBar(rMenu("@", rMenuItem("About..."), rMenuItem("Preferences...")), rMenu(" File ", rMenuItem("New", "Nn"), rMenuItem("Open", "Oo")), id=1) rTwoRects(rect(x=0, y=0, height=10, width=10), (1, 2, 3, 4)) rRectList(rect(x=0, y=0, height=10, width=10), (1, 2, 3, 4)) rSimpleButton(rect(x=10, y=10, height=13, width=90), "Save", default=True) rWindParam1(rect(x=20, y=20, height=100, width=100), "hello") rControlList( rThermometerControl((5, 5, 10, 55), value=10, scale=100), rStatTextControl((5, 5, 10, 55), "this is a test…", centerJust=True, fSquishText=True)) rCString("this is a long string with\r\n" "extra characters and stuff …")
def registerXYXY(self, x1,y1,x2,y2, action, timedAction=None, layer=0): if timedAction: # at least one timed action self.timedActionInProgress = True area = rect(x1, y1, x2-x1, y2-y1) self.register(area, action, timedAction, layer)
def registerXYWH(self, x1, y1, dx, dy, action, timedAction=None, layer=0): if timedAction: # at least one timed action self.timedActionInProgress = True area = rect(x1, y1, dx, dy) self.register(area, action, timedAction, layer)
def registerDraggable(self, x1, y1, x2, y2, module): self.dragAreas.append((rect(x1, y1, x2-x1, y2-y1), module))
import numpy as np import matplotlib.pyplot as plt import rect as r import prop as prop L1 = 0.5 #side length M = 250 #number of samples step1 = L1/M #step size x1 = np.linspace(-L1/2,L1/2,M) #input support coordinates y1 = x1 wavel = 0.5*10**(-6) # wavelength of light k = 2*np.pi/wavel #wavevector w = 0.011 #width of square aperture z = 2000 # propogation distance X1,Y1 = np.meshgrid(x1,y1) u1 = np.multiply(r.rect(X1/(2*w)),r.rect(Y1/(2*w))) #creating the input beam profile I1 = abs(np.multiply(u1,u1)) #input intensity profile ua = prop.propTF(u1,step1,L1,wavel,z) #result using TF method Ia = abs(np.multiply(ua,ua)) #TF output intensity profile ub = prop.propIR(u1,step1,L1,wavel,z) #result using IR method Ib = abs(np.multiply(ub,ub)) #IR output intensity profile ''' Plotting. ''' plt.figure() plt.suptitle('propogation distance = '+str(z)) plt.subplot(121)