[SciPy-dev] subversion commit policy for rename files question

josef.pktd at gmail.com josef.pktd at gmail.com
Sat Nov 22 00:10:03 EST 2008


On Fri, Nov 21, 2008 at 11:30 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On Fri, Nov 21, 2008 at 21:29,  <josef.pktd at gmail.com> wrote:
>> I want to do the renaming and importing in __all__ discussed here:
>> http://projects.scipy.org/pipermail/scipy-dev/2008-November/010241.html
>> For this I had to resolve some circular imports and add some missing
>> functions to __all__.
>>
>> Is there a policy whether renames should be committed separately or
>> can it be together with changes in the file,
>> or it doesn't matter?
>
> I take my "doesn't matter" back. Yes, please do file renames and
> internal modifications separately.
>
> --
> Robert Kern


Thanks, I will do it in several steps.
All tests pass (after making sure that no old stuff is lying around),
but not every function is tested.
Also np.lookfor picks it up


Robert,
given our previous discussion, and the wikipedia definition of
percentileofscore, I don't see any reason not to do a very simple
implementation.
Initially, I thought the proposed implementation can be vectorized,
but I don't see how. Without vectorization, this version looks much
simpler and, I guess, should be about as fast:

import numpy as np

def percentileofscore(a, score, kind = 'mean' ):
    a=np.array(a)
    n = len(a)
    if kind == 'strict':
        return sum(a<score) / float(n) * 100
    elif kind == 'weak':
        return sum(a<=score) / float(n) * 100
    elif kind == 'mean':
        return (sum(a<score) + sum(a<=score)) * 50 / float(n)
    else:
        raise NotImplementedError

If you think this is ok, I put it in svn, I'm not sure whether to call
the type, "kind", doctest pass the same as previous version

Josef



More information about the SciPy-Dev mailing list