Modified sinusoids_protocol.py to be more general.