def fromfile(self): """ get the measurement waveform from WHERE1 measurement campaign This function is not yet generic >>> from pylayers.signal.waveform import * >>> wav = Waveform(typ='W1compensate') >>> wav.show() """ M = mesuwb.UWBMeasure(1, h=1) w = bs.TUsignal() ts = M.RAW_DATA.timetx[0] tns = ts * 1e9 te = tns[1] - tns[0] y = M.RAW_DATA.tx[0] # find peak position u is the index of the peak # yap :after peak # ybp : before peak # yzp : zero padding maxy = max(y) u = np.where(y == maxy)[0][0] yap = y[u:] ybp = y[0:u] yzp = np.zeros(len(yap) - len(ybp) - 1) tnsp = np.arange(0, tns[-1] - tns[u] + 0.5 * te, te) tnsm = np.arange(-(tns[-1] - tns[u]), 0, te) y = np.hstack((yzp, np.hstack((ybp, yap)))) tns = np.hstack((tnsm, tnsp)) # # Warning (check if 1/sqrt(30) is not applied elsewhere # w.x = tns w.y = y * (1 / np.sqrt(30)) # w : TUsignal # W : FUsignal (Hermitian redundancy removed) W = w.ftshift() return (w, W)
def fromfile2(self): """ get the measurement waveform from WHERE1 measurement campaign This function is not yet generic >>> from pylayers.signal.waveform import * >>> wav = Waveform(typ='W1offset') >>> wav.show() """ M = mesuwb.UWBMeasure(1,1) w = bs.TUsignal() ts = M.RAW_DATA.timetx[0] tns = ts*1e9 Ts = tns[1]-tns[0] y = M.RAW_DATA.tx[0] # find peak position u is the index of the peak # yap :after peak # ybp : before peak # yzp : zero padding # maxy = max(y) # u = np.where(y ==maxy)[0][0] # yap = y[u:] # ybp = y[0:u] yzp = np.zeros(len(y)-1) # tnsp = np.arange(0,tns[-1]-tns[u]+0.5*ts,ts) # tnsm = np.arange(-(tns[-1]-tns[u]),0,ts) N = len(ts)-1 tnsm = np.linspace(-tns[-1],-Ts,N) y = np.hstack((yzp,y)) tns = np.hstack((tnsm,tns)) # # Warning (check if 1/sqrt(30) is not applied elsewhere # w.x = tns w.y = (y*(1/np.sqrt(30)))[None,:] # w : TUsignal # W : FUsignal (Hermitian redundancy removed) W = w.ftshift() return (w,W)