Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | import numpy | 3 | import numpy |
| 4 | from ._aubio import * | 4 | from ._aubio import * |
| 5 | from ._aubio import float_type | ||
| 5 | from .midiconv import * | 6 | from .midiconv import * |
| 6 | from .slicing import * | 7 | from .slicing import * |
| 7 | 8 | ||
| @@ -10,6 +11,8 @@ class fvec(numpy.ndarray): · 2 unmodified lines | |||
| 10 | 11 | ||
| 11 | def __new__(cls, input_arg=1024, **kwargs): | 12 | def __new__(cls, input_arg=1024, **kwargs): |
| 12 | if isinstance(input_arg, int): | 13 | if isinstance(input_arg, int): |
| 14 | if input_arg == 0: | ||
| 15 | raise ValueError("vector length of 1 or more expected") | ||
| 13 | return numpy.zeros(input_arg, dtype=float_type, **kwargs) | 16 | return numpy.zeros(input_arg, dtype=float_type, **kwargs) |
| 14 | else: | 17 | else: |
| 15 | return numpy.array(input_arg, dtype=float_type, **kwargs) | 18 | return numpy.array(input_arg, dtype=float_type, **kwargs) |