Пример #1
0
   def interpolateData(self):
      import scipy.interpolate as interpolate 
      
      NyK = self.Ny - 2*self.K.value # The Capon image will be 2*K smaller in range

      if VERBOSE:
         print 'Start interpolating...'

      # IQ-interpolation (in image domain, imag and real, hence coherent) 
      iq_interp_factor = 2
      x_idx = np.arange(self.Nx)
      y_idx = np.arange(NyK)
      x_up_idx = np.linspace(0.25, self.Nx-1-0.25, (self.Nx-1)*iq_interp_factor)  
      y_up_idx = np.arange(NyK)
      self.angles_intrp = interpolate.interp1d( x_idx, self.angles ) (x_up_idx)
      self.ranges_intrp = self.ranges
      if self.K.value > 0:
         self.ranges_intrp = self.ranges_intrp[self.K.value:-self.K.value]
          
      img_das_real = interpolate.RectBivariateSpline( x_idx, y_idx, self.img_das.real ) (x_up_idx, y_up_idx)
      img_das_imag = interpolate.RectBivariateSpline( x_idx, y_idx, self.img_das.imag ) (x_up_idx, y_up_idx)
   
      img_capon_real = interpolate.RectBivariateSpline( x_idx, y_idx, self.img_capon.real ) (x_up_idx, y_up_idx)
      img_capon_imag = interpolate.RectBivariateSpline( x_idx, y_idx, self.img_capon.imag ) (x_up_idx, y_up_idx)
      
      self.img_das_iq_intrp   = img_das_real   + 1j * img_das_imag
      self.img_capon_iq_intrp = img_capon_real + 1j * img_capon_imag   
      
      # In-coherent interpolation
      if self.Ky.value > 1 or self.Kx.value > 1:
         
         NxK = (self.Nx-1) * iq_interp_factor
      
         y_idx = np.arange(NyK)
         x_idx = np.arange(NxK)
      
         y_up_idx = np.linspace(0,NyK-1,NyK*self.Ky.value)
         x_up_idx = np.linspace(0,NxK-1,NxK*self.Kx.value)
         
         self.angles_intrp = interpolate.interp1d( x_idx, self.angles_intrp ) (x_up_idx)
         if self.K.value > 0:
            self.ranges_intrp = interpolate.interp1d( y_idx, self.ranges[self.K.value:-self.K.value].squeeze() ) (y_up_idx)
         else:
            self.ranges_intrp = interpolate.interp1d( y_idx, self.ranges ) (y_up_idx)
      
         self.img_das_intrp   = interpolate.RectBivariateSpline( x_idx, y_idx, abs(self.img_das_iq_intrp) ) (x_up_idx, y_up_idx)
         self.img_capon_intrp = interpolate.RectBivariateSpline( x_idx, y_idx, abs(self.img_capon_iq_intrp) ) (x_up_idx, y_up_idx)
            
      else: # do nothing
         self.img_das_intrp = self.img_das_iq_intrp
         self.img_capon_intrp = self.img_capon_iq_intrp
         
      self.img_das_intrp   = np.transpose(self.img_das_intrp)
      self.img_capon_intrp = np.transpose(self.img_capon_intrp)
      
      self.img_das_detected = self.logCompress(self.img_das_intrp,   self.minDynRange.value, self.maxDynRange.value)
      self.img_cap_detected = self.logCompress(self.img_capon_intrp, self.minDynRangeCapon.value, self.maxDynRangeCapon.value)
         
      if VERBOSE:
         print 'done'
Пример #2
0
    def testComplexNonUniformUnivariateSpline(self):

        x = np.arange(10)
        y = x ** 2 + 1j * (x ** 2 + 1)
        xi = np.linspace(0, 9, 91)
        #

        yi = mklcUnivariateSplineC(x, y, xi, 0, False)

        print yi
Пример #3
0
   ##########
   ##
   ##app_name = "testEfficiency_mathcheck"
   ##math_run = run()
   ##events   = "--events gld_request,gst_request,shared_load,shared_store"
   ##math_event_run = run()
   #
   #
   #return info
   ##export PYTHONPATH="/home/me/Work/UiO/Phd/Code/Profile"
   ##python testEfficiency.py testMVDRKernelPerformance
   #
   ##nvprof ./testEfficiency testEfficiency testMVDRKernelPerformance

M = 8
L_list = np.arange(M-1)+2
time = np.zeros((L_list.shape[0],6))
for l,L in enumerate(L_list):
   time[l] = collectResults(M,L)
np.savetxt('time-M%d.txt'%M,time)

M = 16
L_list = np.arange(M-1)+2
time = np.zeros((L_list.shape[0],6))
for l,L in enumerate(L_list):
   time[l] = collectResults(M,L)
np.savetxt('time-M%d.txt'%M,time)

M = 32
L_list = np.arange(M-1)+2
time = np.zeros((L_list.shape[0],6))
Пример #4
0
    ##########
    ##
    ##app_name = "testEfficiency_mathcheck"
    ##math_run = run()
    ##events   = "--events gld_request,gst_request,shared_load,shared_store"
    ##math_event_run = run()
    #
    #
    #return info
    ##export PYTHONPATH="/home/me/Work/UiO/Phd/Code/Profile"
    ##python testEfficiency.py testMVDRKernelPerformance
    #
    ##nvprof ./testEfficiency testEfficiency testMVDRKernelPerformance

M = 8
L_list = np.arange(M - 1) + 2
time = np.zeros((L_list.shape[0], 6))
for l, L in enumerate(L_list):
    time[l] = collectResults(M, L)
np.savetxt('time-M%d.txt' % M, time)

M = 16
L_list = np.arange(M - 1) + 2
time = np.zeros((L_list.shape[0], 6))
for l, L in enumerate(L_list):
    time[l] = collectResults(M, L)
np.savetxt('time-M%d.txt' % M, time)

M = 32
L_list = np.arange(M - 1) + 2
time = np.zeros((L_list.shape[0], 6))
Пример #5
0
    def interpolateData(self):
        import scipy.interpolate as interpolate

        NyK = self.Ny - 2 * self.K.value  # The Capon image will be 2*K smaller in range

        if VERBOSE:
            print 'Start interpolating...'

        # IQ-interpolation (in image domain, imag and real, hence coherent)
        iq_interp_factor = 2
        x_idx = np.arange(self.Nx)
        y_idx = np.arange(NyK)
        x_up_idx = np.linspace(0.25, self.Nx - 1 - 0.25,
                               (self.Nx - 1) * iq_interp_factor)
        y_up_idx = np.arange(NyK)
        self.angles_intrp = interpolate.interp1d(x_idx, self.angles)(x_up_idx)
        self.ranges_intrp = self.ranges
        if self.K.value > 0:
            self.ranges_intrp = self.ranges_intrp[self.K.value:-self.K.value]

        img_das_real = interpolate.RectBivariateSpline(
            x_idx, y_idx, self.img_das.real)(x_up_idx, y_up_idx)
        img_das_imag = interpolate.RectBivariateSpline(
            x_idx, y_idx, self.img_das.imag)(x_up_idx, y_up_idx)

        img_capon_real = interpolate.RectBivariateSpline(
            x_idx, y_idx, self.img_capon.real)(x_up_idx, y_up_idx)
        img_capon_imag = interpolate.RectBivariateSpline(
            x_idx, y_idx, self.img_capon.imag)(x_up_idx, y_up_idx)

        self.img_das_iq_intrp = img_das_real + 1j * img_das_imag
        self.img_capon_iq_intrp = img_capon_real + 1j * img_capon_imag

        # In-coherent interpolation
        if self.Ky.value > 1 or self.Kx.value > 1:

            NxK = (self.Nx - 1) * iq_interp_factor

            y_idx = np.arange(NyK)
            x_idx = np.arange(NxK)

            y_up_idx = np.linspace(0, NyK - 1, NyK * self.Ky.value)
            x_up_idx = np.linspace(0, NxK - 1, NxK * self.Kx.value)

            self.angles_intrp = interpolate.interp1d(
                x_idx, self.angles_intrp)(x_up_idx)
            if self.K.value > 0:
                self.ranges_intrp = interpolate.interp1d(
                    y_idx, self.ranges[self.K.value:-self.K.value].squeeze())(
                        y_up_idx)
            else:
                self.ranges_intrp = interpolate.interp1d(y_idx,
                                                         self.ranges)(y_up_idx)

            self.img_das_intrp = interpolate.RectBivariateSpline(
                x_idx, y_idx, abs(self.img_das_iq_intrp))(x_up_idx, y_up_idx)
            self.img_capon_intrp = interpolate.RectBivariateSpline(
                x_idx, y_idx, abs(self.img_capon_iq_intrp))(x_up_idx, y_up_idx)

        else:  # do nothing
            self.img_das_intrp = self.img_das_iq_intrp
            self.img_capon_intrp = self.img_capon_iq_intrp

        self.img_das_intrp = np.transpose(self.img_das_intrp)
        self.img_capon_intrp = np.transpose(self.img_capon_intrp)

        self.img_das_detected = self.logCompress(self.img_das_intrp,
                                                 self.minDynRange.value,
                                                 self.maxDynRange.value)
        self.img_cap_detected = self.logCompress(self.img_capon_intrp,
                                                 self.minDynRangeCapon.value,
                                                 self.maxDynRangeCapon.value)

        if VERBOSE:
            print 'done'