Introduction

Water temperature constitutes a key physical property of riverine ecosystems. It has been described as the ‘abiotic master factor’ for fishes1,2, strongly affecting their energy balance and behavior3,4. In natural habitats, temperature may change on a variety of spatial and temporal scales. Thermal gradients occur at river confluences, at locations where rivers flow into lakes, and within vertically stratified lakes. As most fish species are ectotherms, their body temperature changes according to the temperature of the water they occupy5. Further, the metabolic performance (and thus functions including growth, reproduction, and locomotion) of ectotherms takes the form of a bell-shaped curve as a function of temperature6, peaking within a range of optimal temperatures (the ‘preferendum’) and going to zero at lower and upper temperature limits7.

Because they lack physiological means to regulate body temperature, fish have two main choices when exposed to heterothermal environments (i.e., environments in which temperature varies over space and/or time): adapt physiologically to changes in local temperature (physiological plasticity8,9) or adopt specific behaviors to regulate their body temperature (behavioral thermoregulation5,10). Behavioral thermoregulation allows fish to thrive in environments where temperature fluctuates, by maximizing the time spent in areas where temperature is within their optimum performance range and by avoiding temperature extremes. While fish may generally adjust to gradual temperature changes through physiological plasticity, the risk of stress increases for more rapid temperature changes11 and in this situation, behavioral thermoregulation may be of greater importance.

Fish were found to actively seek optimal temperatures in their environment through movement behavior 50 years ago12. Recent experiments to determine the mechanisms underlying behavioral thermoregulation have identified both thermokinetic and thermotactic components13,14. Thermokinesis refers to a change in the rate of movement of fish in response to temperature. One explanation for thermokinesis is that a change in body temperature impacts the metabolic rate, which in turn affects movement activity. In this scenario, thermal sensing is not required. For instance, zebrafish larvae (Danio rerio) increase their turn frequency, turn amplitude and swimming speed when water temperature is increased from 18 °C to 32 °C 15. This thermokinetic behavior can explain how zebrafish larvae avoid warmer water, but not how they avoid colder water.

Thermotaxis, in contrast, is the directed movement along a temperature gradient, toward warmer or colder water, and requires the ability to sense a temperature gradient13,14. Fish may achieve thermotaxis either by sensing a thermal gradient spatially along their body or temporally over a given time window as they swim. The response to a thermal gradient can then be either deterministic, through directed movement along the gradient, or biased, for example through the increase in the turning rate when moving down the gradient, analogous to bacterial chemotaxis16,17. Thermotaxis has been observed in a number of vertebrate organisms1820, but very few quantitative studies of thermotaxis have been conducted in fish. Among these is work showing that larval zebrafish integrate thermal information over a 500-ms time window5 and bias the magnitude and direction of their turns to favor movement toward colder regions.

Past studies have investigated the long-term (hours) behavioral response of fish to stationary thermal gradients. In contrast, very little is known about the thermoregulatory behavior in response to the exposure to sharp, rapidly occurring thermal gradients associated for example with anthropogenic disturbances13. Here, we report experiments to quantify the thermoregulatory behavior of a salmonid in its early life-stages in response to the rapid formation of sharp thermal gradients generated using a lock-release approach. Salmonids are among the most common and well-studied families of freshwater fish in the northern hemisphere, yet we know little about their thermoregulatory behavior21. All salmonids spawn in the shallow gravel beds of freshwater headstreams and spend most of their juvenile stage in rivers and small creeks, where temperature regimes are often strongly affected by human activities22. Due to their small body size, the early life-stages of fish gain or lose heat rapidly, making them particularly sensitive to thermal disturbances23.

The natural thermal regime of rivers can be significantly altered by human activities24, including the operation of storage hydropower (i.e., induced thermopeaking)22,25, the use of water for cooling in thermal power plants26, flow regulation at artificial barriers27,28, urbanization29 and climate change30,31. If the local water temperature changes too rapidly, this might trigger an avoidance response, driving fish to abandon habitats21. For example, recent observations of the impact of thermopeaking show that a sudden decrease in water temperature (by 2.5 °C in 10 min) led to significantly higher downstream drift of juvenile European grayling (Thymallus thymallus) than during events with increasing water temperature (1).

However, research on this topic remains scarce32 and the mechanisms underlying rapid behavioral thermoregulation have remained unclear. Human-induced thermal alterations in freshwater systems can be unnaturally rapid and strong25. For example, the water temperature downstream of hydropower facilities can decrease by up to 6 °C within minutes in spring and summer, and increase strongly (up to 4 °C) in winter25. During spring and summer, cold thermopeaking may cause significant mortality, as it coincides with the presence of early life stages of salmonids and cyprinids (32). Rapid thermal changes (multiple degrees Celsius over minutes) are likely challenging for fish, partly because their natural occurrence over evolutionary timescales might have been rare. For instance, if they are unable to relocate upon being exposed to cold water, fish can become cold-shocked, a lethargic state of slowed metabolism, reduced oxygen uptake and muscle stiffness, which results in reduced swimming activity and increased risk of predation11.

The primary aim of our study was to quantify how brown trout parr (Salmo trutta), hereafter trout, respond to rapid (i.e., over timescales τPHYS of minutes) thermal disturbances. To mimic the rapid release of thermal effluent into a freshwater system, we developed a laboratory setup that uses the lock-release of a gravity current to rapidly expose fish acclimated to 12 ° (their assumed thermal preferendum) to a warmer or colder body of water. By continuously tracking individual fish, we quantified their response to incoming water of different temperatures (Tincoming = 4–20 °C). We hypothesized that after rapid exposure fish would avoid the incoming colder or warmer water across all treatments and that they would do so through a combination of thermokinesis and thermotaxis. To test this hypothesis, we developed a novel imaging approach that allowed simultaneous tracking of the thermal interface and the swimming behavior of individual fish at high spatio-temporal resolution. Our results indicate that fish use both thermokinetic and thermotactic behaviors to rapidly and effectively avoid incoming cold water, whereas they perform frequent excursions into incoming warm water, possibly as a strategy to gradually elevate their body temperature.

Results

To test the hypothesis that strong thermal gradients trigger an avoidance response in trout, we exposed individuals (in groups of four for each replicate experiment) to heterothermal conditions in a laboratory setup. The setup consisted of a lock-exchange tank initially divided into equal halves containing water at two different temperatures (Fig. 1A). To avoid behavioral bias due to visual cues, the tank was shielded with white semi-transparent material (except for the front and the water surface). The experiments were conducted in a dark room and the tank was illuminated with a light source from behind (Supplementary Fig. 1 the left side of the tank, fish were acclimated for 15 min to water at 12 °C, which is assumed to be their thermal preferendum33,34. This water temperature was also equal to the husbandry tank at our experimental facility. The right side of the tank contained water at a different temperature (colder or warmer), dyed blue (Patent blue V sodium salt, Sigma Aldrich) to allow visualization of the thermal interface (Supplementary Fig. 2). Experiments included four cold treatments (TR1, 10 °C; TR2, 8 °C; TR3, 6 °C; TR4, 4 °C) and four warm treatments (TR6, 14 °C; TR7, 16 °C; TR8, 18 °C; TR9, 20 °C) (Supplementary Table 1). After the 15 min acclimation time, the vertical lock separating the two halves of the tank was rapidly lifted, resulting in a gravity current with warmer water intruding along the top of the tank and colder water intruding in the opposite direction along the bottom. The initial gravity current reached the end-wall of the tank after 1–2 min, creating a sharp thermal interface vertically separating the colder water in the bottom part of the tank (Tbottom) from the warmer water in the top part (Ttop) (Fig. 1B; Supplementary Fig. 2). Owing to the oscillations triggered by the lock release, the vertical location of the thermal interface was not constant in time (Supplementary Movies 1 and 2), but instead oscillated around the half depth of the tank, with oscillations dissipating over time (Supplementary Fig. 3).

Lock-exchange tank used to expose fish to an acute heterothermal environment. (A) Side-view of the experimental tank during the acclimation phase (15 min), with fish in the left compartment exposed to water at their acclimation temperature (12 °C) separated by a closed gate from the dyed water of a different temperature in the right compartment. Red ellipses indicate the locations of four trout parr tested simultaneously. Fish were tracked continuously based on video recordings of the lateral view of the entire tank. (B) The treatment phase was initiated by rapidly removing the gate, allowing the cold water to slowly intrude below the warmer water (1–2 min), thereby exposing the fish to a heterothermal environment. A sharp thermal interface (dashed line) separated upper, warmer water from lower, colder water. Within the first two minutes, the thermal interface moved laterally and afterwards spanned the entire lateral extent of the tank. Over time, the interface increasingly stabilized around the central depth of the tank. The movement of the interface was much slower than fish swimming speeds (Supplementary Figs. 3 and 20). The frame used here for illustration was captured in a cold-water treatment, 11 min after gate removal. (C) Trajectory of a single fish over 18 min (treatment TR3, Tbottom = 6 °C, Ttop = 12 °C). The trajectory is color-coded according to the temporal phase of the experiment (see D). (D) The different phases of the experiments. After 15 min acclimation, the gate was removed and it took approximately 2 min to establish a horizontal thermal interface spanning the entire tank length. To allow the analysis of temporal trends in fish behavior, the dataset was divided into four periods of equal duration: acclimation, and experimental phases p1–p3. For a list of treatments, see Supplementary Table 1.

The lateral view of the entire tank was continuously recorded for 35 min with a camera at 24 frames per second, starting four minutes after releasing the fish. Using image analysis, we obtained the two-dimensional projection of the trajectory of each fish over the entire duration of the experiment (Fig. 1C), while simultaneously tracking the instantaneous location of the thermal interface (Supplementary Fig. 4). In this manner, we determined the water temperature experienced by each fish at each point in time. Trajectories were analyzed for the last 6 min of the acclimation period and for the 18-min treatment period, which we divided into three phases of 6 min each (treatment phases p1, p2, and p3; Fig. 1D). The depth occupancy was computed from the vertical position of the fish Y(t) and normalized to the range Ynorm = 0–1, with 1 being the maximum depth (28 cm) of the tank. To quantitatively analyze fish movement behavior in relation to the thermal interface, each trajectory was binarized in time based on whether at a given instant a fish was in the warm or the cold water, as determined from the instantaneous vertical distance to the thermal interface, D(t) (Fig. 2A,B; Supplementary Movies 1 and 3; Materials and Methods).

Fish avoid the cold, but not the warm. (A) Side-view of the (two-dimensional) swimming trajectory of a fish (colored line) in relation to the thermal interface (dashed black line). Black dots along the trajectory indicate the center of gravity of the fish during an example segment of 12 s. Colors indicate elapsed time, from blue to yellow. (B) Definition of warm- and cold-water excursions within a trajectory based on the fish’s instantaneous vertical distance to the thermal interface, D(t). An excursion starts and ends when the fish crosses the thermal interface. (C and F) Probability density functions of normalized fish depth Ynorm during the final 6 min (p3) of the experiments for all cold-water (TR1–TR4, C) and all warm-water (TR6–TR9, F) treatments. Data was aggregated at the treatment level, hence each line represents data from 20 fish, tested in groups of 4 individuals in 5 separate experiments. Tbottom and Ttop indicate the water temperature below and above the thermal interface. The depth was normalized so that Ynorm = 0 is the water surface and Ynorm = 1 indicates the bottom of the tank. (D and G) Probability density functions of fish depth for TR2 (D) and TR7 (G), separated according to the four phases of analysis (acclimation phase and experimental phases p1–p3; see Fig. 1D). Data were aggregated at the treatment level as in C and F. Data for other treatments are shown in Supplementary Fig. 5. (E and H) Vertical distance to the interface, D, as a function of time for each cold-water (light blue shaded region) and warm-water excursion (light pink shaded region) for TR2 (N = 980) (E) and TR7 (N = 430) (H) aggregated for all three experimental phases (p1–p3). N is the total number of cold-water excursions performed by the 20 fish. Data for other treatments are shown in Supplementary Figs. 6 and 7. For a list of treatments, see Supplementary Table 1.

Trout parr avoid cold water by biasing their vertical turns and do not avoid warm water

Fish showed a clear thermotactic avoidance behavior of incoming cold water for Tbottom ≤ 8 °C. During phase p3 in the three coldest treatments, TR2 (Tbottom = 8 °C), TR3 (Tbottom = 6 °C) and TR4 (Tbottom = 4 °C), fish predominantly occupied the upper half of the tank (Ynorm = 0–0.5) and avoided the colder water in the bottom half (Fig. 2C; see also Supplementary Fig. 9). From phase p1 to p3, fish spent 75–95% of the time above the thermal interface (Supplementary Fig. 8A). This represents a substantial change of the preferential depth occupancy compared to the acclimation phase, in which fish spent 50–90% of the time in the lower half of the tank (Ynorm = 0.5–1; Supplementary Fig. 9). The response was rapid, with avoidance of the cold water being apparent already in phase p1 and persisting through to the end of the experiment (TR2 in Fig. 2D; all cold-water treatments in Supplementary Fig. 5 A-D). In contrast, incoming cold water in TR1 (Tbottom = 10 °C) – i.e. only 2 °C colder than the acclimation temperature – did not trigger an avoidance behavior: the depth occupancy showed a bimodal distribution with peaks in both the warmer and colder water (Fig. 2C).

Fish did not avoid warmer water in any of the warm-water treatments (TR6–TR9). Instead, fish transitioned to a bimodal depth occupancy, with comparable time spent above and below the interface (Fig. 2F; Supplementary Fig. 8B). This bimodal behavior was especially pronounced in the later phases, p2 and p3 (TR7; Fig. 2G; all warm-water treatments in Supplementary Fig. 5 EH), whereas in phase p1 the depth occupancy was similar to that exhibited during the acclimation period, with 50– 70% of the time spent in the lower, colder water (Supplementary Fig. 10). Thus, over time fish increasingly occupied warmer water across all warm-water treatments, reducing the fraction of time spent below the interface during phase p3 to 30–50% (Supplementary Figs 8B and 10).

Further analysis of the response to cold water treatments revealed a strong asymmetry between warm-water and cold-water excursions, defined as the periods of time during which a fish was above or below the thermal interface, respectively. This asymmetry was present in treatments with Tbottom ≤ 8 °C: TR2 (Fig. 2E), TR3 and TR4 (Supplementary Fig. 6C,D), but not TR1 (Supplementary Fig. 6A). In cold treatments TR2, TR3 and TR4, cold-water excursions were considerably shorter (91–94% shorter than 10 s) than warm-water excursions (38–49% shorter 10 s; Supplementary Table 3). In contrast, during all warm treatments, warm and cold excursions had similar durations (Fig. 2H, Supplementary Fig. 7).

To determine the behavioral mechanism underlying cold-water avoidance, we analyzed the fine-scale features of the fish trajectories as a function of the position of the fish relative to thermal interface. We identified upward and downward turning events within each trajectory, based on when the vertical velocity component vy changed sign (Fig. 3A, B; Materials and Methods; Supplementary Fig. 11). For each turning event, we computed the corresponding vertical distance D^ to the thermal interface. We also quantified the median number of cold-water excursions Ñ of the four fish within each experimental replicate. We found that fish reduced their tendency to cross the thermal interface and rapidly redirected their swimming when in the colder water. In cold-water treatments TR2-TR4 (Tbottom ≤ 8 °C) the median number of interface crossings was significantly lower than in TR1 (Tbottom = 10 °C) (ANOVA and post hoc pairwise t-tests – p < 0.01, Fig. 3C). In TR2-TR4, the probability of upward turning ρup exceeded the probability of downward turning ρdown for the entire region below the interface (-20 cm < D^ < 0 cm; Fig. 3D,F, Supplementary Fig. 12). This difference in probabilities (ρup - ρdown) was particularly large in the region immediately above and below the interface (-5 cm < D^ < 5 cm; Fig. 3F) and is a hallmark of a thermotactic behavior.

Fish avoid cold water by directional upward turning. (A) Example trajectory (12 s) with identified vertical turning points (pink triangles, downward; green triangles, upward). (B) Turning points were identified as sign changes of the time series of the vertical velocity component, vy(t). The same trajectory as in A is shown. (C) Boxplots showing the number of cold-water excursions for each cold temperature treatment. Each dot represents the median number of cold-water excursions Ñ of four individuals tested simultaneously within one experiment. Red lines indicate the median of 5 experiments. Whiskers extent to the full range of observations. The temperature treatments TR2 and TR4 differ significantly (ANOVA, p < 0.001), with pairwise t-test results as indicated (* 0.01 < p ≤ 0.05; ** 0.001 < p ≤ 0.01, see also Supplementary Table 18-20). (D and E) Swimming trajectories (gray lines) and vertical turning points (color-coded as in panel A) plotted with respect to the vertical distance D^ to the thermal interface (black dashed line) for cold-water treatment TR2 (D) and warm-water treatment TR7 (E). The trajectories shown are from the central region (80 < X < 120 cm) of the tank, for 20 fish (5 x 4 fish per experiment). Turning points were filtered based on a vertical displacement threshold of dz > 3 cm to detect turning activity that resulted in significant vertical displacement (Supplementary Fig. 14). Data for other treatments are shown in Supplementary Figs. 12 and 13. (F and G) Difference of probability density distributions of upward turns (ρup) and downward turns (ρdown) for the entire width of the tank (0 < X < 200 cm) as a function of the distance from the thermal interface (located at D^ = 0), for all cold (F) and warm treatments (G). The same y-axes as in panels D and E apply. The tank bottom is located at around -10 cm > D^ > -20 cm, while the water surface is located at around 10 cm < D^ < 20 cm (the variability being related to the initial period of time in which the thermal interface oscillates). The underlying normalized histograms are in Supplementary Figs. 14 C and E.

This thermotactic avoidance behavior was absent in TR1 and all warm treatments, where the probabilities of upward and downward turning were similar (ρup - ρdown ≈ 0) close to the interface (-5 cm < D^ < 5 cm) (Fig. 3E,G). In these treatments, the probability of upward turning peaked below the thermal interface, close to the bottom of the tank (-15 cm < D^ < -10 cm; Fig. 3G), while the probability of downward turning peaked above the thermal interface, close to the water surface (10 cm < D^ < 15 cm; Fig. 3E, G, Supplementary Fig. 13 for TR6–TR9).

Fish modulate the duration and depth of cold-water excursions as a function of cold-water temperature

In cold treatments fish did not exclusively stay within the upper warmer water layer, but engaged in occasional exploratory behavior of the underlying, colder water. In particular, fish did not reduce the frequency of cold-water excursions over time (Supplementary Fig. 15A). During these excursions, they crossed the interface downwards and thus experienced a sudden decrease in temperature. We found that fish modulated these cold-water excursions as a function of the temperature of the colder water. The duration Ω (s) and depth Dmax (the maximum vertical distance below the thermal interface) of cold-water excursions both decreased (Fig. 4A) with decreasing temperature of the lower layer (Tbottom). This trend was statistically significant for both the median duration Ω (Fig. 4B) and the median depth Dmax (Fig. 4C) across treatments (Mann–Kendall test, p < 0.001, Supplementary Table 6). As Tbottom decreased from 10 °C to 4 °C (TR1 to TR4), the median excursion duration decreased by 57% (from Ω = 6 s to Ω = 2.6 s) and the median excursion depth decreased by 57% (from Dmax = 9.9 cm to Dmax = 4.3 cm, Supplementary Table 5).

Fish reduce the duration and depth of cold-water excursions in larger measure the colder the water temperature below the thermal interface. (A) Fish perform cold-water excursions in which they cross the thermal interface and swim into colder water, then turn upward to return to the warmer water. Individual cold excursions were characterized by their duration, Ω, and the maximum vertical distance to the thermal interface, Dmax. (B) Fish exhibit shorter durations of cold-water excursions when encountering lower water temperatures below the interface (Tbottom). The decreasing trend was statistically significant (Mann–Kendall test: for Ω, p < 0.001; for Dmax, p < 0.001; Supplementary Table 6). Boxplots show the median duration of cold-water excursions for fish groups across all phases (p1, p2 and p3) within each treatment. Points represent the median of a single experiment. TR2, one outlier not shown (out of range). (C) For colder water temperatures, fish penetrate less deeply into the cold lower water. The decreasing trend was statistically significant (Mann–Kendall test: Dmax, p < 0.001; Supplementary Table 6). Underlying distributions and histograms are shown in Supplementary Fig. 18. Equivalent plots for warm treatments are shown in Supplementary Fig. 17A,B. (D and E) Probability density distributions of the durations Ω of warm- and cold-water excursions for TR1 (D) and TR3 (E), respectively. The distributions of the warm- and cold-water excursion durations become increasingly distinct over exposure time for TR3 but not TR1. Excursions at 12 °C (above the interface) are shown in black, while excursions in the lower, colder water are depicted in the respective color. Treatment phases are indicated by line type (p1–p3). Values of n indicate the total number of excursions of each type within that phase for 20 fish (as the excursions alternate, n is equal for cold and warm excursions). Underlying histograms of D and E and other treatments are shown in Supplementary Fig. 19 and 16.

To understand whether this exploratory behavior of the colder water changed over the 18-min duration of the experiments, we analyzed the distribution of the excursion duration Ω of warm- and cold-water excursions separately for each phase (p1, p2 and p3). For TR1 (Tbottom = 10 °C, Ttop = 12 °C), cold and warm water excursions showed almost identical distributions of their durations, and the distributions changed little over time across the three phases (Ω̃warm = 6.7 s, 7.5 s, 7.3 s and Ω̃cold = 8.4 s, 4.9 s, 5.1 s, for p1, p2, p3 respectively; Fig. 4D). The same conclusions apply to all warm treatments (TR6–TR9; Supplementary Fig. 16 E–H). In stark contrast, in cold- treatment TR3 the distributions of the durations of cold-water excursions (into Tbottom = 6 °C) and warm-water excursions (into Ttop = 12 °C) are clearly distinct already in phase p1, and this difference increases in p2 and p3 (Ω̃warm = 9.8 s, 15.5 s, 15.8 s and Ω̃cold = 3.7 s, 2.8 s, 2.8 s for p1, p2, p3, respectively; Fig. 4E). In particular, short warm-water excursions (0.1 s < Ω < 10 s) and long cold-water excursions (10 s < Ω < 100 s) became less frequent over time. A similar pattern is observed in TR2 and TR4 (Supplementary Fig. 16B, D).

Fish swimming speed increases during short-term exposure to cold water

In addition to displaying a thermotactic behavior in modulating their turning events upon experiencing temperature gradients, fish further reduced cold-water exposure through a thermokinetic behavior, by increasing their swimming speed when in cold water. For Tbottom ≤ 6 °C (TR3 and TR4), the swimming speed normalized by the mean speed of each fish during the entire treatment phase, v̅̅ n,t (Materials and Methods), was significantly greater (44% in TR3; 33% in TR4) when fish were located below compared to above the thermal interface (t-test, p < 0.001 and p < 0.05, respectively, Fig. 5A, Supplementary Tables 14–17). For TR2 (Tbottom = 8 °C), a similar increase (22%) was observed, but was not statistically significant due to outliers (likely cold-shocked fish) in one replicate (Fig. 5A). In contrast, in TR1 the swimming speed was similar during cold-water (Tbottom = 10 °C) and warm-water (Ttop = 12 °C) excursions (Fig. 5A).

Fish swim more rapidly in the cold. (A) Mean swimming speed when above (in warmer water) and below (in colder water) the thermal interface. Speed was standardized by the average swimming speed of each individual during the treatment phases (p1–p3). Data was aggregated at the replicate level; hence v̅̅ n,t represents the average response of the fish group (four fish) within one replicate. Symbols represent the results of pairwise t-tests (ns, p > 0.05; *, 0.01 < p ≤ 0.05; ***, 0.0001 < p ≤ 0.001, see also Supplementary Table 16). Whiskers extent to the full range of observations and red lined indicate the median. The equivalent data for warm treatments are shown in Supplementary Fig. 22 and absolute swimming speeds are shown in Supplementary Figs. 20 and 21. (B and C) Probability density functions of averaged, swimming speed during cold-water excursions (B) and warm-water excursions (C) in cold treatments (TR1-TR4). Speed was standardized by the average swimming speed of each individual within each phase and n,p represents the average of this quantity over the duration of each individual excursion. The total numbers of cold-water excursions are TR1, n = 889; TR2, n = 389; TR3, n = 611; and TR4, n = 452; with identical numbers of warm-water excursions for each treatment. A kernel density estimator was fitted to the normalized histogram after log10-transforming the data. Equivalent figures for warm treatments are shown in Supplementary Fig. 23. Excursion durations were scattered against average normed swimming speed (see Supplementary Fig. 24).

Swimming speed increased over time (from p1 to p3) across all treatments (Supplementary Fig. 20). To account for this temporal trend in the analysis cold-water excursions, we further normalized the swimming speed by the average speed of that fish during the corresponding phase, vn,p. To give each excursion the same weight, independently of its duration, we further averaged that quantity for each excursion, n,p. Notably, the distribution of average swimming speeds during cold-water excursions in cold treatments with Tbottom ≤ 8 °C (TR2-TR4) is clearly skewed toward values larger than n,p = 1. This indicates that the swimming speed was above average during the majority of cold-water excursions (Fig. 5B), indicating the presence of a thermokinetic response. In contrast, for TR1 (Tbottom = 10 °C) the speed during cold-water excursions peaks at n,p = 1 (Fig. 5B), similar to the warm-water excursions across all cold-water treatments (Fig. 5C), indicating the absence of a thermokinetic response in these cases. This observation was further supported by more frequently detected high absolute swimming speeds (> 20 cm/s) during cold-water occupation in TR2-TR4 (Supplementary Fig. 21). These findings demonstrate that fish exhibit an increase in swimming speed during excursions in cold water (Tbottom ≤ 8 °C), indicative of a rapid and transient thermokinetic response, on a timescale of seconds, to cold-water exposure.

Discussion

Using a novel experimental design, we showed that trout parr acclimated to 12 °C display within minutes a strong avoidance of incoming cold water (Tbottom = 8, 6, 4 °C) through a combination of thermotactic and thermokinetic behavior, whereas they do not avoid incoming warm water (Ttop = 14, 16, 18, 20 °C). Other fish species have been shown to avoid unfavorable thermal conditions, though often over timescales of hours to days3537. For example, vertical relocation over timescales of hours has been observed for marine sablefish, Anoplopoma fimbria, acclimated to 12 °C and exposed to 2–8 °C 38.

Our observations revealed that the avoidance of cold water was mediated by two distinct behavioral responses: fish biased their vertical turns, which enabled them to redirect their swimming out of the colder water, and increased their swimming speed, which allowed them to reduce the time spent in the colder water. Cold-water excursions were of shorter duration and shallower the lower the temperature of the cold water was. Larval zebrafish have been found to exhibit thermotactic behavior similar in some respects to that of trout in our experiments, biasing both turn magnitude and turn direction to swim toward warmer water (40). However, in contrast to our observation of increased swimming speeds in colder water, swimming activity of larval zebrafish decreased in cold water15. Furthermore, to guide their movement zebrafish have recently been found to integrate temperature information over a time window of 0.4 s preceding the next swimming bout13. The duration of cold-water excursions of trout in our experiments were of a similar order of magnitude (0.1 s < Ω < 10 s), suggesting that thermal sensing in trout may occur over similar timescales to zebrafish.

Surprisingly, no superficial cold receptor has yet been identified in trout skin39 or in fish more broadly5, and recent studies suggest that fish may instead respond to temporal changes of their internal body temperature. To investigate how body temperature might trigger behavioral responses, we used a heat transfer model for fish23 to estimate the decrease in internal body temperature Tbody over the duration of cold-water excursions. Assuming an initial body temperature of Tbody = 12 °C, a mass of mbody = 4 g and a heat transfer rate of k = 1.37 min-1 (Supplementary Table 4), and using the measured durations Ω of cold-water excursions in TR1–TR4 (Fig. D,E and Supplementary Fig. 29 AD), the model predicts that the median body temperature Tbody during cold-water excursions decreased by only 0.2 °C in TR1 up to 0.5 °C in TR4 (Supplementary Fig. 25). This suggests that the avoidance response could have been triggered by a small decrease in internal body temperature, in the order of 0.2–0.5 °C. Further, this analysis indicates that by reducing the duration of cold-water excursions, fish maintained body temperatures within the range 11.5–12 °C, ultimately preventing body cooling and the need to adapt physiologically to the colder temperature.

Our results suggest that the observed thermoregulation behavior in warm-water treatments is a strategy to gradually increase body temperature. When the temperature of the incoming water was higher than 12 °C (TR6–TR9), fish exhibited a bimodal distribution of depth occupancy that was distinctly different from the acclimation phase and the cold-water treatments. This bimodal distribution was not due to variability in the temperature preference among individual fish, but rather to individual fish periodically moving between warmer and colder regions (Supplementary Fig. 8B). Interestingly, fish gradually increased the occupancy of warmer water over time (Supplementary Fig. 26B). In contrast to the cold treatments, no avoidance response was observed at the thermal interface in warm treatments.

We propose that this periodic relocation between warmer and colder regions is a behavioral strategy to slowly elevate body temperature, while avoiding rapid and drastic body warming to 14–20°C (TR6–TR9). It has indeed been shown theoretically that frequent transitions between cold- and warm-water regions that are each, per se, thermally suboptimal, could allow fish to maintain body temperatures between the available extremes while avoiding excessive heating or cooling40. Our findings provide the first experimental evidence for this mode of behavioral thermoregulation in which fish navigate their heterothermal environment to achieve gradual body warming.

We conclude from the behavior of fish when warmer water was available that they in fact preferred temperatures above 12 °C, reflecting a departure from the acclimation temperature we had chosen based on the assumed thermal preferendum for trout34. Many internal and external factors, such as hypoxia, satiation, time of day, and life stage5, can influence the temperature preference of fish. For example, the level of satiation can have an impact because when fish are well fed, their growth rate increases with body temperature as metabolic performance increases41. This modifies the preferred temperature, as observed in Bear Lake sculpin (Cottus extensus) that ascend into warmer water after feeding to stimulate digestion and thereby achieve a three-fold higher growth rate42. In contrast, field studies with adult fish have observed movement from warm to cold water in summer43,44, allowing fish to lower their metabolic rate, likely in effort to conserve energy2,45. We propose that the behavior of trout parr upon exposure to warmer water in our experiments served to achieve a higher body temperature to ultimately increase growth rate, which is critical for this life stage46,47.

The behavioral thermoregulation exhibited by trout in our experiments also included a strong thermokinesis response. Fish rapidly increased swimming speed while in colder water, on a timescale of seconds during individual cold-water excursions (in cold treatments TR2 -TR4). This contrasts with the established paradigm for thermokinesis in fish. For a variety of species including trout48, swimming speed was found to decrease with decreasing water temperature. This is thought to be a physiological effect, as a lower temperature results in a lower metabolic rate and locomotory capacity due to decreased contractile rates in the red and white swimming muscles and the heart49. This type of thermokinetic response cannot serve to avoid cold water.

Our results instead suggest that trout parr employ a very different form of thermokinesis. Our analysis showed that increasing swimming speed during cold-water excursions allowed fish to shorten the exposure to cold water. This conclusion is supported by our model predictions that body temperature during cold-water excursions remained above 11.5 °C. Anecdotal observations from our experiments suggest that prolonged exposure to cold water (in the order of minutes) can nonetheless reduce swimming speed. Two individual fish in TR2 (Tbottom = 8 °C) appear to have become trapped within the cold water (Supplementary Fig. 26A) and displayed reduced swimming speeds, in line with previously described deactivation upon cold-water exposure50,51.

Taken together, these observations suggest that the thermokinetic response to cold water is timescale dependent. If the exposure to cold water is short (seconds), fish accelerate to escape the cold. If exposure is longer (minutes), however, fish slow down, likely due to a reduction in metabolic rate. Importantly, this timescale dependence implies that long-term (hours) measurements of behavior at constant water temperatures cannot be used to model fish movement response to thermal gradients occurring over shorter timescales. Our findings may help explain why recent modeling of fish behaviour in heterothermal environments could not reproduce the observed avoidance of cold water in stationary thermal gradients15.

Despite the avoidance response of cold water, fish engaged in repeated cold-water excursions, potentially reflecting a behavioral strategy to map the thermal environment. However, over time the frequency of longer cold-excursions (>10 s) diminished, reflecting a modulation of this exploratory behavior. While most studies have associated thermoregulation with sustained relocation from colder to warmer water or vice versa52, it has been suggested that short excursions into water of a different temperature might be a thermoregulatory behavior that allows fish to exploit resources in suboptimal thermal regions within a heterothermal environment40. For example, by keeping excursions into cold water short, hammerhead sharks can access deep-sea foraging habitats without critically cooling their body temperature53.

Our findings show that fish were able to perform upward turns while still located above the thermal interface, that is, before actually sampling the cold water below the interface. This response may be evidence of associative learning, whereby fish used information on the presence of colder water at depth obtained at prior times. Indeed, fish are able to perform associative learning based on non-visual cues54, create mental maps of their surroundings55 and retain memory for hours56, days57 and months58,59. Therefore, we speculate that associative learning may be an important component of fish thermoregulation.

Determining the mechanisms underlying fish behavior in heterothermal environments is challenging, because thermokinesis and thermotaxis may co-exist and play out across different spatio-temporal scales. In rivers and lakes, heterothermic environments form naturally and persist over a variety of spatial and temporal scales60. Anthropogenic warm- and cold-water releases expose fish to rapid (minutes) thermal changes, known as thermopeaking22, which can affect river sections hundreds of kilometers downstream61. Here, we mimicked such rapid thermal changes for environmentally relevant thermal contrasts of 2–8 °C using a lock-release setup. We have demonstrated that trout use a combination of thermotaxis (modulation of turning behavior) and thermokinesis (modulation of swimming speed) to avoid cold water, while occasionally still exploring it through brief cold-water excursions. In contrast, we found that for incoming warm water, fish explore both warm- and cold-water regions and do not display any thermotactic avoidance.

While limited to laboratory conditions, these observations provide a framework for interpreting the thermal behavior of fish in nature. For example, a recent study observed a significant increase in downstream displacement for early life stages of a cypriniform fish in response to cold-water thermopeaking62. The authors hypothesized that this response was caused by reduced swimming capacity and cold shock. Our findings suggest that the observed downstream displacement could alternatively have been caused by an avoidance response at the interface with cold water.

By capturing the multifaceted response of fish to thermal change, our results may help to predict the larger-scale distribution of species and their response to unnatural disturbances, and thus inform environmental conservation policies. Our study also highlights the importance of deepening our understanding of the fundamental behavioral mechanisms of fish to alterations in their environment, particularly anthropogenic ones. Ultimately, the large-scale distribution of an organism results from the combined effects of responses to countless stimuli on the individual scale. Our experimental setup provides a platform to investigate these stimuli through a reductionist approach, and a blueprint for how to investigate responses to other stimuli such as chemicals or salinity for diverse aquatic organisms.

Methods

Experimental animals

A total of 180 hatchery-sourced trout (standard length 3.6 ± 0.5 cm) were used for experimentation and each individual was used in a single experiment only. Fish were acclimatized to the housing facility (Twater = 12 °C) for a minimum of 24 h prior to experimentation and kept for a maximum of 5 days.

Fish originated from wild mature trout, artificially spawned in a cantonal hatchery (Flüelen, canton Uri, Switzerland) in December 2020. Fertilized eggs were transported (35 min by car) in 200 mL plastic containers to the Swiss Federal Institute of Aquatic Science and Technology (Eawag, Kastanienbaum), where they were transferred to temperature-controlled incubators. The water temperature during transport and incubation was maintained at 3 ± 0.5 °C. The eggs were incubated for three months until hatching. After hatching, the water temperature in the incubators was incrementally increased to 5 ± 0.5 °C to promote growth of the alevins. After yolk-sac absorption, trout were fed with half a teaspoon of Artemia and chironomid larvae per 50 fish once per day for one month and then placed in a covered outdoor housing tank, with water temperature ranging from 8 °C to 11 °C. All incubators and housing tanks were fed by lake water (Lake Lucerne) in a flow-through system.

When fish had developed to the parr stage63, they were transported (65 min by car) in an aerated, temperature-controlled (11–12° C) tank (60 L) to ETH Zurich (ETHZ), where they were acclimatized to the housing temperature of 12 ± 0.3 °C. Flow-through tap water continuously replenished the housing tank, water quality parameters (pH = 8–9, NH4 < 0.04 ppm, NO3 < 1 ppm, NO2 < 0.04 ppm) were monitored twice per day, and the fish were fed in the evenings with frozen bloodworms (1.5% of body weight). Experimental procedures and husbandry facility were approved by the Zurich veterinary office (licence no. 30997; housing facility no. 182). All fish were euthanized post-experimentation.

Experimental setup

Experiments were conducted during daytime (09:00–17:00) in July 2021 at ETH Zurich. We performed experiments using an acrylic tank (dimensions 200 cm × 20 cm × 30 cm, length × width × height; Fig. 1A), with a removable opaque vertical gate (polymethyl methacrylate, PMMA, white 60% transparency) separating the tank into two compartments of equal dimensions (Fig. 1A and Supplementary Fig. 1). Three temperature probes (resistance thermoelement, type K-3895, ®Adafruit) were installed at three depths (4.5 cm, 14 cm, and 23.5 cm) in each compartment of the tank. A dissolved oxygen (DO) probe (WTW CellOx 325, galvanic, membrane based) was placed on each side wall of the tank (one at a depth of 4.5 cm and one at 23.5 cm, Fig. 1A). Probes were synchronized and provided continuous measurements at a sampling rate of 0.2 Hz (Supplementary Figs 27 and 28)). At the beginning of an experiment, each compartment of the tank was filled with water to a depth of 28 cm (56 L per side). The initial water temperature on the left side was always 12 °C; water temperature on the right side varied according to treatment. Water on the right side was dyed blue by the addition of 16.66 mg pre-dissolved Patent Blue V sodium salt (C27H31N2NaO7S2, Sigma-Aldrich; final concentration in half tank 0.29 mg/L) to provide a visual contrast and allow visualization of the thermal interface during the experiment (Supplementary Fig. 2). Prior to the experiment, the temperature on each side was adjusted by adding ice or stirring with a heater until it reached the desired temperature homogeneously across depth. Throughout the experiments, the DO concentration remained within the range 7–10 mg/L. The tank was sheathed with white diffusive material (PMMA, white 60% transparency) and homogeneously illuminated with white LED light (4000 Kelvin) from all sides except the top and front of the tank. This homogeneous illumination and tank sheathing was necessary to provide sufficient contrast for image-based tracking of fish.

Experimental procedure

Each experiment consisted of four fish exposed to a temperature treatment. In total, we conducted five experimental replicates per treatment. Treatments were defined based on the initial water temperature in the right compartment of the tank (values of 4–20 °C, in 2 °C increments; Supplementary Table 1). Therefore, for all treatments, fish were initially located and acclimatized to 12 °C (the thermal preferendum of adult trout reported in the literature34), and exposed to a thermal interface towards warmer water on the top or colder water on the bottom. All water temperatures were within the thermal tolerance range of the species (0–25 °C 64) and specifically within the thermal range in which trout show positive somatic growth rates (3.6–19.5 °C in 46; approximately 5–23 °C in 47). After 15 min acclimation to 12 °C (Fig. 1A), the central gate was removed, triggering gravity currents65 caused by the density difference resulting from the water temperature difference between the left and right compartments of the tank (Supplementary Fig. 2). During the treatment phase, a sharp thermal gradient (i.e., a thermal interface) spanned the entire width of the tank and gradually stabilized at the half-tank depth such that its temporal vertical movement reduced to ∼5 cm (Supplementary Fig. 3). The interface could be visualized throughout experiments due to the blue dye in the water that was initially well mixed into the right compartment of the tank (see Fig. 1 A and B, Movies 1–4, and Supplementary Fig. 4).

Each experiment consisted of a 15-min acclimation period followed by a 20-min treatment period (Fig. 1D). A group of four fish was released into the left compartment of the tank containing water at 12 °C (identical to the husbandry temperature). After 3 min, cameras were started, initiating the acclimation phase. After 15 min, the lock was gently removed by hand (∼3 s) exposing fish to the gravity current. For the next 20 min, fish were exposed to the heterothermal environment throughout the tank. After each experiment, fish were captured and transferred to a separate compartment of the husbandry facility. To capture temporal trends in the behavioral response, we compared four 6-min periods (acclimation, p1, p2, and p3, Fig. 1D). During the treatment period, fish could choose to occupy lower colder water or upper warmer water. The final 6 min of the acclimation phase provided a reference for the absence of thermal contrasts. Phase 1 (p1) started 2 min after the lock was removed and the thermal interface had already occupied the entire width of the tank (Fig. 1D). Phase 2 and phase 3 (p2, p3) were the consecutive 6-min periods, during which the vertical movement of the thermal interface line diminished (Supplementary Fig. 2).

Gravity currents

A gravity current is the flow of one fluid within another caused by the density difference between the fluids66. In our setup, this density difference was caused by the different water temperatures which defined our treatments (Supplementary Table 1). The treatment phase of the experiment was initiated with the slow removal (∼3 s) of the vertical lock separating the two compartments of the tank, followed by initial gravity currents67 and the formation of a horizontal thermal interface (Supplementary Fig. 2). The symmetric warm and cold water currents traveled at similar speeds but in opposite directions67 (Movies 1 and 3). Water from the colder compartment traveled along the tank bottom and remained sharply separated from the warm water above it. For similar thermal contrasts, it has been shown that despite some mixing, the interface between the two counter-flowing layers is stable if the density ratio ρleft/ρright is close to unity67, which was the case for all our treatments (Supplementary Table 1). Once the interface was established, the temperature contrast would smear out due to thermal diffusion. We simulated numerically (in Python) the thermal diffusion for the strongest thermal contrast (dT = 8 °C) and found that over the duration of an experiment (20 min), an initially sharp thermal interface (gradient thickness = 0) evolves into a gradient of thickness of ∼3 cm (Supplementary Fig. 29). The density ratio between colder and warmer fluid was close to unity, resulting in slowly creeping currents with maximum velocities of ∼0.8–1.6 cm/s during the initial 2 min after gate removal. To eliminate the effects of flow on fish behavior, this period was excluded from the data analysis. After 1–2 min, the currents impounded at the side walls and the thermal interface extended over the entire width of the tank. Vertical movement of the interface (∼0.1 cm/s) was much slower than fish swimming speeds (4–6 cm/s) (Supplementary Fig. 20, Movies 1–4) and over time, the thermal interface stabilized at the half depth of the tank (Supplementary Fig. 3).

Imaging and tracking of fish

To allow simultaneous tracking of fish behavior and the position of the thermal interface, experiments were continually filmed using a video camera (GoPro Hero6) mounted at a distance of 1.8 m from the front of the tank, recording color images at a resolution of 9.2 pixel/cm. The camera setting ‘linear field of view’ was selected to eliminate fish-eye effect typically captured by the cameras wide-angle lens, without compromising image quality.

We analyzed 26.3 h of video recordings (45 experimental replicates) and obtained individual movement trajectories at a temporal resolution of 24 fps (Supplementary Figs. 30 and 31) and an average tracking efficiency of 99% across all analyzed videos (Supplementary Fig. 14; Movies 1 and 3). Each video was cropped using custom-made Python scripts, and the start of the treatment phase was set at the time when the vertical gate detached from the water surface. As the blue dye was not visible in the red channel of the RGB image (Supplementary Fig. 33C), fish tracking was performed on the red channel using the open source software TRex68. Light conditions and dye concentration were identical for all experiments, allowing the use of an optimized set of tracking parameters (Supplementary Table 2). Due to the low density of fish in the tank, occlusions (in which two fish temporarily merge into one object) rarely occurred; however, the automated tracking procedure was reviewed for all videos. In difficult cases (e.g., when one individual was occluded by another moving in the same direction), individual identities were manually assigned based on simultaneous recording from a camera positioned above the tank.

Visualization and evolution of the thermal interface

The dye used to visualize the thermal interface, Patent Blue V, is a non-toxic dye69 that has previously been injected without side effects into the dorsal fin of experimental fish at concentrations of up to 300 mg/mL70. However, to confirm the absence of potential side effects of the dye on fish behavior, five control experiments to TR3 (Tbottom = 6 °C) were performed without the addition of the dye. In the comparison of results from these control experiments with TR3, no statistically significant difference in vertical occupancy was detected (Supplementary Fig. 34 and Fig. 35). We therefore conclude that the presence of the dye did not affect fish swimming behavior.

Locating the thermal interface was central to relating fish movements to their immediate temperature environment. For each time instance (frame), a line, representing the thermal interface, was derived from the visual signal of the dye. To do this, an in-house image analysis pipeline was developed in Python Opencv71. The pipeline consisted of background subtraction, thresholding, dilation, erosion and finally the abstraction of the interface line yI(x,t) (python functions: cv2.thresh, cv2. dilate, cv2. erode, cv2.Laplacian) (Supplementary Figs. 33 and 36). Our analysis assumes that over the duration of p1 + p2 + p3 = 18 min, the abstracted color boundary is representative of the location of the thermal contrast. We thus assume that the molecular diffusion driving heat exchange and molecular diffusion of the dye acted on similar time-scales.

Identification of time spent in colder and warmer regions

The interface line was used to differentiate whether fish were located in the warmer water above or the colder water below. To do this, we derived the vertical distance from the thermal interface D(t)

where y(t) is the vertical position of an individual fish and yI(x(t), t) is the vertical position of the interface line at the lateral position of the fish x(t) (Supplementary Fig. 37). Evaluating the sign of D(t) reveals whether a fish was located above or below the thermal interface (Fig. 2 A and B).

Cold- and warm-water excursions

Evaluating the sign of D(t) allowed the individual fish trajectories to be partitioned into periods of cold- and warm-water occupation (i.e., excursions; Fig. 2B). We counted the number of cold- and warm-water excursions (Nwarm and Ncold), which represents the number of times each fish crossed the thermal interface in one direction (Ncrossings), and for each excursion we quantified the duration Ω, and the maximum distance to the interface line (Dmax). Excursions can be interpreted as periods of self-inflicted exposure to the cold or warm water.

We derived the duration Ω of individual cold and warm water excursions as

and the maximum excursion depth during cold excursions as

Time spent in cold and warm regions

We calculated the total time spent above and below the interface as

For cold treatments, the time twarm represents the time an individual spent above the thermal interface (at 12 °C, which is equal to the acclimation and housing temperature), and tcold the time spent in the respective treatment temperature (4 °C, 6 °C, 8 °C, or 10 °C). In the warm treatments, the time tcold represents the time the individual spent at 12 °C, and twarm the time spent in the respective treatment temperature (14 °C, 16 °C, 18 °C, or 20 °C).

Vertical turning points

Vertical turning points were obtained by fitting a fifth-order polynomial to the vertical position signal Y(t) of each trajectory within a moving window of 2.1 s (50 frames) (using the Python script scipy.signal.savgol_filter,72). This procedure smoothed the vertical position, reducing the noise produced by small-scale variation. We then detected upward turns as local minima and downward turns as local maxima in this smoothed signal (Supplementary Fig. 11). To focus on turning points that resulted in considerable vertical displacements, we eliminated upward- or downward-turn events if a subsequent turn occurred within a vertical distance of dy ≤ 3 cm (Supplementary Fig. 14A).

Swimming speed

The normalized swimming speed for each individual was derived by dividing the instantaneous swimming speed by the average swimming speed of the individual during (i) the entire treatment period of 18 min (vn,t) or (ii) each phase separately (vn,p), as described within individual figure captions.

Upon visual inspection, the individual swimming trajectories seemed reasonably smooth (Supplementary Fig. 38A) however, unrealistic fluctuations appear in their first order derivatives (i.e., fish swimming speed) (Supplementary Fig. 38C and D). Before calculating swimming speeds, we therefore fitted a third-order polynomial to the trajectories obtained from ‘TRex’68, using a fitted to the x,y coordinates. For each time step, the polynomial was fitted to a temporal window of 21 measurements (1.4 s) following a procedure described by73 (Supplementary Text 3, Fig. 38 B-E and Movie 5). Further, data gaps (arising mainly from fish occlusions) were filled using temporal linear interpolation, and an upper velocity threshold of 100 cm/s (i.e., an unrealistically high speed of approx. 3× burst swimming) was used to discard unrealistically high values.

Statistical analysis

To compare behavioral responses between treatments, all analyses considered the mean or median values for each group of four individuals within each replicate, accounting for dependency between individuals. Therefore, to compare the number (Fig. 3C) of cold-water excursions across cold-water treatments, one-way ANOVA was used (Supplementary Tables 18 and 19). Post-hoc pairwise t-tests were used to assess differences between treatments (Supplementary Tables 16, 17 and 20).

To determine whether the duration (Fig. 4B) and depth (Fig. 4C) of cold-water excursions followed a trend across treatments (i.e., decreased or increased with decreasing treatment temperature), we used the multivariate Mann-Kendall test74 (Supplementary Tables 5 and 6). We used pairwise t-tests to test whether the normalized swimming speeds differed during warm and cold-water occupation (Fig. 5A). Prior to performing statistical analyses, data distribution (normality) was assessed using the Shapiro-Wilk test (Supplementary Tables 14, 15 and 18). All statistical tests were conducted using Python packages.

Author Contributions

R.N., S.B., L.S., and R.S. designed research; R.N. and S.B. designed and built the setup and performed experiments; R.N. analyzed the data, wrote the paper, and obtained the license for animal experimentation and housing facility; J.S., M.H., L.S., R. B. and R.S. reviewed and edited the manuscript; R.B. and R.S. acquired funding.

Competing Interest Statement

The authors declare no competing interest.

Data availability

The Python scripts used for the analyses are available through a public GitHub repository (https://github.com/naroberto/Thermal_paper/). The generated videos for fish-tracking can be accessed in an open access archive (https://doi.org/10.3929/ethz-b-000660506).

Acknowledgements

We thank Jukka Jokela, Armin Peter, Annamari Alitalo and Samia Bachmann for their support with the animal experiments and in obtention of the license for animal experimentation. We thank Werner Tresch and Kunio Takatsu for supplying and taking care of the experimental animals in Flüelen and at Eawag Kastanienbaum. We thank Thomas Meierhans, Michael Arnold, Ernst Bleiker, Ela Burmeister and Daniel Braun for providing workshop tools and laboratory resources that enabled construction of the experimental setup. We further thank Davide Vanzo, Oliver Selz, Jakob Brodersen, Steffen Schweizer, Francesco Carrara and Johannes Keegstra for helpful discussions.