You should avoid meshgrid, as the follows:
...
#3D ARRAY
XArray = np.arange(0, NrHorPixels, 1./sqrt(NrCellsPerPixel))
YArray = np.arange(0, NrVerPixels, 1./sqrt(NrCellsPerPixel))
Z =
Amplitude*exp(-(((XArray-GaussianCenterX)**2/(2*SigmaX**2))+((YArray[:,None]-GaussianCenterY)**/(2*SigmaY**2
On Wed, Oct 6, 2010 at 11:07 PM, Andrew P. Mullhaupt
wrote:
>
> I came across this gem yesterday
> >>> from numpy import *
> >>> R = ones((2))
> >>> R[0] = R[0] * 1j
> >>> R
> ...array([ 0., 1.])
> >>> R = ones((2), 'complex')
> >>> R[0] = R[0] * 1j
> >>> R
> array([ 0.+1.j, 1.+0.j])" and I read t
On 10/7/2010 1:14 AM, sicre wrote:
>
>
> Andrew P. Mullhaupt wrote:
>> (assigning complex value to real array)
> Sorry, but this post is in the wrong topic since it has nothing to do with
> my question.
How did this happen? I created a new subject.
Best regards,
Andrew Mullhaupt
___
Andrew P. Mullhaupt wrote:
>
>
> I came across this gem yesterday
>
>
> > >> from numpy import *
> > >> R = ones((2))
> > >> R[0] = R[0] * 1j
> > >> R
> ...array([ 0., 1.])
> > >> R = ones((2), 'complex')
> > >> R[0] = R[0] * 1j
> > >> R
>
I came across this gem yesterday
> >> from numpy import *
> >> R = ones((2))
> >> R[0] = R[0] * 1j
> >> R
...array([ 0., 1.])
> >> R = ones((2), 'complex')
> >> R[0] = R[0] * 1j
> >> R
array([ 0.+1.j, 1.+0.j])"
and I read that this behavior is actua
I do not have good programming skills, I am trying to create a 2048x2048 3D
pixel array where each pixel has 100 cells.
I am using meshgrid in order to create a 3D array, then adding a gaussian
function to the entire array centered in (1024,1024). I am having three
types of errors:
#FIRST ERROR:
The documentation for loadtxt and genfromtxt state that the unpack
argument functions as follows:
If True, the returned array is transposed, so that arguments may be
unpacked using x, y, z = loadtxt(...).
In practice, this does not always occur. I have a csv file of mixed
data types, and try impo
On Wed, Oct 6, 2010 at 7:08 PM, Jonathan March wrote:
> It appears that the numpy testing decorators for skipping and for
> known failure should behave similarly to each other, at least from
> their descriptions here:
> http://projects.scipy.org/numpy/wiki/TestingGuidelines#known-failures-skipping
It appears that the numpy testing decorators for skipping and for
known failure should behave similarly to each other, at least from
their descriptions here:
http://projects.scipy.org/numpy/wiki/TestingGuidelines#known-failures-skipping-tests
Yet in the following example, run under nose, they beha
On Wed, Oct 6, 2010 at 4:12 PM, Alan G Isaac wrote:
> On 10/6/2010 5:52 PM, Charles R Harris wrote:
> > What would you want in it's place? For consistancy, a**0 == all_true,
> a**i == a, i > 0?
>
> Yes.
>
> Alan Isaac
>
> PS Boolean matrix powers are well defined and useful.
> I found this oddity
On 10/6/2010 5:52 PM, Charles R Harris wrote:
> What would you want in it's place? For consistancy, a**0 == all_true, a**i ==
> a, i > 0?
Yes.
Alan Isaac
PS Boolean matrix powers are well defined and useful.
I found this oddity by accidentally creating an array instead of a matrix.
On Wed, Oct 6, 2010 at 3:10 PM, Alan G Isaac wrote:
> Integer exponentiation fails (i.e., changes type)
> with boolean dtype. See below. Expected?
>
>
Power isn't defined for booleans, I mean, who exponentiates booleans ;) What
would you want in it's place? For consistancy, a**0 == all_true, a**
Hi,
A background in linear algebra helps. I just came up with this method
(which, because I thought of it 5 seconds ago, I don't know if it works):
Line p1, p2
Point v
costheta = normalize(p2-p1) dot normalize(v-p1)
dist = length(v-p1)*sin(acos(costheta)
Ian
___
Here's a good list of basic geometry algorithms:
http://www.softsurfer.com/algorithms.htm
Zach
On Oct 6, 2010, at 5:08 PM, Renato Fabbri wrote:
> supose you have a line defined by two points and a point. you want
> the distance
>
> what are easiest possibilities? i am doing it, but its nasty'
Integer exponentiation fails (i.e., changes type)
with boolean dtype. See below. Expected?
Alan Isaac
>>> a = np.array([[0,1,0],[0,0,1],[1,0,0]], dtype=np.bool_)
>>> a2 = a*a
>>> a3 = a2*a
>>> print(a3)
[[False True False]
[False False True]
[ True False F
supose you have a line defined by two points and a point. you want the distance
what are easiest possibilities? i am doing it, but its nasty'n ugly
--
GNU/Linux User #479299
skype: fabbri.renato
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.
Hi
I have a x86_64 Fedora core 3 machine where I want to install numpy
but python2.4 has been installed on this machine using Intel compilers
instead of gcc
Can someone tell me how I can install numpy on this architecture?
Thanks
___
NumPy-Discussion m
On Wed, 06 Oct 2010 19:55:00 +0200
Christian Fischer wrote:
> Hi All,
>
> I use numpy 1.4.1 on Debian squeeze amd64.
>
> I noticed that ceil() is not working properly.
>
> If the input to ceil() is a float I expect a float to be
>returned but for inputs
> in (-1.0, 0.0) the result is of type
On Wed, Oct 6, 2010 at 11:55 AM, Christian Fischer <
cfisc...@itm.uni-stuttgart.de> wrote:
> Hi All,
>
> I use numpy 1.4.1 on Debian squeeze amd64.
>
> I noticed that ceil() is not working properly.
>
> If the input to ceil() is a float I expect a float to be returned but for
> inputs
> in (-1.0,
Are you sure?
In [4]: type(np.ceil(-0.0))
Out[4]:
Mike
On 10/06/2010 01:55 PM, Christian Fischer wrote:
Hi All,
I use numpy 1.4.1 on Debian squeeze amd64.
I noticed that ceil() is not working properly.
If the input to ceil() is a float I expect a float to be returned but for inputs
in (-1.
Hi All,
I use numpy 1.4.1 on Debian squeeze amd64.
I noticed that ceil() is not working properly.
If the input to ceil() is a float I expect a float to be returned but for inputs
in (-1.0, 0.0) the result is of type integer.
In [65]: np.__version__
Out[65]: '1.4.1'
In [66]: np.ceil(-1.1)
Out[6
2010/10/5 Chris Withers :
> Hi All,
>
> I can't find any docs on this behavior.
>
> So, I have a python function. To keep it simple, lets just do addition:
>
> def add(x,y):
> print x,y
> retun x+y
>
> So, I can turn this into a ufunc as follows:
>
> uadd = np.frompyfunc(add,2,1)
As a side rem
Chris,
Note that
>>> where(condition)
actually returns a tuple (one item for each dimension of a) and each element
is an array with the index of when your condition occurs.
Therefore if you want to extract the index itself, you need to write
idx = where(a==1)[0][0] for the first element, and where
On Wed, Oct 6, 2010 at 7:23 AM, Nicolas Bigaouette wrote:
> On Wed, Oct 6, 2010 at 5:26 AM, Chris Withers wrote:
>
>> Hi All,
>>
>> Given an array such as:
>>
>> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>
>> How can I find the index of a particular number in the array?
>>
>> (ie: if it was a list, I
On 06/10/2010 14:53, Thomas, Brian (GE Energy) wrote:
> For e.g. to find index of number 1 in array a, you can say
> idx = where(a==1)
Exactly what we were looking for, thanks!
Chris
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://ma
Chris,
You can use where() command to find index of a particular number in the
array.
For e.g. to find index of number 1 in array a, you can say
idx = where(a==1)
Regards,
Brian
-Original Message-
From: numpy-discussion-boun...@scipy.org
[mailto:numpy-discussion-boun...@scipy.org] On B
On Wed, Oct 6, 2010 at 5:26 AM, Chris Withers wrote:
> Hi All,
>
> Given an array such as:
>
> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>
> How can I find the index of a particular number in the array?
>
> (ie: if it was a list, I'd do [1,2,3,4].index(3))
>
> cheers,
>
> Chris
> _
Hi,
I'm trying to help a user to migrate from Numeric - which he used up to
now - to numpy. I found reference to alter_code1.py on
http://numpy.scipy.org/old_array_packages.html.
First I tried the conversion script:
# python2.6 /path/to/alter_code1.py test.py
and alternatively
# python2.6
Hi All,
Given an array such as:
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
How can I find the index of a particular number in the array?
(ie: if it was a list, I'd do [1,2,3,4].index(3))
cheers,
Chris
___
NumPy-Discussion mailing list
NumPy-Discussion@sc
Hi,
On 10/06/2010 04:57 AM, Jing wrote:
> Hi, everyone:
>
> I am new to the python numpy and f2py. I really need help on compiling
> FORTRAN module using f2py. I have been searched internet without any
> success. Here is my setup: I have a Ubuntu 10.04 LTS with python 2.6,
> numpy 1.3.0 and f2py
30 matches
Mail list logo