I need to run X amount of tasks in a day, and I need the frequency of the tasks to vary according to a wave function (with a period of 2pi/24, or with one peak per day and horizontal shift of 2pi/3.5 - I need to find the amplitude/vertical shift).
So I have the total daily tasks I want to run and I need to know how much time to sleep between them, according to time of day - how can I get to that equation? Can this be achieved in a simpler manner?
Example:
from datetime import datetime
from time import sleep
def get_daily_tasks(...):
...
def run_task(...):
...
def main(): # to be run daily
num_tasks = get_daily_tasks(...)
for _ in range(num_tasks):
run_task(...)
sleep_timer = sleep_timer(num_tasks, datetime.now()) # This is what I need to find
sleep(sleep_timer)