# Setting Different Temperatures Across Smart Sleeve Array

**URL:** https://www.evolver.bio/t/setting-different-temperatures-across-smart-sleeve-array/38
**Category:** Data Processing Unit
**Created:** [March 19, 2019, 10:51pm UTC](https://www.evolver.bio/t/setting-different-temperatures-across-smart-sleeve-array/38 "2019-03-19T22:51:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bgwong](https://yyz1.discourse-cdn.com/flex035/user_avatar/www.evolver.bio/bgwong/32/262_2.png) [@bgwong](https://www.evolver.bio/u/bgwong)
#### Post date: [March 19, 2019, 10:51pm UTC](https://www.evolver.bio/t/setting-different-temperatures-across-smart-sleeve-array/38/1 "2019-03-19T22:51:32Z")

</div>

**Question from User:**

eVOLVER wouldn’t adjust the temperature to 33C even when I changed it in custom\_script. I had to manually change it to set different temperatures.

---

<div class="post-metadata">

### Author: ![bgwong](https://yyz1.discourse-cdn.com/flex035/user_avatar/www.evolver.bio/bgwong/32/262_2.png) [@bgwong](https://www.evolver.bio/u/bgwong)
#### Post date: [March 19, 2019, 11:05pm UTC](https://www.evolver.bio/t/setting-different-temperatures-across-smart-sleeve-array/38/2 "2019-03-19T23:05:50Z")

</div>

**Brief Response:**  
Generally, the temperature gets updated based on what is written on the temp\_config files (in the same file directory structure as the OD and temp data). The script interprets the last value that was written there and updates the vials accordingly. If for whatever reasons there are issues with temperature updates, first thing to check is if the temp\_config file is properly updated after the first measurement or two (might take one measurement cycle to update).

**in More Detail:**

The temperatures initially get written in the config file with this code block (from custom\_script.py). This code segment basically takes whatever values you enter in custom script and writes them into temp\_config:

```python
        if (len(temp_config) is 2): #set temp at the beginning of the experiment, can clone for subsequent temp changes
                if np.isscalar(temp_input):
                    temp_val = temp_input
                else:
                    temp_val = temp_input[x]

                text_file = open(tempconfig_path,"a+")
                text_file.write("{0},{1}\n".format(elapsed_time, temp_val))
                text_file.close()

```

Consequently, another segment of code (in eVOLVER\_module.py) updates the eVOLVER with the appropriate changes:

```python
    temps = []
    for x in vials:
        file_path = "{0}/{1}/temp_config/vial{2}_tempconfig.txt".format(save_path,exp_name,x)
        temp_set_data = np.genfromtxt(file_path, delimiter=',')
        temp_set = temp_set_data[len(temp_set_data)-1][1]
        temp_set = int((temp_set - temp_cal[1][x])/temp_cal[0][x])
        temps.append(temp_set)

        try:
            temp_data[x] = (float(temp_data[x]) * temp_cal[0][x]) + temp_cal[1][x]
        except ValueError:
            print("Temp Read Error")

```

If the value is different than what it was in the past, then update the evolver again.

```python
    if not temps == current_temps:
        MESSAGE = list(temps)
        command = {'param':'temp', 'message':MESSAGE}
        dpu_evolver_ns.emit('command', command, namespace='/dpu-evolver')
        current_temps = temps

```

Hope this helps. Please let me know if this solves the issues.

---

<div class="post-metadata">

### Author: ![heinsz](https://yyz1.discourse-cdn.com/flex035/user_avatar/www.evolver.bio/heinsz/32/52_2.png) [@heinsz](https://www.evolver.bio/u/heinsz)
#### Post date: [March 20, 2019, 12:10pm UTC](https://www.evolver.bio/t/setting-different-temperatures-across-smart-sleeve-array/38/3 "2019-03-20T12:10:40Z")

</div>

Adding to this, the code at the moment does not write to `temp_config` every iteration - it only will write to it at the start. You should modify `custom_script.py` to write out to `temp_config` as shown above when you want to change the temperature mid experiment.@bgwong, let’s talk about simplifying this - I think it makes more sense to have a call out to the `eVOLVER_module` to handle all the logic around temperature changing/logging. The files shouldn’t really be getting modified or looked at in `custom_script.py`. I think a similar thing happens for `OD_set`. I’ll add some issues on github.

---

<div class="post-metadata">

### Author: ![fkuzminov](https://avatars.discourse-cdn.com/v4/letter/f/bbce88/32.png) [@fkuzminov](https://www.evolver.bio/u/fkuzminov)
#### Post date: [March 21, 2019, 4:10pm UTC](https://www.evolver.bio/t/setting-different-temperatures-across-smart-sleeve-array/38/4 "2019-03-21T16:10:49Z")

</div>

Thanks for the response. I’ll check this when I start the next experiment. The problem was that even when I modified the temperature in `custom_script.py` before starting the experiment it didn’t update the temperature for some reason.
