def VCg2VCl(VCg, Tt, Tr): """ global reference frame to local reference frame Parameters ---------- VCg : VectChannel global Tt : Tx rotation matrix Tr : Rx rotation matrix Returns ------- VCl : VectChannel (local) """ import copy VCl = copy.deepcopy(VCg) freq = VCl.freq Rt, tangl = BTB_tx(VCg.tang, Tt) Rr, rangl = BTB_rx(VCg.rang, Tr) VCl.tang = tangl VCl.rang = rangl uf = np.ones(VCg.nfreq) r0 = np.outer(Rr[0, 0, :], uf) r1 = np.outer(Rr[0, 1, :], uf) # print "shape r0 = ",np.shape(r0) # print "shape VCg.Ctt.y = ",np.shape(VCg.Ctt.y) # print "shape r1 = ",np.shape(r1) # print "shape VCg.Cpt.y = ",np.shape(VCg.Cpt.y) t00 = r0 * VCg.Ctt.y + r1 * VCg.Cpt.y t01 = r0 * VCg.Ctp.y + r1 * VCg.Cpp.y r0 = np.outer(Rr[1, 0, :], uf) r1 = np.pouter(Rr[1, 1, :], uf) t10 = r0 * VCg.Ctt.y + r1 * VCg.Cpt.y t11 = r0 * VCg.Ctp.y + r1 * VCg.Cpp.y r0 = np.outer(Rt[0, 0, :], uf) r1 = np.outer(Rt[1, 0, :], uf) Cttl = t00 * r0 + t01 * r1 Cptl = t10 * r0 + t11 * r1 r0 = np.outer(Rt[0, 1, :], uf) r1 = np.outer(Rt[1, 1, :], uf) Ctpl = t00 * r0 + t01 * r1 Cppl = t10 * r0 + t11 * r1 VCl.Ctt = bs.FUsignal(freq, Cttl) VCl.Ctp = bs.FUsignal(freq, Ctpl) VCl.Cpt = bs.FUsignal(freq, Cptl) VCl.Cpp = bs.FUsignal(freq, Cppl) return VCl
def Cg2Cl(Cg, Tt, Tr): """ global reference frame to local reference frame Parameters ---------- Cg : Ctilde global Tt : Tx rotation matrix Tr : Rx rotation matrix Returns ------- Cl : Ctilde local Examples -------- """ import copy # don't loose the global channel Cl = copy.deepcopy(Cg) # get frequency axes fGHz = Cl.fGHz # get angular axes Rt, tangl = BTB_tx(Cg.tang, Tt) Rr, rangl = BTB_rx(Cg.rang, Tr) VCl.tang = tangl VCl.rang = rangl uf = np.ones(VCg.nfreq) r0 = np.outer(Rr[0, 0, :], uf) r1 = np.outer(Rr[0, 1, :], uf) # print "shape r0 = ",np.shape(r0) # print "shape VCg.Ctt.y = ",np.shape(VCg.Ctt.y) # print "shape r1 = ",np.shape(r1) # print "shape VCg.Cpt.y = ",np.shape(VCg.Cpt.y) t00 = r0 * VCg.Ctt.y + r1 * VCg.Cpt.y t01 = r0 * VCg.Ctp.y + r1 * VCg.Cpp.y r0 = np.outer(Rr[1, 0, :], uf) r1 = np.pouter(Rr[1, 1, :], uf) t10 = r0 * VCg.Ctt.y + r1 * VCg.Cpt.y t11 = r0 * VCg.Ctp.y + r1 * VCg.Cpp.y r0 = np.outer(Rt[0, 0, :], uf) r1 = np.outer(Rt[1, 0, :], uf) Cttl = t00 * r0 + t01 * r1 Cptl = t10 * r0 + t11 * r1 r0 = np.outer(Rt[0, 1, :], uf) r1 = np.outer(Rt[1, 1, :], uf) Ctpl = t00 * r0 + t01 * r1 Cppl = t10 * r0 + t11 * r1 VCl.Ctt = bs.FUsignal(fGHz, Cttl) VCl.Ctp = bs.FUsignal(fGHz, Ctpl) VCl.Cpt = bs.FUsignal(fGHz, Cptl) VCl.Cpp = bs.FUsignal(fGHz, Cppl) return VCl