magenta / note-seq

A serializable note sequence representation and utilities.
Apache License 2.0
217 stars 57 forks source link

ValueError: zero-size array to reduction operation maximum which has no identity #81

Open laqieer opened 4 months ago

laqieer commented 4 months ago
<ipython-input-7-6d16bb6d5b91>:46: UserWarning: Exception occurred in note sequence figure of bgm_amb_username: zero-size array to reduction operation maximum which has no identity
  warnings.warn('Exception occurred in note sequence figure of ' + filename[:-4] + ': ' + str(e))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-0094c07d2f9f> in <cell line: 11>()
     31   #                       sample_rate=SAMPLE_RATE, sf2_path=SF2_PATH)
     32 
---> 33   fig = note_seq.plot_sequence(est_ns, show_figure=False)
     34   fig.background_fill_color = None
     35   fig.border_fill_color = None

3 frames
/usr/local/lib/python3.10/dist-packages/note_seq/notebook_utils.py in plot_sequence(sequence, show_figure, width, height, show_chords)
    177 
    178   # Create a Pandas dataframe and group it by instrument.
--> 179   dataframe = _sequence_to_pandas_dataframe(sequence)
    180   instruments = sorted(set(dataframe['instrument']))
    181   grouped_dataframe = dataframe.groupby('instrument')

/usr/local/lib/python3.10/dist-packages/note_seq/notebook_utils.py in _sequence_to_pandas_dataframe(sequence)
    145 
    146     # If no velocity differences are found, set alpha to 1.0.
--> 147     if np.max(pd_dict['velocity']) == np.min(pd_dict['velocity']):
    148       pd_dict['fill_alpha'] = [1.0] * len(pd_dict['fill_alpha'])
    149 

/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py in max(a, axis, out, keepdims, initial, where)
   2808     5
   2809     """
-> 2810     return _wrapreduction(a, np.maximum, 'max', axis, None, out,
   2811                           keepdims=keepdims, initial=initial, where=where)
   2812 

/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
     86                 return reduction(axis=axis, out=out, **passkwargs)
     87 
---> 88     return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
     89 
     90 

ValueError: zero-size array to reduction operation maximum which has no identity