Transfer signal generation code to signals.py