I can quickly apply a cos function as follows to a float32 numpy array:
cos_f = np.vectorize(lambda x: math.cos(2 * math.pi * x))
signal = square_f(integral)
However if I try this:
square_f = np.vectorize(lambda x: sig.square(2 * math.pi * x))
signal = square_f(integral)
it takes 15 seconds for 60,000 samples. integral has a length of 1024 and is used as a buffer.
How should I be applying the square wave to my signal?