Introduction

In a visual scene there are different forms of motion information that can be used to detect an object moving relative to a background. Two distinct types of motion information used by animals are first-order and second-order motion. First-order motion occurs when there is a mean visual contrast between a moving stimulus and the background against which it is viewed. Second-order motion occurs when there is no mean visual contrast between the stimulus and the background, but differences exist in texture, flicker, or some other second-order property1,2,3,4,5,6.

Different types of visual information (luminance, chromatic or polarization information) can generate both first-order or second-order motion. Specifically for intensity (luminance), first-order motion, which is also referred to as Fourier motion, is defined by spatiotemporal correlations in intensity (luminance) contrast and is detectable by Reichardt-type6 motion detectors1,4,5,7,8. Similarly for color, first-order motion is defined by spatiotemporal correlations in chromatic contrast9. Second-order (non-Fourier) motion is separate as it is defined by spatiotemporal correlations in higher-order image properties that are not detectable by Reichardt-type detectors because there is no net directional signal of Fourier motion energy1,2,3,4,5,6.

Analogous to first-order motion in intensity1,4,5,7,8 or chromatic information9, a first-order polarization stimulus is defined by spatiotemporal correlations in the degree (DoP) and/or angle (AoP) of polarization and is detectable by Reichardt-type motion detectors that are polarization sensitive. A second-order polarization stimulus is one defined by spatiotemporal correlations in second-order properties in the DoP and/or AoP.

Until the early 2000s it was believed that the detection of second-order motion was restricted to mammals, with a requirement of higher-level visual processes that occurred in the visual cortex10,11,12,13. However, Orger et al.3 demonstrated that second-order motion could also elicit optomotor behavior in zebrafish larvae, which do not have a cortex, thus demonstrating that this constraint is not necessary. Further studies have since shown that flies1,14,15,16, and more recently the praying mantis17,18, also see second-order motion, proving that its detection is not confined to vertebrates. So far, all the studies that have shown animals are able to detect second-order motion have used intensity as the form of visual information and nothing is currently known about whether any animals can use the polarization of light to detect second-order motion. In natural scenes, second-order modulations can provide the visual system with an enhanced representation of the environment19,20, improving the recognition of structure and textural changes21. Such second-order features in natural visual environments may also occur in polarization, for instance when a stimulus is defined only by texture in polarization. For an animal with polarization vision this could be an important source of motion information.

One group of crustaceans with the potential to benefit from seeing second-order motion in both intensity and polarization are fiddler crabs (Fig. 1a, b). Field experiments have shown that fiddler crabs rely on both intensity and polarization to detect moving objects within their natural environment22. Fiddler crabs live in mudflat environments that are rich in polarization information. An example of this can be seen in Supplementary movies 1 and 2 which show a visualization of the polarization information (calculated as crab photoreceptor contrast23) that is detectable by a crab viewing a typical mudflat environment (see supplementary Fig. S1 for color scale). Supplementary movie 1 shows the scene at the original recording resolution while Supplementary movie 2 shows the same video converted to estimated fiddler crab resolution. Supplementary movie 3 shows the same scene as viewed by the human visual system. Details of these videos and a description of how they were recorded and processed can be found within supplementary methods section of the supplementary material.

Fig. 1: Study species and experimental set up.
figure 1

Photographs of a (a) male and (b) female fiddler crab, Afruca tangeri and (c) graphic showing the experimental set up. Crabs were tethered above a treadmill and subjected to first- and second-order stimuli in either intensity or polarization. Photos taken by Samuel Smithers.

Studies have shown that the flapping wings of avian predators such as terns, a key predator of fiddler crabs24, can produce temporal changes in local contrast (referred to as flicker within the cited literature)25,26. Local changes in contrast (including flicker), such as that from flapping wings, have the potential to generate second-order motion by moderating the texture of a stimulus while not affecting its mean intensity and/or polarization16,27. Since local changes in contrast, and thus the potential for second-order motion, can occur in both intensity and polarization, it raises questions as to whether fiddler crabs can make use of this information in both intensity and polarization. This is particularly interesting given that we already know that for first-order looming motion, fiddler crabs process intensity and polarization information in separate, independent pathways28.

In our experiments, we utilized a spherical crab treadmill28,29,30,31 (Fig. 1c) to measure the response of the fiddler crab Afruca tangeri to a series of first- and second-order stimuli (Fig. 2) presented in either intensity only or polarization only. Each stimulus was viewed against a static pseudorandom noise background designed to eliminate first-order artifacts in the second-order stimuli32 (see Fig. 2).

Fig. 2: Display background and stimuli.
figure 2

Example from the intensity experiment of the (a) static pseudorandom noise background against which the expanding, (b) negative control (stimulus is the same as the background so it is not detectable) (supplementary movie 4), expanding black first-order stimulus (supplementary movie 5), expanding mean gray stimulus (supplementary movie 6), expanding second-order dynamic texture stimulus (supplementary movie 7) and non-expanding dynamic texture control (also second-order) (supplementary movie 8) were displayed. The mean gray stimulus in the intensity experiment provided a way of measuring whether the crabs were able to resolve the background. In the polarization experiment, intensity contrast was substituted for contrast in the degree of polarization (DoP); instead of being either black (R = G = B = 0) or white (R = G = B = 255), the squares were either polarized (DoP = 0.99) or unpolarized (DoP = 0.1). In polarization, a solid unpolarized expanding square was used for the first-order stimulus. The mean gray was calibrated to match the mean intensity or mean DoP of the background in their respective experiments. In both experiments, the dynamic texture control, which contained dynamic changes in texture, but no expanding motion, was included to confirm that the crabs were responding to the second-order motion in the expanding dynamic texture stimulus and not just static changes in intensity or polarization. The start position of an expanding stimulus is indicated by the smaller red box in (a). The light blue boxes indicate the position and size of the stimulus at each subsequent stage during expansion until it reached full size (indicated by the larger red box in (a)). At stimulus onset the expansion starts by covering four background squares (layer 1- indicated by the small red box in (a, b)) and a new layer of squares was added to the outer edge of the stimulus each time it expanded. The negative control was invisible because its pattern was the same as the background.

Results

The crabs’ response probability was highly dependent on the stimulus type in both the intensity and polarization experiments (mixed effects binary logistic regression models compared via likelihood ratio test for effect of stimulus type in the intensity experiment: χ2(4) = 62.94, p < 0.001, Fig. 3a; effect of stimulus type in polarization experiment: χ2(4) = 45.73, p < 0.001, Fig. 3b). The crabs responded significantly more to both the expanding first-order intensity stimulus (McNemar test33 with Bonferroni correction: McNemar’s χ2(1) = 19.53, OR = 9.68, n = 59, adjusted-p < 0.001) and the first-order polarization stimulus (McNemar’s χ2(1) = 25.04, OR = Inf, n = 56, adjusted-p < 0.001) compared to their respective negative control (i.e., the probability of a ‘response’ being due to chance). The crabs also responded significantly more to the expanding second-order dynamic texture stimulus in both intensity (McNemar’s χ2(1) = 31.61, OR = 19.5, n = 59, adjusted-p < 0.001) and polarization (McNemar’s χ2(1) = 16, OR = 11.5, n = 56, adjusted-p < 0.001) compared to their respective negative control. Furthermore, response to the second-order dynamic texture stimulus was significantly higher than to the non-expanding dynamic texture control in both the intensity (McNemar’s χ2(1) = 15.75, OR = 8.33, n = 59, adjusted-p < 0.001) and polarization (McNemar’s χ2(1) = 12, OR = 5.75, n = 57, adjusted-p = 0.005) experiments. This demonstrates that the crabs can see and respond to both intensity and polarization defined second-order motion stimuli.

Fig. 3: Results from behavioral experiments.
figure 3

The response probability of fiddler crabs to the expanding negative control, first-order, mean gray/mean degree of polarization and second-order dynamic texture stimuli, and the non-expanding dynamic texture control stimulus in the (a) intensity and (b) polarization experiments. In the polarization experiment intensity contrast was substituted for contrast in the degree of polarization; instead of being either black or white, the squares were either unpolarized or fully polarized respectively. The negative control shows the probability of a ‘response’ occurring in the scoring window in the absence of a detectable stimulus (i.e., the probability of a ‘response’ being due to chance). Error bars represent Wilson score intervals62 calculated using the sample size for each point (N) and the number of responses. Not every crab contributed data to every stimulus hence the range in N value between conditions. For the intensity experiment N = 60 for the negative control, and N = 59 for the first-order, mean gray, second-order dynamic texture, and non-expanding dynamic texture control stimuli. The number of responses to each condition were 10, 36, 33, 46 and 24 respectively. For the polarization experiment the N values for the negative control, first-order, mean degree of polarization, second-order dynamic texture, and non-expanding dynamic texture control stimuli were 57, 56, 56, 58 and 57 respectively, and the number of responses were 9, 35, 19, 30 and 10 respectively. Pairwise comparisons were performed using McNemar tests33 with a Bonferroni correction. *** = adjusted-p < 0.001, ** = 0.01 > adjusted-p > 0.001, * = 0.05 > adjusted-p > 0.01, and non-paired associations mean adjusted-p > 0.05.

However, the results illustrate that the intensity and polarization stimuli did not always produce identical responses. For the mean gray stimulus, response was significantly higher than response to the negative control in the intensity experiment (McNemar’s χ2(1) = 15.61, OR = 6.75, n = 59, adjusted-p < 0.001). However, there was no difference in the level of response between the mean DoP stimulus (the polarization equivalent of the mean gray stimulus) and the negative control in the polarization experiment (McNemar’s χ2(1) = 4.35, OR = 2.83, n = 56, adjusted-p = 0.37). There was also a significant difference between response to the negative intensity control and the intensity dynamic texture control (McNemar’s χ2(1) = 9.33, OR = 6, n = 59, adjusted-p = 0.023), which demonstrates that static changes in intensity without motion are enough to elicit a behavioral response. However, in the polarization experiment there was no significant difference between the negative polarization control and the polarization dynamic texture control (McNemar’s χ2(1) = 0.08, OR = 1.4, n = 56, adjusted-p = 1). In the polarization experiment there was also a significantly higher response to the first-order polarization stimulus than to the dynamic texture control (McNemar’s χ2(1) = 17.46, OR = 7.25, n = 56, adjusted-p < 0.001) and a marginally higher response to the first-order polarization stimulus than to the polarization mean DoP (McNemar’s χ2(1) = 8, OR = 3, n = 56, adjusted-p = 0.047).

There was no effect of crab sex or size, nor was there evidence of habituation in either the intensity (mixed effects binary logistic regression models compared via likelihood ratio test for effect of sex: χ2(1) = 2.95, p = 0.086; size: χ2(1) = 3.26, p = 0.071; order: χ2(1) = 0.04, p = 0.834) or polarization (sex: χ2(1) = 2.54, p = 0.111; size: χ2(1) = 0.53, p = 0.467; order: χ2(1) = 0.73, p = 0.393) experiment.

Discussion

This study provides evidence that a crustacean can detect second-order motion created by changing intensity or polarization texture information. To the best of our knowledge, this is the first evidence for the detection of second-order motion in polarization in any animal species. These findings support previous studies showing that the perception of second-order motion is not limited to vertebrates1,14,15,16,17,18.

Like other arthropods34, fiddler crabs are known to respond to changes in light intensity detected by one or two ommatidia25,35, thus dynamic changes in stimulus intensity and/or polarization that can be detectable by a single ommatidium can be one of the earliest indications of an approaching predator25,26. We should, therefore, consider whether the crabs in our experiments responded only to the temporal, but spatially static, changes in intensity or polarization rather than the second-order motion itself. In the intensity experiment, crabs did respond more to the non-expanding dynamic texture control than the negative control. However, the crabs responded significantly more to the expanding second-order dynamic texture intensity stimulus than to the non-expanding dynamic texture control, which demonstrates that the crabs responded to the intensity-based second-order motion and not just the temporally varying intensity information.

The situation is different for polarization-based information. In the polarization experiment, in the absence of expanding second-order motion, dynamic texture changes within a static polarization stimulus were not sufficient to elicit a response significantly higher than response to the negative control. However, the crabs responded to the expanding second-order dynamic texture stimulus significantly more than the non-expanding dynamic texture control and negative control, indicating that fiddler crabs detect and respond to second-order motion in polarization. In the crabs’ mudflat environment dynamic polarization without a coherent motion component readily occurs when light reflects from wind-induced ripples in pools of water and from moving leaves in nearby vegetation. Therefore, static polarization changes may be associated with harmless environmental noise and thus ignored. The finding that the crabs responded to the non-expanding dynamic texture control in intensity but not polarization is consistent with the discovery that intensity and polarization information are processed in separate visual channels28.

Common to both intensity and polarization as forms of visual information, first- and second-order motion cues are unlikely to occur in isolation of each other in natural visual environments. Furthermore, it has been suggested that natural scenes contain different features that preferentially stimulate either first- or second-order mechanisms19. Together, sensitivity to both first- and second-order motion increases the total amount of relevant visual information available to an animal. Our dynamic texture second-order motion stimulus was inspired by, but did not intend to mimic, the flapping wings of terns, a key predator of fiddler crabs24, which can produce a strong dynamic visual signal in the form of temporal changes in local contrast (referred to as flicker within the cited literature)25,26. Such dynamic intensity and/or polarization signals, including flicker, from the flapping wings of terns have the potential to generate second-order motion16,27. However this may not be the case for other bird species that do not flap their wings in the same way and which do not as routinely hunt fiddler crabs25,26. Therefore, although speculative, a potential benefit of seeing second-order motion could be aiding efficiency of predator threat identification. The properties of, or even the presence or absence of, second-order information from a flying bird could, in theory, be a robust indicator of the level of predation risk posed by different birds; this might be particularly true for polarization information, which can generate a more consistent and reliable signal from an unpolarized bird against a more polarized sky28. Another benefit of second-order motion information that has been suggested for other invertebrates is that it may help to break camouflage18. This is because second-order motion information can still be present even if a moving target matches the mean intensity and/or color of the background.

In humans, and other mammals, there is evidence for the existence of independent first-order and second-order motion processing pathways, the outputs of which combine later in visual processing to form a single value that represents motion direction2,7,10,12,13,36,37. There is also evidence to suggest that processing first- and second-order motion in parallel visual channels is not limited to vertebrates alone and may be present in other taxa such as flies1,14,15. Current evidence suggests that second-order motion detection relies on the flow of information localized through specific layers of the lamina and medulla38. The horizontal structures in the lobula plate provide a substrate for encoding that information with a direction sensitivity for the motion38. Moreover, multiple layered network models are required to provide unambiguous processing of the higher-order motion39. However, very little is currently known about the way polarization information is passed through different neuropil layers beyond a limited, and sometimes contradictory, understanding of polarization sensitivity pathways involving the M3 and M4 monopolar cells within the external plexiform layers (epl1 and epl2) of the lamina40,41,42,43,44 (and reviewed briefly in ref. 28). While it remains uncertain exactly why separate processing of first-and second-order motion stimuli evolved, it has been suggested that, under conditions of low visual contrast, first- and second-order cues can be combined in a way that enhances perceptual accuracy45. Detecting both first- and second-order cues may therefore be particularly beneficial for crepuscular and nocturnal species that are active when visual contrast within a scene is lower than during the day. Given that intensity and polarization information are processed separately in independent channels28, the discovery that crabs can detect second-order motion in polarization poses additional questions regarding how this form of motion is processed. For example, it is not clear whether the neural machinery used for second-order intensity motion perception is the same or distinct from that for polarization.

A major advantage of our approach of using an auto scoring method is that it removes any risk of the results being influenced by human bias (both conscious and unconscious), something that is of growing importance within the field of life sciences46. Furthermore, ensuring that each crab was walking at stimulus onset also means that the criterion for a response, and importantly the ability to detect a response, was kept constant across all scored presentations both within and between individuals. Despite these advantages however, one limitation of our automated approach is that we cannot rule out the possibility of some false negatives in cases when a crab responded to a stimulus by immediately sprinting instead of freezing. As outlined in the methods section and previous studies28, the usual first response of the crabs was to freeze (often followed by retracting their limbs close to the body and in some cases a sprint) upon detection of a visual stimulus. However, a more extreme, but less common and less reliable, immediate sprint response may occur when a stimulus is very high contrast compared to the other presented stimuli. Therefore, this may explain why the level of response to the first-order stimulus in Fig. 3 was lower than might be expected, particularly in the intensity experiment. Nevertheless, despite this potential limitation, our results still show convincing evidence that fiddler crabs can detect, and respond to, expanding second-order motion.

This study provides evidence of the detection of second-order intensity motion in a crustacean and is, to the best of our knowledge, the first to show detection of second-order motion in polarization in any animal. Further research is needed to investigate the neuronal processing of second-order motion in both intensity and polarization, as well as the benefits of second-order motion information for fiddler crabs living in a mudflat environment.

Methods

Crab collection and preparation

A total of 120 (60 per experiment) fiddler crabs (Afruca tangeri) (72 female and 48 male, mean carapace width 24.99 mm, range 18 mm to 32 mm) were collected by hand from mudflat sites in El Rompido (37.2207° N, 7.1238° W) on the south coast of Spain. Crabs were housed separately in plastic cups, with approximately 20 mm of fresh seawater and strips of kitchen paper to provide a substrate beneath which the crabs could choose to hide. Water and paper were changed daily. Crabs were kept for a maximum of five days at room temperature under a natural day-night cycle and were fed with fish flake food once a day. All crabs were released after testing near the site they were collected. Animal collection was carried out with the authorization of the Consejería de Medio Ambiente y Ordenación del Territorio de la Junta de Andalucía.

Experimental setup

Each crab was loosely tethered atop of a 150 mm diameter spherical Styrofoam treadmill suspended on a cushion of air supplied by a non-heating hair dryer (BaByliss 3Q dryer) using a custom-made wire hanger fixed to the crab’s carapace with cyanoacrylate glue28,29,30. This allowed the crabs to walk freely whilst preventing translational or rotational movement. Visual stimuli were displayed on a vertical alignment-type liquid crystal display (PVA-LCD) computer monitor (1905FP, Dell, Round Rock, USA) 200 mm in front of the crab (Fig. 1). For the polarization experiment, the LCD monitor was modified by removing the outermost polarizing filter, so that intensity contrast was converted to contrast in the degree of polarization (DoP) only47. The polarization properties of this monitor were measured using a rotatable Glan Thompson polarizer coupled with a spectrophotometer (QE65000, Ocean Optics, Largo, USA). When operated in gray scale, instead of ranging between black and white, the screen’s display ranged from fully polarized (DoP = 0.99) to nearly unpolarized (DoP = 0.1) (supplementary Fig. S2a). The angle of polarization (AoP) did not change and was always near-horizontal (supplementary Fig. S2b). A 40 × 40 × 40 cm white photographic tent (LT124, PhotoSEL), with a hole cut in the base for the treadmill and the open front positioned against the computer monitor, served to screen out any visual distractions that might have affected the behavior of the crab.

Stimuli

The experiments were conducted in Matlab R2016a (MathWorks, Natick, USA) using the Psychophysics Toolbox extensions48,49. All stimuli were displayed against a static pseudorandom noise background composed of 9 × 9 mm (angular size of 2.5° at the viewing distance of 200 mm) black (8-bit - R = G = B = 0) and white (R = G = B = 255) squares in the intensity experiment, and unpolarized (DoP= 0.1, R = G = B = 200) and fully polarized (DoP = 0.99, R = G = B = 0) squares in the polarization experiment. The significant response to the mean gray stimulus in the intensity experiment (Fig. 3a) indicates that the crabs were able to resolve the background. Because large clumps of squares with the same intensity or DoP value (which sometimes occurred when the pattern was fully random) could result in the generation of first-order artifacts in the second-order stimuli32, the pattern of squares was designed using a pseudorandomisation process; each square could be horizontally and/or vertically adjacent to no more than two squares of the same intensity or polarization value. The stimuli consisted of four different expanding squares (and one non-expanding square) that expanded over approximately 1.2 s to a maximum size of 114 × 114 mm (150 mm from top left to bottom right) so that it occupied a maximum of 41.2° of the crab’s visual field when fully expanded. A polarization stimulus spanning a larger area of the visual field than this would have suffered from intensity artefacts47. The stimulus was displayed above the crab’s visual horizon (to simulate an approaching predator) in accordance with previous studies28. At stimulus onset, the expansion started by covering four background squares (layer 1) and a new layer of squares was added to the outer edge of the stimulus each time it expanded (Fig. 2). This method of expansion was designed to ensure that the expanding edge of the stimulus only ever obscured complete background squares, i.e., it never obscured half a background square as to do so would generate first-order artifacts in the second-order stimuli. Once the stimulus reached its full size it remained on the screen for 2 s before disappearing. Expanding computer generated stimuli were used because they have been shown to elicit a reliable and robust behavioral response in fiddler crabs28,29,30. Second-order stimuli like those used in other invertebrate studies, e.g.,16,18, were not appropriate for this study because they would not elicit a reliable behavioral response in the crabs. For instance, Theobald et al.16 measured the tracking response of fruit flies to moving first- and second-order gratings. This would not work for this study because although crabs show a tracking response to intensity gratings, they do not track polarization only gratings50.

A stimulus that matched the pattern of the background was used as the negative control (Fig. 2b and supplementary movie 4), while the first-order stimulus functioned as a positive control (supplementary movie 5). For this, a solid black or unpolarized expanding stimulus, which differed from the background in mean intensity or mean DoP, was used in the intensity and polarization experiments respectively.

We also included a solid mean gray/mean DoP expanding stimulus (referred to as the ‘mean gray’ stimulus for simplicity) (supplementary movie 6). The grayscale (RGB) value of the stimulus was calibrated using a spectrophotometer (USB2000, Ocean Optics, Largo, USA) coupled to an optical fiber (P200-10-UV/VIS, Ocean Optics, Largo, USA) to match the mean intensity (or mean DoP in the polarization experiment) of the background. At the global level, the mean gray stimulus was, by definition, second-order as there was no mean intensity (or mean polarization) difference between the stimulus and the background. However, while every precaution was taken to avoid the generation of first-order artifacts in the second-order stimuli, we cannot fully rule out the possibility that the mean gray stimulus could have contained some first-order motion cues at the resolvable local level. This is because of the potential for local intensity or polarization contrasts created by small clumps of background squares of the same RGB value in the direction of expansion. Nevertheless, the pseudorandom noise background, combined with the method of expansion, would have minimized any artifacts. It should be noted any such local artifacts would not have occurred in the second-order dynamic texture stimulus described below.

For the main second-order motion stimulus each square within the expanding stimulus was pseudorandomly assigned one of the two possible intensity (R = G = B = 255 or R = G = B = 0) or DoP (0.99 or 0.1) values every 83.3 ms (e.g., a black square could change to a white square or remain black and vice versa). The resulting second-order dynamic texture stimulus had a mean change rate of 6 Hz, measured using a photodiode coupled to an oscilloscope (LT354M, LeCroy, New York, USA) (supplementary movie 7). This change rate was chosen as it is well below the flicker fusion frequency of fiddler crabs which is estimated to be around 70 Hz51. To confirm that the crabs were responding to the second-order motion and not just stationary changes in stimulus texture (i.e., the static change in intensity or polarization detected by only a few ommatidia), a dynamic texture control stimulus was used. The dynamic texture control was the same as the second-order motion dynamic texture stimulus except it did not have an expanding profile. Instead, the dynamic texture control appeared on the screen full size from stimulus onset and so did not contain any expanding motion cues (supplementary movie 8).

Experimental procedure

Fiddler crabs were tested using a fully automated protocol developed in Matlab R2016a. Each crab was tested only once in either the intensity (N = 60) or polarization (N = 60) experiment. The experimental procedure was similar to that used by previous studies28. Each crab was positioned on the treadmill facing the screen and allowed 3 min to acclimatize. Following acclimatization each crab was presented with the five stimuli in a randomized order. Each stimulus was presented only once, except for repeats following rejections as described below, with a random between-stimulus interval ranging between 30 s and 50 s. This interval was longer if the crab was stationary as the software was programmed to check that the crab was walking before initiating the next presentation. In cases where a crab stopped walking entirely, the experiment was forcibly ended after 30 min, even if the crab had not been presented with all five stimuli. The pattern of the pseudorandom noise background was changed between each stimulus presentation. Any effect of habituation was controlled for by the randomization of the stimulus order. Crab behavior and treadmill movement were recorded from above using a webcam (C270, Logitech, Lausanne, Switzerland). Fiddler crabs show a multi-stage escape response when they are approached by a potential threat35,52,53. The crab’s typical behavior when detecting a potential predator in their natural environment is first to freeze and cease all activity. If the threat continues to approach, they sprint to their burrow and stop just outside its entrance. If the potential predator then further approaches they descend into the safety of their burrows35,52,53. The different stages of the response are controlled and initiated by a combination of intensity and polarization providing visual information on the target’s retinal speed, elevation, position and movement direction relative to the crab25,26,52,53,54,55,56. We used the crab’s initial freeze response as a proxy for the crab detecting the stimulus as this behavior is the most reliable and consistent response within the lab environment. We utilized the same approach as previous research28 that automatically scored crab response in Matlab at the end of each presentation using the two-dimensional motion detection algorithm (see ref. 57 for details), which detected the motion of markings drawn on the polystyrene treadmill ball. The scoring window for crab response started at stimulus onset and ended when the stimulus disappeared. The crab’s pre-stimulus behavior on the treadmill was usually to maintain a steady walk. A crab was therefore recorded as having responded to the stimulus if it stopped walking (i.e., displayed a freeze response) within the scoring window. This was indicated by the detected motion of the markings on the ball falling below a set threshold (see supplementary movies 913 for example motion traces of recorded responses and movies 1418 for examples of no response, and supplementary table 1 for the stimulus presented during each recording). Trials in which the crab had ceased walking before the scoring window (i.e., at or just before stimulus onset) could not be reliably scored automatically and were therefore rejected (see supplementary movies 1923 for example motion traces of rejected recordings and supplementary table 1 for the stimulus presented during each recording). The stimulus from a rejected trial was appended to the end of the series for a repeat presentation (up to a maximum of five). Because some of these repeated presentations were also rejected and the number of repeats was capped at five, plus cases when the experiment was forcibly ended after 30 min due to inactivity, not all crabs contributed data to every stimulus tested hence the range of N values shown in Fig. 3. In the intensity experiment 75 presentations out of a total of 375 (i.e., 20% of presentations) were repeats following a previous rejection. In the polarization experiment 96 presentations out of a total of 396 (i.e., 24.24% of presentations) were repeats. The statistical analysis controlled for possible effects of habituation that may have occurred because of repeated exposure to the same stimulus.

Statistics and reproducibility

All statistical analysis was conducted in R58. Initial analysis for each experiment was performed using mixed effects binary logistic regression, fitted using the lme4 package59. We used the DHARMa package60 to run residual diagnostics that are often overlooked in logistic regression. Crab response (yes/no) was the binary response variable, while stimulus type (i.e., negative control, first-order stimulus, etc.), crab sex and size, and presentation order were included as fixed effects in the full model. The latter was included to test and control for any effect of habituation. Crab identification was included as a random effect to control for repeated measures. We then used the full model to report the significance of each main effects using a likelihood ratio test to compare it with the same model but with the effect of interest removed. McNemar tests33 with a Bonferroni correction were used for post hoc pairwise comparisons within each experiment. A continuity correction was applied whenever the contingency table contained cell counts of five or less. As explained in the previous section, not all crabs contributed data to every stimulus tested. Therefore, each McNemar test was performed only on data from crabs that contributed data to both conditions within the pairwise comparison. The N value for each pairwise comparison is reported alongside the results of each McNemar test within the results section. Effect size is given as the odds ratio. For a 2 × 2 contingency table, where a and d are the concordant cells and b and c are the discordant cells, the odds ratio is the greater of (b/c) or (c/b)61. Note that previous research has shown that response probability of the crabs to any given stimulus depends on its saliency relative to the other stimuli tested within the same experiment28. It is therefore not valid to directly compare the magnitude of response probability between experiments. For this reason, we do not attempt to directly compare differences in responses between the intensity and polarization experiments.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.