>> Does it work to use a cutoff of half the size of the input arrays in
>> each dimension? This is equivalent to calculating both shifts (the
>> positive and negative) and using whichever has a smaller absolute  
>> value.
> no, unfortunately the cutoff is not half of the dimensions.

Explain more about what you need from this "cutoff" then. Given that  
the peak is just an index into the array, it seems like the "cutoff"  
for using the peak index as the shift vs. subtracting the size of the  
array from the index should be a function of the size of the arrays.  
How is the cutoff value data-dependent? Can you provide some simple 1D  
examples?

>> Alternately, you could use numpy.roll to shift the data (one axis  
>> at a
>> time). Since roll wraps around, you wouldn't need to bother figuring
>> out which shift is "correct".
> Maybe I do not understand correctly what you mean by this, but as  
> far as
> I get it this will not help me, given that I do not know the number of
> positions I need to roll. I think the parameter <shift> to the roll
> function would be the same value as the cutoff I need.
> If you wanted to suggest that I can check some property for every  
> shift
> and hence could try every possible shift in each axis: this is
> computationally not feasable for me. I need to run time consuming
> operations to ensure the correctness and with a 200x200x200 matrix
> (which is very roughly as large as it gets for me), so this would ruin
> the speed benfits of using the FFT.

1D: say that you have 30-element arrays and a correlation peak of 25.  
I assume this means you need to shift one array 5 positions backward  
or the other 5 forward. However (and this ought to be justifiable  
since the FFT assumes wrap-around as well) you could also just shift  
one array 25 positions forward, wrapping around as needed. No?  
numpy.roll shifts arrays with wrap-around.

If this isn't what you need, you'll have to explain a bit more about  
your problem, and about what it is you need from the cutoff value.

Zach
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to