Пример #1
0
def correlation_retrieval(data,K=None,ARGS=False):
  f_data = np.fft.fft2(data)
  kx = np.fft.fftfreq(f_data.shape[0])
  ky = np.fft.fftfreq(f_data.shape[1])
  # get k-vector, if not give
  if K is None:
    K = get_wave(f_data)

  # get the frequency data information
  Kfreq = kx[K[0]],ky[K[1]]
  # make an X-Y grid
  pi = np.pi
  nx,ny = np.shape(data)
  Y,X = np.meshgrid(np.arange(ny),np.arange(nx),\
      sparse=False,indexing='xy')
  print Kfreq
  # produce a correlation function
  phplot.imageshow(wave_function(X,Y,Kfreq))
  zsum = np.zeros(data.shape)
  Nphi = 1.
  a_phi = np.linspace(0,2*np.pi,Nphi)
  for phi in a_phi:
    zsum += correlate2d(data,wave_function(X,Y,K,phi),mode='same')

  phplot.imageshow(zsum)
  return data
Пример #2
0
 def __init__(self):
   nx,ny,nz = 100,100,100
   lx,ly,lz = 1.,1.,1.
   x,y,z = np.linspace(-lx,lx,nx),np.linspace(-ly,ly,ny),np.linspace(-lz,0,nz)
   self.X,self.Y,self.Z = np.meshgrid(x,y,z)
   nt = 100
   lt = 10
   self.t = np.linspace(0.,lt,nt)
   self.I = self.T_impulse(1.,1.,0.,0.,0.,self.t[1])
   phplot.imageshow(np.sum(self.I,2))
   self.S = self.T_symb(1.,1.,0.,self.t[99])
   phplot.imageshow(self.S)
Пример #3
0
def subtract_field(data,ref_data):
  # subtract the max point of the data
  data_max = np.max(np.max(data))
  data_n = data - data_max

  phplot.imageshow(data_n)
  phplot.imageshow(phplot.spectrogram(data_n))
  # subtract the reference field
#  data_n = data_n - ref_data
  wx = np.hanning(data.shape[0])
  wy = np.hanning(data.shape[1])
  w2 = np.sqrt(np.outer(wx,wy))
  phplot.imageshow(data_n)
  phplot.imageshow(phplot.spectrogram(data_n*w2))

  # set 0-points of reference data to some non-0 value (median)
  # this is important for the division step
  ref_data[ref_data == 0] = np.median(ref_data)

  # divide by reference field
  data_n /= 2*np.sqrt(ref_data*data_max)

  return data_n