Supporting 3D trajectories, code, and simulations for: The nuptial dance of male mayflies helps avoid mistaken interception by other males
Data files
Apr 15, 2026 version files 75.31 MB
-
Fabian_et_al_Data_and_Code.zip
75.29 MB
-
README_for_Mayfly_Repository.md
7.62 KB
-
README.md
8.03 KB
Abstract
Male mayflies (Ephemeroptera) engage in oscillating nuptial flight patterns in which they climb vertically before passively parachuting downward. Males hold station above an area often in large numbers, intercepting adult females passing overhead. We reconstructed the flight behaviour of common mayfly (Ephemera vulgata) aggregations in 3D, while they were performing their nuptial dance and chasing artificial targets. Male mayflies chased any object that travelled horizontally above them and attempted to mate with it. Despite this indiscriminative chasing, we observed that males mayflies rarely caught each other by mistake. We suggest that the flight pattern of male mayflies helps them avoid each other whilst keeping the flight-motor system active. By flying vertically, males rarely fly horizontally above each other, the key signature used to identify potential mates. Male mayflies stop their pursuit if the target drops beneath the horizon. Therefore, we suggest that male mayflies engage in a downward parachute as an effective evasion strategy against other males that may aim to intercept them. During target interception, mayfly flight behaviour resembles the guidance law of proportional navigation. We found that mayflies selectively change speed, fanning their long posterior filaments and spreading their hindwings to decelerate before turning. Mayflies are more manoeuvrable at low speeds, and thus this deceleration prior to turns reduces overshooting and increases steering performance. Through simulation, we demonstrate that a speed-changing, mayfly-inspired proportional navigation controller is more effective than constant-speed models at staying below and colliding with manoeuvring targets.
Associated Publication
Samuel T. Fabian, Benjamin P. Campbell, Eleanor F. Miller, Huai-Ti Lin; The nuptial dance of male mayflies helps avoid mistaken interception by other males. J Exp Biol 15 March 2026; 229 (6): jeb251579. doi: https://doi.org/10.1242/jeb.251579
Dataset Overview
This repository is designed to provide the data and handling scripts of the reconstructed mayfly (Ephemera vulgata) 3D trajectories. It also replicates the kinematic analyses performed in the associated paper. We also provide the scripts associated with our interception and swarm simulations.
This dataset contains 3D reconstructed flight trajectories of male mayflies (Ephemera vulgata), along with MATLAB scripts used for kinematic analysis and simulation studies presented in the associated publication. All data and scripts are included within Fabian_et_al_Data_and_Code.zip. This readme is also included as README_for_Mayfly_Repository.md.
The dataset includes:
- Reconstructed 3D trajectories from stereo video recordings
- Two behavioural contexts:
- Chasing trajectories (male pursuit of artificial targets)
- Nuptial dance trajectories (natural vertical oscillatory flight)
- MATLAB scripts for:
- Data handling and visualization
- Reproducing figures from the publication
- Running interception and swarm simulations
Dataset:
- 120 usable stereo recordings
- 345 chasing trajectories
- 170 nuptial dance trajectories
Recordings were collected in:
- Richmond, London, UK (2022)
- Cambridge, UK (2023)
Each recording contains one or more trajectories of individual mayflies.
A trajectory corresponds to a single continuous track of an individual mayfly (or artificial target) within a recording.
File Structure
ObservedData/
Contains all experimentally derived trajectory data and associated analysis scripts.
- All Chasing Trajectories/
3D reconstructed trajectories of male mayflies pursuing an artificial target (black sphere, 2.5 - 5 cm diameter). Multiple trajectories may be present per file. Artificial targets were manually moved above swarms to elicit pursuit behaviour. - All Nuptial Dance Trajectories/
3D reconstructed trajectories of male mayflies performing natural vertical oscillatory flight. No artificial target is present. - SupportingFunctions/
MATLAB helper functions required to run analysis scripts (automatically added to path). - exampleTrajectoryPlotting. m: Demonstration script for loading and plotting trajectory data.
- Kinematics_1_Target_interception.m
Script used to reproduce figures related to chasing and interception analyses. - Kinematics_2_Nuptial_Dance.m
Script used to reproduce figures related to nuptial dance trajectories.
Simulations/
Interception Simulations/
- SupportingFunctions/ - Helper functions
- main_modelComparisons.m - Model comparison across repeated simulations
- main_singleTurnComparisons.m - Model comparison on a single trajectory
Swarm Simulations/
- SwarmSimulation_circular.m - Circular movement model
- SwarmSimulation_verticalDance.m - Data-driven vertical dance model
- SwarmSimulation_zigZag.m - Zig-zag movement model
- SupportingFunctions/ - Helper functions
Experimental Methods Summary
- Flight trajectories were recorded using a calibrated stereo camera system.
- Cameras were frame-synchronised, and recordings were typically made at 240 fps (with a small number at 1000 fps), with ~2000 frames per recording.
- 2D trajectories were extracted from each camera view and triangulated to reconstruct 3D positions.
- Tracking involved manual curation combined with semi-automated detection, followed by spline-based smoothing.
- Each trajectory represents the motion of a single mayfly (or artificial target) over time.
- In chasing experiments, males pursued an artificial black spherical target.
- In nuptial dance recordings, no target was present; males exhibited natural vertical oscillatory flight.
- Multiple individuals may be present in a single recording.
Data Structure
Each file named Mayfly_xxxx_3D_Trajectories.mat contains two MATLAB structures:
1. metadata
| Variable | Description | Units | Notes |
|---|---|---|---|
| stereoParams | Stereo camera calibration parameters | - | Used for triangulation |
| fps | Frame rate | Hz | Recording frame rate (typically 240 or 1000 Hz) |
| smoothCnst | Smoothing constant | - | Used in spline smoothing |
| smoothDistLim | Distance threshold for filtering | mm | Excludes outliers |
| smoothRMSEThresh | Reprojection error threshold | pixels | Excludes poor reconstructions |
| trackC1, trackC2 | 2D tracked positions | pixels | Cell arrays of [X, Y]; NaN = not visible |
| nf | Number of frames | - | Typically ~2000 |
2. MF_interactionData
| Variable | Description | Units | Notes |
|---|---|---|---|
| rawTraj | Raw 3D trajectories | mm | Cell array of [X, Y, Z ]; cell 1 = target (if present) |
| rawTrajRMSE | Reprojection error | pixels | Per-point reconstruction error |
| smoothTraj | Smoothed 3D trajectories | mm | Preliminary smoothing applied |
Coordinate system: positions are expressed relative to camera 1.
Reference frame: trajectories are expressed in the ground reference frame. Wind may influence apparent motion, as air-relative velocity is not directly measured.
How to Use This Dataset
-
Load a trajectory file in MATLAB:
load('Mayfly_xxxx_3D_Trajectories.mat') -
Access raw trajectory data:
MF_interactionData.rawTraj -
Key usage notes:
rawTrajcontains the primary reconstructed 3D positions- In chasing datasets, it
rawTraj{1}corresponds to the artificial target. In nuptial dance data sets, this cell will be empty.rawTraj{1}=[];. - All subsequent cells correspond to individual mayflies
- Units are millimetres (mm)
-
For visualization and examples, run:
exampleTrajectoryPlotting.m
Data Usage Notes and Limitations
- Sections of missing data are represented as
[NaN, NaN]in 2D tracks. - Reconstruction accuracy varies; points with high reprojection error (>5 pixels) may be unreliable.
- Smoothed trajectories are provided for convenience but may not be suitable for all analyses.
- Users performing detailed kinematic analysis are encouraged to reprocess raw trajectories according to their specific requirements.
Behavioural Classification
- Chasing trajectories: mayflies actively pursuing a moving target above them
- Nuptial dance trajectories: vertical oscillatory flight behaviour without a target present
Reproducing Figures
-
Interception analyses:
Kinematics_1_Target_interception.m -
Nuptial dance analyses:
Kinematics_2_Nuptial_Dance.m -
Simulation scripts can be run independently.
Requirements
- MATLAB R2022b (or compatible version)
Contact
Samuel T Fabian,
University of Oxford,
samueltfabian@gmail.com
