def load_ffes(self, filename_p, filename_q): """Load a pair of FFE and make them correspond to this DualPolElem object. First file will be pol-channel p and second q.""" ffefile_p = FEKOffe(filename_p) tvf_p = tvecfun.TVecFields() tvf_q = tvecfun.TVecFields() tvf_p.load_ffe(filename_p) tvf_q.load_ffe(filename_q) self.radFFp = RadFarField(tvf_p) self.radFFq = RadFarField(tvf_q)
def load_ffe(self, filename, request_p=None, request_q=None): #FIX: This not the most efficient way to do this as it does two passes over feko file. ffefile = FEKOffe(filename) if request_p is None and request_q is None: if len(ffefile.Requests) == 2: requests = list(ffefile.Requests) requests.sort() # # FIXME: Not sure how to order requests request_p = requests[0] request_q = requests[1] else: raise RuntimeError( "File contains multiple FFs (specify one): " + ','.join(ffefile.Requests)) print("Request_p= " + request_p) print("Request_q= " + request_q) tvf_p = tvecfun.TVecFields() tvf_q = tvecfun.TVecFields() tvf_p.load_ffe(filename, request_p) tvf_q.load_ffe(filename, request_q) self.radFFp = RadFarField(tvf_p) self.radFFq = RadFarField(tvf_q)
def readNECout_tvecfuns(filename): """Read a NEC .out file and return it as a TVecField instance. """ frequencies, thetaMsh, phiMsh, EthetaF, EphiF = readNECout_FF(filename) # Check to see if mesh wraps around in azimuth. If it does, remove the # redundant components. (It may have to been done elsewhere) if numpy.fmod(phiMsh[0, 0], 2*math.pi) \ == numpy.fmod(phiMsh[0, -1], 2*math.pi): phiMsh = numpy.delete(phiMsh, (-1), axis=1) thetaMsh = numpy.delete(thetaMsh, (-1), axis=1) EthetaF = numpy.delete(EthetaF, (-1), axis=-1) EphiF = numpy.delete(EphiF, (-1), axis=-1) # End of wrap check FFs = tvecfun.TVecFields(thetaMsh, phiMsh, EthetaF, EphiF, frequencies) return FFs
def dualpolelem_2FF(): """Test plot of a dual-polarized antenna where one channel is given by Psi and the other is a rotated copy it.""" T, P = pntsonsphere.sphericalGrid() dipX = numpy.array(vsh.Psi(1, 1, T, P)) + numpy.array(vsh.Psi(1, -1, T, P)) dipXT = numpy.squeeze(dipX[0, :, :]) dipXP = numpy.squeeze(dipX[1, :, :]) freq = 1.0 vfdipX = tvecfun.TVecFields(T, P, dipXT, dipXP, freq) antp = RadFarField(vfdipX) antq = antp.rotate90() dualpolAnt = DualPolElem(antp, antq) rotmat = pntsonsphere.rotzmat(0 * math.pi / 4) dualpolAnt.rotateframe(rotmat) dualpolAnt.plotJonesPat3D( freq, projection='azimuthal-equidistant', cmplx_rep='ReIm', )
def gen_simp_RadFarField(): THETA, PHI, E_th, E_ph = gen_simp_pat() atvfd = tvecfun.TVecFields(THETA, PHI, E_th, E_ph, 1.0) antFF = RadFarField(atvfd) return antFF