History

python/lib/aubio/__init__.py: make sure length is not zero and float_type is imported

Paul Brossier committed 10 years ago

Commit b96a7b81 parent 0df6e9e1 file · +3 −0Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/lib/aubio/__init__.py+3−0
@@ -2,6 +2,7 @@ · 1 unmodified line
2 2
3import numpy3import numpy
4from ._aubio import *4from ._aubio import *
5from ._aubio import float_type
5from .midiconv import *6from .midiconv import *
6from .slicing import *7from .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)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t