[Numpy-discussion] Optical autocorrelation calculated with numpy is slow

Charles R Harris charlesr.harris@gmail....
Mon Mar 30 13:39:47 CDT 2009


On Mon, Mar 30, 2009 at 12:23 PM, Anne Archibald
<peridot.faceted@gmail.com>wrote:

> 2009/3/30 João Luís Silva <jsilva@fc.up.pt>:
> > Hi,
> >
> > I wrote a script to calculate the *optical* autocorrelation of an
> > electric field. It's like the autocorrelation, but sums the fields
> > instead of multiplying them. I'm calculating
> >
> > I(tau) = integral( abs(E(t)+E(t-tau))**2,t=-inf..inf)
>
> You may be in trouble if there's cancellation, but can't you just
> rewrite this as E(t)**2+E(t-tau)**2-2*E(t)*E(t-tau)? Then you have two
> O(n) integrals and one standard autocorrelation...
>

That should work. The first two integrals are actually the same, but need to
be E(t)*E(t).conj(). The second integral needs twice the real part of
E(t)*E(t-tau).conj(). Numpy correlate should really have the conjugate built
in, but it doesn't.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090330/164faf1d/attachment.html 


More information about the Numpy-discussion mailing list