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 rcfn(t,s,f,l): a=vsip.create(t,l); s=vsip.create('rand',(s,1,1,f)) vsip.randn(s,a) vsip.destroy(s) return a
def rcfn(t, s, f, l): a = vsip.create(t, l) s = vsip.create('rand', (s, 1, 1, f)) vsip.randn(s, a) vsip.destroy(s) return a