signalflow
signalflow copied to clipboard
Correctly handle numpy.float32 in Node constructors
The results of numpy operations are not handled properly in Node ctors. For example:
>>> frequency = ScaleLinExp(MouseX(), 0, 1, np.min(feature_buffer.data), np.max(feature_buffer.data))
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
1. signalflow.ScaleLinExp(input: signalflow.Node = 0, a: signalflow.Node = 0, b: signalflow.Node = 1, c: signalflow.Node = 1, d: signalflow.Node = 10)
np.float32 is technically a single-element buffer with 0D dimensionality, so need handling explicitly by the automatic type inference.
Workaround is to convert to float with .astype(float).