[SciPy-dev] subversion commit policy for rename files question
Robert Kern
robert.kern@gmail....
Fri Nov 21 23:25:57 CST 2008
On Fri, Nov 21, 2008 at 23:10, <josef.pktd@gmail.com> wrote:
> On Fri, Nov 21, 2008 at 11:30 PM, Robert Kern <robert.kern@gmail.com> wrote:
>> On Fri, Nov 21, 2008 at 21:29, <josef.pktd@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
I'd raise a ValueError with a message stating that 'strong', 'weak',
and 'mean' are the only correct values, but otherwise, that looks
fine.
--
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
More information about the Scipy-dev
mailing list