Skip to content

Issue for any stochastic test failures in CI so we can track them #3186

Open
@zm711

Description

@zm711

This only failed on one OS/one python version. Not sure if this is a problem in generate_sorting_to_inject which can cause some failures. We can leave this issue open to monitor if this problem happens multiple times.

From action: https://github.com/SpikeInterface/spikeinterface/actions/runs/9898102287/job/27344129816?pr=3185

_______________________ test_generate_sorting_to_inject ________________________

    def test_generate_sorting_to_inject():
        durations = [10.0, 20.0]
        sorting = generate_sorting(num_units=10, durations=durations, sampling_frequency=30000, firing_rates=1.0)
>       injected_sorting = generate_sorting_to_inject(
            sorting, [int(duration * sorting.sampling_frequency) for duration in durations]
        )

src/spikeinterface/core/tests/test_generate.py:549: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/spikeinterface/core/generate.py:293: in generate_sorting_to_inject
    min_diff = np.min(np.abs(injected_spike_train[:, None] - spike_train[None, :]), axis=1)
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numpy/core/fromnumeric.py:2953: in min
    return _wrapreduction(a, np.minimum, 'min', axis, None, out,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = array([], shape=(0, 0), dtype=int64), ufunc = <ufunc 'minimum'>
method = 'min', axis = 1, dtype = None, out = None
kwargs = {'initial': <no value>, 'keepdims': <no value>, 'where': <no value>}
passkwargs = {}

    def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
        passkwargs = {k: v for k, v in kwargs.items()
                      if v is not np._NoValue}
    
        if type(obj) is not mu.ndarray:
            try:
                reduction = getattr(obj, method)
            except AttributeError:
                pass
            else:
                # This branch is needed for reductions like any which don't
                # support a dtype.
                if dtype is not None:
                    return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
                else:
                    return reduction(axis=axis, out=out, **passkwargs)
    
>       return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
E       ValueError: zero-size array to reduction operation minimum which has no identity

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions