9a44bfee4725073937dc2c96f1c89ca30bd641c8,brian2/units/fundamentalunits.py,UnitRegistry,__getitem__,#UnitRegistry#Any#,1743

Before Change


        the first matching unit (which will typically be the unscaled
        version).
        
        matching = filter(lambda o: have_same_dimensions(o, x), self.objs)
        if len(matching) == 0:
            raise KeyError("Unit not found in registry.")
        // count the number of entries well represented by this unit 
        floatreps = np.asarray(map(lambda o:

After Change


        
        // count the number of entries well represented by this unit
        matching_values = np.asarray(matching)
        x_flat = np.asarray(x).flatten()
        floatreps = np.tile(x_flat, (len(matching), 1)).T / matching_values
        good_reps = np.sum((floatreps >= 0.1) & (floatreps < 1000), axis=0)
        if any(good_reps):
            return matching[good_reps.argmax()]
        else:
            return matching[0]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: brian-team/brian2
Commit Name: 9a44bfee4725073937dc2c96f1c89ca30bd641c8
Time: 2012-10-24
Author: marcel.stimberg@ens.fr
File Name: brian2/units/fundamentalunits.py
Class Name: UnitRegistry
Method Name: __getitem__


Project Name: senarvi/theanolm
Commit Name: a09308a3593b2639c2ca644c9aba061e77e68e3b
Time: 2017-05-09
Author: seppo.git@marjaniemi.com
File Name: theanolm/commands/score.py
Class Name:
Method Name: _score_text


Project Name: senarvi/theanolm
Commit Name: 0816c636b7d7832a0177a08a08888840d717bed4
Time: 2017-01-24
Author: seppo.git@marjaniemi.com
File Name: theanolm/commands/score.py
Class Name:
Method Name: _score_text