def test_multi(): freq = 5e9 cell_sz = 30. / 1000. scale = 30 # pre calculated horn power integration at 5GHz horn_integ = 22732.769823328235 abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) src = Source() horn = get_default_pyramidal_horn(freq) src.append(horn, abg, (0., 0., cell_sz*scale)) tp = [(np.deg2rad(20), np.deg2rad(0)), (np.deg2rad(20), np.deg2rad(90)), (np.deg2rad(20), np.deg2rad(180)), (np.deg2rad(20), np.deg2rad(270))] #tp = [(np.deg2rad(0), np.deg2rad(0))] tpm = [(np.deg2rad(0), np.deg2rad(0), 1)] arr = RAInfo(src, cell_sz, (scale, scale), ('pencil', (tp)), ideal_ref_unit) #arr = RAInfo(src, cell_sz, (scale, scale), ('oam', (tpm, np.deg2rad(0))), ideal_ref_unit) solver = RASolver(arr) tsk1 = Gain2D(np.deg2rad(0), 999) tsk2 = Gain2D(np.deg2rad(90), 600) tsk3 = Gain3D(100, 100) solver.append_task(tsk1) #solver.append_task(tsk2) #solver.append_task(tsk3) #solver.run() solver.run_concurrency() tsk1.post_process(horn_integ, True)
def line_feed_array(): freq = 10.0e9 cell_sz = 15 / 1000. scale = 10 abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) integ = 1.2068 showFig = True hz = cell_sz*scale*0.6 fd_list = [(0.0, -cell_sz*2, hz), (0.0, -cell_sz, hz), (0.0, 0.0, hz), (0.0, cell_sz, hz), (0.0, cell_sz*2, hz)] src = Source() for i in range(len(fd_list)): src.append(get_default_pyramidal_horn(freq, E0=1.0, initp=0.0), abg, fd_list[i], dir='parallel') tp = [(0, 0)] bs = 1 arr = RAInfo(src, cell_sz, (scale, scale), ('pencil', tp), lambda p:ideal_ref_unit(p, bits=bs)) solver = RASolver(arr) phi = np.deg2rad(90) tsk1 = Gain2D(phi, 300) #tsk1 = Gain3D(200, 200) solver.append_task(tsk1) solver.run() tsk1.post_process(integ*5, showFig)
def test_fresnel_phicut(): freq = 6.0e9 cell_sz = 25 / 1000. lmbd = 3e8 / freq scale = 20 fdr = 0.8 hz = cell_sz*scale*fdr horn = get_default_pyramidal_horn(freq) pos = (0.0, 0.0, hz) abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) showFig = True far_z = 2 * (scale*cell_sz*np.sqrt(2)) ** 2 / lmbd focal = [(0.5, 0.5, 1.0, 1.0), (-0.5, -0.5, 1.0, 1.0)] src = Source() src.append(horn, abg, pos) arr = RAInfo(src, cell_sz, (scale, scale), ('foci', focal), circle_unit) solver = RASolver(arr, type='fresnel') tsk = PhiCutPlane((2.0, 1.5), (21, 21), phi=np.deg2rad(45)) solver.append_task(tsk) solver.run() tsk.post_process(showFig, None)
def test_fresnel_onaxis(): freq = 6.0e9 cell_sz = 25 / 1000. lmbd = 3e8 / freq scale = 20 fdr = 0.8 hz = cell_sz*scale*fdr horn = get_default_pyramidal_horn(freq) pos = (0.0, 0.0, hz) abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) showFig = True far_z = 2 * (scale*cell_sz*np.sqrt(2)) ** 2 / lmbd focal_rio = 0.1 focal = [(0.0, 0.0, focal_rio*far_z, 1.0)] src = Source() src.append(horn, abg, pos) arr = RAInfo(src, cell_sz, (scale, scale), ('foci', focal), circle_unit) solver = RASolver(arr, type='fresnel') plane_rio = np.linspace(0.01, 0.5, 200) zlist = [pr*far_z for pr in plane_rio] tsk = OnAxisLine(zlist, plane_rio) solver.append_task(tsk) solver.run() tsk.post_process(showFig, None)
def RA_12x12(): freq = 5.0e9 cell_sz = 33 / 1000. scale = 12 fdr = 0.9 hz = cell_sz*scale*fdr abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) showFig = True integ = 30.17114 # 10.0, 5.0e9 horn = get_default_pyramidal_horn(freq) pos = (0.0, 0.0, hz) src = Source() src.append(horn, abg, pos) bs = 2 tmp = [(np.deg2rad(0), np.deg2rad(0))] arr = RAInfo(src, cell_sz, (scale, scale), ('pencil', tmp), lambda p:ideal_ref_unit(p, bits=bs, amp=0.8)) solver = RASolver(arr) tsk1 = Gain2D(np.deg2rad(0), 181) solver.append_task(tsk1) solver.run() tsk1.post_process(integ, showFig, exfn='experiment/12x12/xoz-theo.csv')
def test_offset_feed(): freq = 6.0e9 cell_sz = 25 / 1000. scale = 20 horn = get_default_pyramidal_horn(freq, E0=1.0) integ = 0.07083 showFig = True abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) src = Source() fdr = 1.0 fpos_offset = (0, cell_sz*2, cell_sz*scale*fdr) fpos = (0, 0, cell_sz*scale*fdr) src.append(horn, abg, fpos_offset, dir='parallel') tp = [(np.deg2rad(30), 0)] bs = 2 arr = RAInfo(src, cell_sz, (scale, scale), ('pencil', tp), lambda p:ideal_ref_unit(p, bits=bs)) solver = RASolver(arr) phi = np.deg2rad(0) tsk1 = Gain2D(phi, 300) #tsk1 = Gain3D(150, 150) solver.append_task(tsk1) solver.run() tsk1.post_process(integ, showFig)
def __iter__(self): with self.lock: self.idx = 0 return self def __next__(self): with self.lock: if self.idx == len(self): raise StopIteration ret = self.efield[self.idx] self.idx += 1 return ret if __name__ == '__main__': freq = 5e9 cell_sz = 30. / 1000. scale = 20 abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) src = Source() src.append(get_default_pyramidal_horn(freq), abg, (0., 0., 0.5)) tp = [(np.deg2rad(0), np.deg2rad(0))] tpm = [(np.deg2rad(0), np.deg2rad(0), 1)] foci = [(0, 0, 0.8, 1.0)] arr = RAInfo(src, cell_sz, (scale, scale), ('oam', (tpm, np.deg2rad(10))), ideal_ref_unit) for (ex, ey) in arr: print(ex, ey)
def focal_2bit_calculation(): freq = 5.8e9 cell_sz = 30 / 1000. scale = 10 fdr = 0.9 hz = cell_sz*scale*fdr abg = (np.deg2rad(180), np.deg2rad(180), np.deg2rad(0)) showFig = True integ = 1.039 # 1.6, 5.8e9 horn = get_default_pyramidal_horn(freq, E0=1.6) pos = (0.0, 0.0, hz) src = Source() src.append(horn, abg, pos) focuses = ( [(1.0, 1.0, 1.0, 1.0)], [(-0.3, 0.3, 1.5, 1.0), (0.3, -0.3, 1.5, 1.0)], [(0.3, 0.3, 2.0, 1.0)] ) hs = ( 1.0, 1.5, 2.0 ) planes = ( (3.0, 3.0), (1.2, 1.2), (1.2, 1.2) ) points = ( (301, 301), (121, 121), (121, 121) ) ps = ( np.deg2rad(45), np.deg2rad(135), np.deg2rad(45) ) Nt, Np = 181, 181 for idx in range(3): bs = 2 arr = RAInfo(src, cell_sz, (scale, scale), ('foci', focuses[idx]), lambda p:ideal_ref_unit(p, bits=bs)) solver = RASolver(arr) tsk1 = FresnelPlane(0, 'xx', hs[idx], planes[idx], points[idx]) tsk2 = Gain2D(ps[idx], Nt, freq) tsk3 = Gain3D(Np, Nt) solver.append_task(tsk1) solver.append_task(tsk2) solver.append_task(tsk3) solver.run() tsk1.post_process(integ, showFig, exfn='experiment/2bit/case{}_plane_theo.fld'.format(idx+1)) tsk2.post_process(integ, showFig, exfn='experiment/2bit/case{}_2d_theo.csv'.format(idx+1)) tsk3.post_process(integ, showFig, exfn='experiment/2bit/case{}_3d_theo.csv'.format(idx+1))