def temperature_profile_core(casu, initial_temperature, first_period_length,
                             rate_temperature_increase, target_temperature,
                             airflow_duration, third_period_length):
    temperature_reference = initial_temperature
    # first period
    flash_led(casu)
    start = time.time()
    stop = start + first_period_length - LED_DURATION
    while time.time() < stop:
        temperature_reference = min(
            target_temperature,
            temperature_reference + rate_temperature_increase * DELTA)
        casu.set_temp(temperature_reference)
        time.sleep(DELTA)
    # second period
    flash_led(casu)
    start = time.time()
    stop = start + airflow_duration - LED_DURATION
    casu.set_temp(initial_temperature)
    casu.set_airflow_intensity(1)
    time.sleep(airflow_duration)
    casu.airflow_standby()
    # third period
    flash_led(casu)
    time.sleep(third_period_length)
def infrared_hit(casu, temperature_reference, experiment_duration):
    flash_led(casu)
    casu.set_temp(temperature_reference)
    time.sleep(FIRST_FLASH_TIME)
    flash_led(casu)
    time.sleep(SECOND_FLASH_TIMED - FIRST_FLASH_TIME - LED_DURATION)
    flash_led(casu)
    time.sleep(experiment_duration * 60 - SECOND_FLASH_TIMED -
               FIRST_FLASH_TIME - 2 * LED_DURATION)
    flash_led(casu)
def temperature_profile_leaf(casu, initial_temperature, first_period_length,
                             rate_temperature_increase, target_temperature,
                             airflow_duration, third_period_length):
    temperature_reference = initial_temperature
    # first period
    flash_led(casu)
    casu.set_temp(temperature_reference)
    time.sleep(first_period_length - LED_DURATION)
    # second third period
    flash_led(casu)
    start = time.time()
    stop = start + airflow_duration + third_period_length - LED_DURATION
    while time.time() < stop:
        temperature_reference = min(
            target_temperature,
            temperature_reference + rate_temperature_increase * DELTA)
        casu.set_temp(temperature_reference)
        time.sleep(DELTA)