Re: [Numpy-discussion] nose changes checked in

2008-06-16 Thread Robert Kern
On Mon, Jun 16, 2008 at 21:18, Alan McIntyre <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 16, 2008 at 9:04 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:

>> In [1]: numpy.test()
>> Not implemented: Defined_Binary_Op
>> Not implemented: Defined_Binary_Op
>> Defined_Operator not defined used by Generic_Spec
>> Needs match implementation: Allocate_Stmt
>> Needs match implementation: Associate_Construct
> 
>
> That stream of "Not implemented" and "Needs match implementation"
> stuff comes from numpy/f2py/lib/parser/test_Fortran2003.py and
> Fortran2003.py.  I can silence most of that output by disabling those
> module-level "if 1:" blocks in those two files, but there's still
> complaints about Defined_Binary_Op not being implemented.  If someone
> more knowledgeable about that module could comment on that I'd
> appreciate it.

These files were for the in-development g3 version of f2py. That
development has moved outside of numpy, so I think they can be removed
wholesale. Some of them seem to require a Fortran 90 compiler, so I
have had them fail for me. Removing these is a high priority.

Pearu, can you confirm? Can we give you the task of removing the
unused g3 portions of f2py for the 1.2 release?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] nose changes checked in

2008-06-16 Thread Charles R Harris
On Mon, Jun 16, 2008 at 8:18 PM, Alan McIntyre <[EMAIL PROTECTED]>
wrote:

> On Mon, Jun 16, 2008 at 9:04 PM, Charles R Harris
> <[EMAIL PROTECTED]> wrote:
> > Did you add any documentation to the readme? Any particular version
> > dependency for Nose?
>
> I did update README.txt, but I forgot to put the minimum Nose version
> in there; thanks for mentioning that.  I just checked in an update
> that includes it.
>
> > Hmm, plenty of output, 1 failure, and it looks like a future warning in
> > histogram needs to be disabled.
> >
> > In [1]: numpy.test()
> > Not implemented: Defined_Binary_Op
> > Not implemented: Defined_Binary_Op
> > Defined_Operator not defined used by Generic_Spec
> > Needs match implementation: Allocate_Stmt
> > Needs match implementation: Associate_Construct
> 
>
> That stream of "Not implemented" and "Needs match implementation"
> stuff comes from numpy/f2py/lib/parser/test_Fortran2003.py and
> Fortran2003.py.  I can silence most of that output by disabling those
> module-level "if 1:" blocks in those two files, but there's still
> complaints about Defined_Binary_Op not being implemented.  If someone
> more knowledgeable about that module could comment on that I'd
> appreciate it.
>
> I'll also look into that test_linalg failure first thing in the
> morning; I don' get that here.
>
> > Looks slower than the old testing framework, but not enough to matter.
>
> There were at least a couple of tests that didn't get run under the
> old framework, but the ones I can recall didn't look complicated
> enough to make a difference.
>
> Looks like the buildbots need nose installed or upgraded as well.
>

Thanks for doing this. It looks like the transition to nose is going to be
pretty smooth.

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] nose changes checked in

2008-06-16 Thread Alan McIntyre
On Mon, Jun 16, 2008 at 9:04 PM, Charles R Harris
<[EMAIL PROTECTED]> wrote:
> Did you add any documentation to the readme? Any particular version
> dependency for Nose?

I did update README.txt, but I forgot to put the minimum Nose version
in there; thanks for mentioning that.  I just checked in an update
that includes it.

> Hmm, plenty of output, 1 failure, and it looks like a future warning in
> histogram needs to be disabled.
>
> In [1]: numpy.test()
> Not implemented: Defined_Binary_Op
> Not implemented: Defined_Binary_Op
> Defined_Operator not defined used by Generic_Spec
> Needs match implementation: Allocate_Stmt
> Needs match implementation: Associate_Construct


That stream of "Not implemented" and "Needs match implementation"
stuff comes from numpy/f2py/lib/parser/test_Fortran2003.py and
Fortran2003.py.  I can silence most of that output by disabling those
module-level "if 1:" blocks in those two files, but there's still
complaints about Defined_Binary_Op not being implemented.  If someone
more knowledgeable about that module could comment on that I'd
appreciate it.

I'll also look into that test_linalg failure first thing in the
morning; I don' get that here.

> Looks slower than the old testing framework, but not enough to matter.

There were at least a couple of tests that didn't get run under the
old framework, but the ones I can recall didn't look complicated
enough to make a difference.

Looks like the buildbots need nose installed or upgraded as well.

Thanks,
Alan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] nose changes checked in

2008-06-16 Thread Alan McIntyre
On Mon, Jun 16, 2008 at 8:39 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 16, 2008 at 19:28, Alan McIntyre <[EMAIL PROTECTED]> wrote:
> Please port over the changes I made to scipy.testing in scipy's r4424
> in order to avoid importing nose until the actual execution of tests.

Done in r5289.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Anne Archibald
2008/6/16 Chandler Latour <[EMAIL PROTECTED]>:
> I believe I'm bound to python.
> In terms of forcing the regression through the origin, the purpose is partly
> for visualization but it also should fit the data.  It would not make sense
> to model the data with an initial value other than 0.

Polyfit is just a thin wrapper around numpy.linalg.lstsq. You can do
something like:
A = np.power.outer(xs,np.arange(1,n))
outputs = np.linalg.lstsq(A,ys)

Anne
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] nose changes checked in

2008-06-16 Thread Charles R Harris
On Mon, Jun 16, 2008 at 6:28 PM, Alan McIntyre <[EMAIL PROTECTED]>
wrote:

> Hi all,
>
> I just checked in the switch to use nose to run unit tests.  Please
> let me know if you experience any difficulties as a result.
>

Did you add any documentation to the readme? Any particular version
dependency for Nose?

Hmm, plenty of output, 1 failure, and it looks like a future warning in
histogram needs to be disabled.

In [1]: numpy.test()
Not implemented: Defined_Binary_Op
Not implemented: Defined_Binary_Op
Defined_Operator not defined used by Generic_Spec
Needs match implementation: Allocate_Stmt
Needs match implementation: Associate_Construct
Needs match implementation: Backspace_Stmt
Needs match implementation: Block_Data
Needs match implementation: Case_Construct
Needs match implementation: Case_Selector
Needs match implementation: Case_Stmt
Needs match implementation: Control_Edit_Desc
Needs match implementation: Data_Component_Def_Stmt
Needs match implementation: Data_Implied_Do
Needs match implementation: Data_Stmt
Needs match implementation: Data_Stmt_Set
Needs match implementation: Deallocate_Stmt
Needs match implementation: Derived_Type_Def
Needs match implementation: Endfile_Stmt
Needs match implementation: Entry_Stmt
Needs match implementation: Enum_Def
Needs match implementation: Flush_Stmt
Needs match implementation: Forall_Construct
Needs match implementation: Forall_Header
Needs match implementation: Forall_Triplet_Spec
Needs match implementation: Format_Item
Needs match implementation: Function_Stmt
Needs match implementation: Generic_Binding
Needs match implementation: Generic_Spec
Needs match implementation: Implicit_Part
Needs match implementation: Inquire_Stmt
Needs match implementation: Interface_Block
Needs match implementation: Interface_Body
Needs match implementation: Interface_Stmt
Needs match implementation: Internal_Subprogram_Part
Needs match implementation: Io_Implied_Do
Needs match implementation: Io_Implied_Do_Control
Needs match implementation: Main_Program
Needs match implementation: Module
Needs match implementation: Module_Subprogram_Part
Needs match implementation: Namelist_Stmt
Needs match implementation: Pointer_Assignment_Stmt
Needs match implementation: Position_Edit_Desc
Needs match implementation: Proc_Attr_Spec
Needs match implementation: Proc_Component_Def_Stmt
Needs match implementation: Procedure_Declaration_Stmt
Needs match implementation: Procedure_Stmt
Needs match implementation: Read_Stmt
Needs match implementation: Rewind_Stmt
Needs match implementation: Select_Type_Construct
Needs match implementation: Select_Type_Stmt
Needs match implementation: Specific_Binding
Needs match implementation: Target_Stmt
Needs match implementation: Type_Bound_Procedure_Part
Needs match implementation: Where_Construct
-
Nof match implementation needs: 51 out of 224
Nof tests needs: 224 out of 224
Total number of classes: 529
-
./usr/lib/python2.5/site-packages/numpy/lib/function_base.py:166:
FutureWarning:
The semantics of histogram will be modified in
release 1.2 to improve outlier handling. The new behavior can be
obtained using new=True. Note that the new version accepts/returns
the bin edges instead of the left bin edges.
Please read the docstring for more information.
  Please read the docstring for more information.""", FutureWarning)
/usr/lib/python2.5/site-packages/numpy/lib/function_base.py:193:
FutureWarning:
The semantic for bins will change in version 1.2.
The bins will become the bin edges, instead of the left bin
edges.

  """, FutureWarning)
...E.

Re: [Numpy-discussion] nose changes checked in

2008-06-16 Thread Robert Kern
On Mon, Jun 16, 2008 at 19:28, Alan McIntyre <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I just checked in the switch to use nose to run unit tests.  Please
> let me know if you experience any difficulties as a result.

Please port over the changes I made to scipy.testing in scipy's r4424
in order to avoid importing nose until the actual execution of tests.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] nose changes checked in

2008-06-16 Thread Alan McIntyre
Hi all,

I just checked in the switch to use nose to run unit tests.  Please
let me know if you experience any difficulties as a result.

Thanks,
Alan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Chandler Latour

I believe I'm bound to python.

In terms of forcing the regression through the origin, the purpose is  
partly for visualization but it also should fit the data.  It would  
not make sense to model the data with an initial value other than 0.



On Jun 16, 2008, at 4:33 PM, Simon Palmer wrote:

At the risk of uttering a heresy, are you bound to Python for this?   
I bet you could find a C library that will work well, plus it is not  
a hard algorithm to code yourself.  I am pretty sure I have used a  
numerical recipes algorithm for regression in my distant past.


Also I can't help thinking the idea of forcing your regression fit  
through the origin is a of a bit strange thing to do.  Do you want  
it to pass through the origin for visualisation purposes?  What if  
the origin is not a statistically valid place for the regression fit  
to pass through?


On Mon, Jun 16, 2008 at 9:25 PM, Charles R Harris <[EMAIL PROTECTED] 
> wrote:



On Mon, Jun 16, 2008 at 1:47 PM, Chandler Latour  
<[EMAIL PROTECTED]> wrote:

Yes, exactly what I meant.

Polyfit just fits polynomials, there is no way of fixing the  
constant to zero. Your best bet is to use linalg.lstsq directly to  
fit the function you want.


Chuck



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Simon Palmer
At the risk of uttering a heresy, are you bound to Python for this?  I bet
you could find a C library that will work well, plus it is not a hard
algorithm to code yourself.  I am pretty sure I have used a numerical
recipes algorithm for regression in my distant past.

Also I can't help thinking the idea of forcing your regression fit through
the origin is a of a bit strange thing to do.  Do you want it to pass
through the origin for visualisation purposes?  What if the origin is not a
statistically valid place for the regression fit to pass through?

On Mon, Jun 16, 2008 at 9:25 PM, Charles R Harris <[EMAIL PROTECTED]>
wrote:

>
>
> On Mon, Jun 16, 2008 at 1:47 PM, Chandler Latour <[EMAIL PROTECTED]>
> wrote:
>
>> Yes, exactly what I meant.
>>
>
> Polyfit just fits polynomials, there is no way of fixing the constant to
> zero. Your best bet is to use linalg.lstsq directly to fit the function you
> want.
>
> Chuck
>
>
>
> ___
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Charles R Harris
On Mon, Jun 16, 2008 at 1:47 PM, Chandler Latour <[EMAIL PROTECTED]>
wrote:

> Yes, exactly what I meant.
>

Polyfit just fits polynomials, there is no way of fixing the constant to
zero. Your best bet is to use linalg.lstsq directly to fit the function you
want.

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Chandler Latour

Yes, exactly what I meant.

On Jun 16, 2008, at 2:39 PM, Charles R Harris wrote:




On Mon, Jun 16, 2008 at 1:30 PM, Chandler Latour  
<[EMAIL PROTECTED]> wrote:

Hello,

I'm new to the whole numpy scene, but I've been wanting to run a
regression on some data.  I belive that polyfit is the way to go, but
I was wondering if there exists a way to force the intercept to be 0.
Any help would be much appreciated.

You mean fit a line passing through the origin?

Chuck


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Charles R Harris
On Mon, Jun 16, 2008 at 1:30 PM, Chandler Latour <[EMAIL PROTECTED]>
wrote:

> Hello,
>
> I'm new to the whole numpy scene, but I've been wanting to run a
> regression on some data.  I belive that polyfit is the way to go, but
> I was wondering if there exists a way to force the intercept to be 0.
> Any help would be much appreciated.
>

You mean fit a line passing through the origin?

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Polyfit

2008-06-16 Thread Chandler Latour
Hello,

I'm new to the whole numpy scene, but I've been wanting to run a  
regression on some data.  I belive that polyfit is the way to go, but  
I was wondering if there exists a way to force the intercept to be 0.   
Any help would be much appreciated.

Thanks
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Detecting phase windings

2008-06-16 Thread [EMAIL PROTECTED]
I have a speed problem with the approach I'm using to detect phase wrappings in 
a 3D data set. In my application, phaseField is a 3D array containing the phase 
values of a field. In order to detect the vortices/phase windings at each 
point, I check for windings on each of 3 faces of a 2x2 cube with the following 
code:

def HasVortex(cube):
''' cube is a 2x2x2 array containing the phase values
returns True if any of 3 orthogonal faces contains a phase wrapping
'''
# extract 3 cube faces - flatten to make indexing easier
c1 = cube[0,:,:].flatten()
c3 = cube[:,0,:].flatten()
c5 = cube[:,:,0].flatten()

# now order the phases in a circuit around each face, finishing in the same 
corner as we began
# Use numpy's phase unwrapping code, which has a default threshold of pi
u1 = unwrap(c1[cwi])
u3 = unwrap(c3[cwi])
u5 = unwrap(c5[cwi])

# check whether the final unwrapped value coincides with the value in the 
cell we started at
return not allclose(r_[u1[0],u3[0],u5[0]], r_[u1[4],u3[4],u5[4]])

vortexArray = array([int(HasVortex(phaseField[x:x+2,y:y+2,z:z+2]))
for x in range(phaseField.shape[0]-1)
for y in range(phaseField.shape[1]-1)
for z in range(phaseField.shape[2]-1)]\
   ).reshape((xs-1,ys-1,zs-1))

Whilst this does what I want, it's incredibly slow. I'm wondering whether 
anyone has done this before, or can think of a better approach.

My thoughts about a better approach are to stack the values along 3 new 
dimensions making a 6D array and use unwrap along the 3 new dimensions. 
Something like the following may give you an idea of what I mean, but it's a 
toy example trying to extend 2D into 3D, rather than 3D into 6D, because I 
haven't come to grips with enough of numpy's axis reshaping and stacking tricks 
to avoid getting a severe headache when trying to generalize it:

a = array([[1.,3.], [6.,5.]])
b = np.dstack((a, roll(a,-1,axis=1), roll(roll(a,-1,axis=0),-1,axis=1), 
roll(a,-1,axis=0), a))
print np.unwrap(b, axis=2)

A problem with this approach is that the memory requirements for the stacked 
version will be much greater, so some version using views would be preferable.

Any ideas?

Gary Ruben
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion