Re: [Numpy-discussion] Medians that ignore values

2008-09-20 Thread Charles R Harris
On Fri, Sep 19, 2008 at 11:41 PM, David Cournapeau 
[EMAIL PROTECTED] wrote:

 Anne Archibald wrote:
 
  I, on the other hand, was making specifically that suggestion: users
  should not use nans to indicate missing values. Users should use
  masked arrays to indicate missing values.

 I agree it is the nicest solution in theory, but I think it is
 impractical (as mentioned by Eric Firing in his email).

 
  This part I pretty much agree with.

 I can't really see which one is better (failing or returning NaN for
 sort/min/max and their sort counterpat), or if we should let the choice
 be left to the user. I am fine with both, and they both require the same
 amount of work.

   Or we can make them behave drastically differently.
  Masked arrays clearly need to be able to handle masked values flexibly
  and explicitly. So I think nans should be handled simply and
  conservatively: propagate them if possible, raise if not.

 I agree about this behavior being the default. I just think that for a
 couple of functions, we could we give either separate functions, or
 additional arguments to existing functions to ignore them: I am thinking
 about min/max/sort and their arg* counterpart, because those are really
 basic, and because we already have nanmean/nanstd/nanmedian (e.g. having
 a nansort would help for nanmean to be much faster).


I would be happy to implement nan sorts if someone can provide me with a
portable and easy way to detect nans for single, double, and long double
floats. And not have it fail if the architecture doesn't support nans. I
think getting all the needed nan detection and setup in place is the first
step for anything else.

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


Re: [Numpy-discussion] Medians that ignore values

2008-09-20 Thread Robert Kern
On Sat, Sep 20, 2008 at 01:15, Charles R Harris
[EMAIL PROTECTED] wrote:

 I would be happy to implement nan sorts if someone can provide me with a
 portable and easy way to detect nans for single, double, and long double
 floats. And not have it fail if the architecture doesn't support nans. I
 think getting all the needed nan detection and setup in place is the first
 step for anything else.

We explicitly only support IEEE-754 architectures, so we are always on
an architecture that supports NaNs.

-- 
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] Medians that ignore values

2008-09-20 Thread Anne Archibald
2008/9/19 Eric Firing [EMAIL PROTECTED]:
 Pierre GM wrote:

 It seems to me that there are pragmatic reasons
 why people work with NaNs for missing values,
 that perhaps shd not be dismissed so quickly.
 But maybe I am overlooking a simple solution.

 nansomething solutions tend to be considerably faster, that might be one
 reason. A lack of visibility of numpy.ma could be a second. In any case, I
 can't but agree with other posters: a NaN in an array usually means something
 went astray.

 Additional reasons for using nans:

 1) years of experience with Matlab, in which using nan for missing
 values is the standard idiom.

Users are already retraining to use zero-based indexing; I don't think
asking them to use a full-featured masked array package is an
unreasonable retraining burden, particularly since this idiom breaks
as soon as they want to work with arrays of integers or records.

 2) convenient interfacing with extension code in C or C++.

 The latter is a factor in the present use of nan in matplotlib; using
 nan for missing values in an array passed into extension code saves
 having to pass and process a second (mask) array.  It is fast and simple.

How hard is it to pass an array where the masked values have been
filled with nans? It's certainly easy to go the other way (mask all
nans). I think this is less painful than supporting two
differently-featured sets of functions for dealing with arrays
containing some invalid values.

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


Re: [Numpy-discussion] Medians that ignore values

2008-09-20 Thread David Cournapeau
Charles R Harris wrote:



 I would be happy to implement nan sorts if someone can provide me with
 a portable and easy way to detect nans for single, double, and long
 double floats. And not have it fail if the architecture doesn't
 support nans. I think getting all the needed nan detection and setup
 in place is the first step for anything else.

I guess you mean when isnan is available but broken, since we do not
support platforms without IEEE 754 support ? I want to take care of this
for my umathmodule cleaning (all the configuration checks/replacements
are in place; if we want to be paranoid, we could check whether isnan
works for all types if found on the system).

cheers,

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


Re: [Numpy-discussion] NEW GENERATED DLL ERROR FOUND WITHIN f2PY.py

2008-09-20 Thread David Cournapeau
Blubaugh, David A. wrote:
 ImportError: DLL load with error code 193
   

Likely to be a build error: how did you build the .pyd file ?

cheers,

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


Re: [Numpy-discussion] Medians that ignore values

2008-09-20 Thread Jake Harris
On Sat, Sep 20, 2008 at 11:02 AM, Jake Harris [EMAIL PROTECTED]wrote:


 Because you're always working with probabilities, there is almost always no
 ambiguity...whenever NaN is encounter, 0 is what is desired.


...of course, division presents a good counterexample.


 Bad idea?



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