code: def crosscorr(self, signal, lag=0):
          
          from scipy.linalg import norm
  
          s = asarray(signal)
          s = s - mean(s)
          s = s / norm(s)
  
          if size(s) != size(self.index):
              raise Exception('Size of signal to cross correlate with, %g, '
                              'does not match size of series' % size(s))
  
          # created a matrix with lagged signals
          if lag is not 0:
              shifts = range(-lag, lag+1)
              d = len(s)
              m = len(shifts)
              sshifted = zeros((m, d))
              for i in range(0, len(shifts)):
                  tmp = roll(s, shifts[i])
                  if shifts[i] < 0:
                      tmp[(d+shifts[i]):] = 0
                  if shifts[i] > 0:
                      tmp[:shifts[i]] = 0
                  sshifted[i, :] = tmp
              s = sshifted
          else:
              shifts = [0]
  
          def get(y, s):
              y = y - mean(y)
              n = norm(y)
              if n == 0:
                  b = zeros((s.shape[0],))
              else:
                  y /= n
                  b = dot(s, y)
              return b
  
          return self.map(lambda x: get(x, s), index=shifts)
docs: Cross correlate series data against another signal.
  
          Parameters
          ----------
          signal : array
              Signal to correlate against (must be 1D).
  
          lag : int
              Range of lags to consider, will cover (-lag, +lag).