# [SciPy-User] How to do symmetry detection?

Charles R Harris charlesr.harris@gmail....
Wed Jan 20 14:39:05 CST 2010

```On Wed, Jan 20, 2010 at 12:39 PM, Charles R Harris <
charlesr.harris@gmail.com> wrote:

>
>
> On Wed, Jan 20, 2010 at 12:26 PM, iCy-fLaME <icy.flame.gm@gmail.com>wrote:
>
>> Thanks for the replies!
>>
>> Perhaps I should clarify that the input data can be int or float, and
>> most of them will have a very large DC offset (i.e. sum(data) >> 0),
>> and no, the signal duration can be anything, I can not "guess"
>>
>>
> You should remove the offset, it is translation invariant anyway and gives
> no symmetry information.
>
>
>> The problem with convolution (scipy.signal.convolve) with self is, it
>> will only produce one "valid" point in the middle, because anywhere
>> else there is a mis-match of array shape.
>>
>>
> This can be a problem if the symmetry is near an end, but won't matter much
> if the relevant part is short or near the middle. The end effect will be a
> problem no matter what method you use. Think of convolution as a matched
> filter.
>
>
>> I believe scipy.signal.convolve do not take into account of the number
>> of points being integrated, and in the case of a large DC offset, any
>> matches far from the middle of the data will be drowned by other areas
>> which has more points to integrate over.
>>
>> Self convolution also has a problem of signal features matching
>> itself. Imagine the input of the following:
>>
>> data: ______W____M_____
>> data[::-1]: _____M____W______
>>
>> As you do the convolution, feature W will match itself first, then the
>> W-M pair matching, then the M-M matching. Where a valid algorithm
>> should only produce results for the W-M pair matching.
>>
>>
> Well, there is no symmetry in that example. If you don't know if there is
> symmetry then you have to account for that possibility in setting up the
> statistics. I'm thinking Bayesian here.
>
>
In particular, there should be some sort of threshold for detecting
symmetry, some fraction of the signal variance, for instance. That assumes
the data has been demeaned.

The symmetry detection problem can be pretty difficult: noise can be a
problem, the end effects can be a problem, etc., etc. Any apriori
information about the nature of the signal can be useful.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100120/d8401137/attachment.html
```