def VU_rowview(v, m, i): mattr=vsip.getattrib(m) vattr=vsip.getattrib(v) vattr.offset = mattr.offset + i * mattr.col_stride vattr.length = mattr.row_length vattr.stride = mattr.row_stride vsip.putattrib(v,vattr);
def noise_sim(self): from numpy import pi, cos d_t=self.d_t * self.Fs #sensor-to-sensor travel time at end-fire in samples o_0 = d_t * self.Nsens + 1 # array travel time at end-fire in samples a_stp = pi/self.Nsim_noise # angle step bl_attr = vsip.getattrib(self.bl_noise) for j in range(self.Nsim_noise): a_crct = cos(float(j) * a_stp) vsip.randn(self.rand,self.noise) vsip.firfilt(self.fir,self.noise,self.bl_noise) vsip.mul(12.0/float(self.Nsim_noise),self.bl_noise,self.bl_noise) vsip.putlength(self.bl_noise,self.Nts); for i in range(self.Nsens): vsip.putoffset(self.bl_noise,int(o_0 + i * d_t * a_crct)) VU_rowview(self.v_data,self.m_data,i) vsip.add(self.bl_noise,self.v_data,self.v_data) vsip.putattrib(self.bl_noise,bl_attr); vsip.add(-vsip.meanval(self.m_data),self.m_data,self.m_data);
def vView(x,o,s,l): """ vView(x,o,s,l) returns the view x with offset, stride and length (o,s,l) . This could also be done with vsiputils using bind(vsip.block(x),(o,s,l)) except that bind will create a new object that will need to be allocated and destroyed. vView will modify the supplied object x. """ t=['vview_f', 'vview_d', 'cvview_f','cvview_d', 'vview_i','vview_si','vview_uc','vview_vi', 'vview_bl','vview_mi'] myT=vsip.getType(x)[1] if myT in t: attr=vsip.getattrib(x) attr.offset=o; attr.stride=s; attr.length=l return vsip.putattrib(x,attr) else: print('type ' + myT + ' not supported by vView')
def vView(x, o, s, l): """ vView(x,o,s,l) returns the view x with offset, stride and length (o,s,l) . This could also be done with vsiputils using bind(vsip.block(x),(o,s,l)) except that bind will create a new object that will need to be allocated and destroyed. vView will modify the supplied object x. """ t = [ 'vview_f', 'vview_d', 'cvview_f', 'cvview_d', 'vview_i', 'vview_si', 'vview_uc', 'vview_vi', 'vview_bl', 'vview_mi' ] myT = vsip.getType(x)[1] if myT in t: attr = vsip.getattrib(x) attr.offset = o attr.stride = s attr.length = l return vsip.putattrib(x, attr) else: print('type ' + myT + ' not supported by vView')