[SciPy-user] shift FFT2D...

Francesc Altet faltet at carabos.com
Wed May 9 11:36:43 EDT 2007


El dc 09 de 05 del 2007 a les 17:19 +0200, en/na fred va escriure:
> I was thinking something like this, but I was wondering if there was
> not 
> a builtin function for example...
> 
> Thanks anyway.

You are welcome.

> Another question: how can I put a small matrix in a bigger (say
> (10x10) 
> centered in (200x200)) ?

You mean something like:

In [84]:a=numpy.zeros((100,100))
In [85]:b=numpy.ones((2,2))
In [86]:a[1:1+b.shape[0], 1:1+b.shape[1]] = b
In [87]:a
Out[87]:
array([[ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  1.,  1., ...,  0.,  0.,  0.],
       [ 0.,  1.,  1., ...,  0.,  0.,  0.],
       ..., 
       [ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  0.]])

where b has been 'put' into a in coordinates (1,1)

?  Or maybe you want something more?

Cheers,

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth




More information about the SciPy-User mailing list