f9aea094643fb3240193b0bc0f1908d5b84d82ab,dask_image/ndmeasure/__init__.py,,center_of_mass,#Any#Any#Any#,24

Before Change


        sl[i] = slice(None)
        sl = tuple(sl)

        input_i = dask.array.arange(input.shape[i], chunks=input.chunks[i])
        input_wt = input * input_i[sl]

        input_wt_mtch_sum.append(sum(input_wt, labels, index))

After Change


    type_mapping = collections.OrderedDict([
        (("%i" % i), input.dtype) for i in _pycompat.irange(input.ndim)
    ])
    out_dtype = numpy.dtype(list(type_mapping.items()))

    default_1d = numpy.full((1,), numpy.nan, dtype=out_dtype)

    func = functools.partial(
        _utils._center_of_mass, shape=input.shape, dtype=out_dtype
    )
    com_lbl = labeled_comprehension(
        input, labels, index,
        func, out_dtype, default_1d[0], pass_positions=True
    )

    com_lbl = dask.array.stack([com_lbl[k] for k in type_mapping], axis=-1)

    return com_lbl
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: dask/dask-image
Commit Name: f9aea094643fb3240193b0bc0f1908d5b84d82ab
Time: 2018-09-30
Author: jakirkham@gmail.com
File Name: dask_image/ndmeasure/__init__.py
Class Name:
Method Name: center_of_mass


Project Name: daavoo/pyntcloud
Commit Name: b6106d3044f7800af8710cbdc998ed78f7e6588c
Time: 2016-11-30
Author: daviddelaiglesiacastro@gmail.com
File Name: pyntcloud/structures/octree.py
Class Name: Octree
Method Name: get_level_as_sf


Project Name: freelunchtheorem/Conditional_Density_Estimation
Commit Name: a0dfab7ed2d74913e92f35e647f30c648df68f36
Time: 2018-03-25
Author: f4bio.ferreira@gmail.com
File Name: cde/tests/issue1_noise_regularization.py
Class Name:
Method Name: issue1