Long-term Behavioral Tracking of Freely Swimming Weakly Electric Fish


Your institution must subscribe to JoVE's Neuroscience section to access this content.

Fill out the form below to receive a free trial or learn more about access:



We describe a set of techniques for studying spontaneous behavior of freely swimming weakly electric fish over an extended period of time, by synchronously measuring the animal's electric organ discharge timing, body position and posture both accurately and reliably in a specially designed aquarium tank inside a sensory isolation chamber.

Cite this Article

Copy Citation | Download Citations

Jun, J. J., Longtin, A., Maler, L. Long-term Behavioral Tracking of Freely Swimming Weakly Electric Fish. J. Vis. Exp. (85), e50962, doi:10.3791/50962 (2014).


Long-term behavioral tracking can capture and quantify natural animal behaviors, including those occurring infrequently. Behaviors such as exploration and social interactions can be best studied by observing unrestrained, freely behaving animals. Weakly electric fish (WEF) display readily observable exploratory and social behaviors by emitting electric organ discharge (EOD). Here, we describe three effective techniques to synchronously measure the EOD, body position, and posture of a free-swimming WEF for an extended period of time. First, we describe the construction of an experimental tank inside of an isolation chamber designed to block external sources of sensory stimuli such as light, sound, and vibration. The aquarium was partitioned to accommodate four test specimens, and automated gates remotely control the animals' access to the central arena. Second, we describe a precise and reliable real-time EOD timing measurement method from freely swimming WEF. Signal distortions caused by the animal's body movements are corrected by spatial averaging and temporal processing stages. Third, we describe an underwater near-infrared imaging setup to observe unperturbed nocturnal animal behaviors. Infrared light pulses were used to synchronize the timing between the video and the physiological signal over a long recording duration. Our automated tracking software measures the animal's body position and posture reliably in an aquatic scene. In combination, these techniques enable long term observation of spontaneous behavior of freely swimming weakly electric fish in a reliable and precise manner. We believe our method can be similarly applied to the study of other aquatic animals by relating their physiological signals with exploratory or social behaviors.


Background. Quantitative experiments on animal behavior (e.g. forced choice, shock avoidance, T-maze, etc.) are typically utilized to investigate specific hypotheses concerning sensory-motor skills, learning and memory formation. However, these restrictive experiments miss much of the richness of natural animal behavior and are likely to result in oversimplified models of the underlying neural basis of behavior. Experiments under more naturalistic conditions are therefore an important complement by which we can explore more fully a species behavioral repertoire. Experiments involving freely moving animals must, however, address unique technical challenges such as movement-induced recording artifacts. Unlike stimulus-evoked responses, spontaneously occurring exploratory behavior cannot be predicted; thus experimental subjects have to be constantly monitored and tracked over an extended period of time. Specific research questions can be best addressed by carefully selected organisms and available technical tools. For example, optical recording and stimulation techniques such as genetically-encoded calcium sensors1 and optogenetics2 have been successfully applied to freely moving genetic model organisms3-5. Alternatively, miniaturized neural telemetry systems can record and stimulate freely moving small animals6,7.

Electric fish. WEF species generate electric organ discharges (EODs), which allow them to sense their immediate surroundings or to communicate over greater distances. Temporal patterns of EODs vary under different conditions such as self-movements8,9, sensory stimuli10,11, and social interactions12,13. Pulse-type WEF species produce a train of discrete pulses, as opposed to wave-type species which generate continuous quasi-sinusoidal waveforms. In general, pulse-type species exhibit more variable EOD rate compared to the wave-type species; and animals' EOD rates closely reflect novelty contents of their sensory surroundings10,14. Pulse-type species can immediately shorten the inter-pulse interval (IPI) within a single pulse cycle in respond to a novel sensory perturbation (novelty response10,11,14). The ongoing electric behavior of these fish can be perturbed by uncontrolled sensory stimuli from external sources; and different kinds of stimuli such as vibration, sound, electricity, and light are known trigger novelty responses. Therefore, special precautions must be taken to block or attenuate external sensory stimuli during a long-term observation of free-swimming WEF. In this way, changes in EOD rate and movement trajectories can be specifically attributed to stimuli presented by the experimenter.

Aquarium tank and isolation chamber. We therefore placed multiple layers of vibration absorbing materials under a large aquarium tank (2.1 m x 2.1 m x 0.3 m), and surrounded the tank with an insulated enclosure to block external sources of light, electrical noise, sound and heat flux. EOD rate depends on the surrounding temperature15,16, thus the water temperature was tightly regulated at a tropical range (25±1 °C) for South American WEF species. We constructed a large and shallow (10 cm water depth) tank to observe spatial exploratory behaviors of WEF mainly restricted in two dimensions (Figure 1A). The tank was partitioned into a central arena to observe spatial behaviors, and four corner compartments to separately house individual fish (Figure 1B). Each compartment was built watertight to prevent electrical communication between individuals. Animals' access to the central arena was controlled from the outside by four motorized gates. The gates were placed between the compartments, and they became watertight when locked by nylon wing-nuts. No metallic parts were used underwater since WEF react sensitively to metals.

EOD recording. EODs are generated in a stereotyped manner by activation of single (in Mormyrids) or multiple spatially distributed electric organs (in Gymnotiforms)17,18. Temporal modulations in the EOD rate can reveal higher-level neural activities, since the medullary pacemaker receives direct neural inputs from higher brain regions such as the diencephalic prepacemaker nucleus, which in turn receives axonal projections from the forebrain19. However, the EOD timing must be carefully extracted from a raw waveform recording and not biased by the animal's movement-induced distortions. The electric field generated by a WEF can be approximated as a dipole; thus EOD pulse amplitudes at recording electrodes depend on the relative distances and orientations between the animal and the electrodes8,20. Animal's self-movements change the relative geometry between the animal and the electrodes, thus movements cause the EOD amplitudes at different electrodes to vary over time in a volatile manner (see Figure 2B in Jun et al.8). Furthermore, self-movements also change the shape of recorded EOD waveforms, because relative contributions from different set of the electric organs depend on their locations along the body length and their local curvatures introduced by tail bending. The movement-induced distortions in the EOD amplitudes and shapes can lead to inaccurate and unreliable EOD timing measurements. We overcame these problems by spatially averaging multiple EOD waveforms recorded at different locations, and by adding an envelope extraction filter to precisely determine the EOD timing from a free-swimming WEF. In addition, our technique also measures the EOD amplitudes, which indicate whether an animal is resting or actively moving based on the change of the EOD amplitudes over time (see Figures 2E and 2F). We recorded differentially amplified signals from the recording electrode pairs to reduce common-mode noise. Since the EOD pulses are generated at irregular time intervals, the EOD event time-series have a variable sampling rate. The EOD time-series can be converted to a constant sampling rate by interpolation if required by an analytic tool of choice.

Video recording. Although EOD recording can monitor a gross movement activity of an animal, video recording permits direct measurements of an animal's body position and posture. Near-infrared (NIR) illumination (λ = 800~900 nm) permits unperturbed visual observation of freely swimming fish21,22, since WEFs are most active in darkness and their eyes are not sensitive to NIR spectrum23,24. Most digital imaging sensors (e.g. CMOS or CCD) can capture NIR spectrum with the wavelength range between 800-900 nm, after removing an infrared (IR) blocking filter25. Certain high-end consumer-grade webcams offer high-definition, wide viewing angle and good low-light sensitivity, which can produce an image quality comparable to, or superior to professional-grade IR cameras available at much greater costs. In addition, certain consumer-grade webcams are bundled with recording software that permits an extended recording duration by compressing video with no quality loss. Most professional-grade cameras offer time synchronization TTL pulse outputs or trigger TTL pulse inputs26 for aligning the timing between the video with the digitized signals, but this feature is generally absent in consumer-grade webcams. However, the timing between a video recording and a signal digitizer can be accurately matched by concurrently capturing a periodically blinking IR LED with the camera and the signal digitizer. The initial and the final IR pulse timing can be used as two time calibration markers for converting the video frame numbers to the signal digitizer time unit and vice versa.

Lighting & background. Image capturing through water can be technically challenging due to light reflections at the water surface. The water surface can act as a mirror to reflect a visual scene above water, and obscure visual features underwater; thus the scene above water must be rendered featureless to prevent visual interference. In order to image the whole aquarium, a camera needs to be placed directly above the water; and it should be hidden behind the ceiling over a small viewing hole to prevent its reflection on the water surface. Moreover, the water surface can produce glares and nonuniform illumination if light sources are incorrectly projected. Indirect illumination can achieve uniform brightness over the whole aquarium by aiming the light sources toward the ceiling, such that the ceiling and the surrounding walls can reflect and diffuse the light rays before reaching the water surface. Choose an IR illuminator that matches a spectral response of the camera (e.g. 850 nm peak wavelength). Electrical noise from the light sources can be minimized by using LED lights and placing their DC power supplies outside of the Faraday cage. Place a white background underneath the tank, since fish contrasts well in a white background at NIR wavelengths. Similarly, use of matte white color on the inner surfaces of the isolation chamber provides uniform and bright background illumination.

Video tracking. After a video recording, an automated image tracking algorithm can measure the animal's body positions and postures over time. The video tracking can be automatically performed by either ready-to-use software (Viewpoint or Ethovision), or user-programmable software (OpenCV or MATLAB Image processing toolbox). As the first step of image tracking, a valid tracking area needs to be defined by drawing a geometric shape to exclude the area outside (masking operation). Next, an animal's image needs to be isolated from the background by subtracting a background image from an image containing the animal. The subtracted image is converted to a binary format by applying an intensity threshold, such that the centroid and the orientation axis can be computed from binary morphological operations. In Gymnotiforms27-29 and Mormyrids30-32, the electroreceptor density is the highest near the head region; thus the head position at any moment indicates a location of the highest sensory acuity. The head and tail locations can be automatically determined by applying the image rotation and bounding-box operations. The head and tail ends could be distinguished from one another by manually defining them in the first frame, and by keeping track of their locations from comparing two successive frames.

Subscription Required. Please recommend JoVE to your librarian.


This procedure meets the requirements of the University of Ottawa Animal Care Committee. No conflict of interest is declared. Please refer to the Table of Materials and Reagents for the makes and models of the equipment and materials listed below. Custom written Spike2 and MATLAB scripts, and sample data are provided in the Supplemental File.

1. Aquarium Tank and Isolation Chamber Setup

  1. Anti-vibration floor. Construct an anti-vibration surface (2.1 m x 2.1 m) by stacking rubber pads, acoustic Styrofoam, marine plywood panel, and polyurethane foam pads from the bottom to the top (Figure 1A). Lay four wooden studs (5 cm x 10 cm) on the plywood panel to support the edges of the aquarium tank.
  2. Floor heater. Lay an electrically shielded heating element over thermally graded foam padding (see Figure 1D bottom). Cover the heating element with a metallic mesh for electrical shielding.
  3. Spatial tank. Construct a wide and shallow aquarium tank (1.8 m x 1.8 m x 30 cm) using 1.3 cm thick tempered glass panels, L-shaped aluminum frame and aquarium-grade silicone (see Figure 1A). Cover the underside of the tank with a large sheet of white background to provide high imaging contrast (see Protocol 3).
  4. Divide the aquarium tank into a central arena (1.5 m diameter) and four corner compartments (see Figure 1B) by installing walls (22.5 cm tall) made of acrylic sheets (matte white, 0.64 cm thick).
    1. Bend four acrylic sheets (22.5 cm x 102.7 cm) by applying heat to create four curved wall sections, and attach them to the tank bottom using silicone caulk to separate the central arena from the four corner compartments. Leave 20 cm space between the curved sections for the gate installation.
    2. Separate neighboring corner compartments by installing four double walls with 15 cm gaps, which provide extra electrical isolation and places for underwater sensors such as a hydrophone.
  5. Assemble four motorized gates, and install them between the corner compartments and the central arena.
    1. Assemble four door frames as shown in Figure 1C. Create six wells (0.64 cm deep) on each door frame, embed nylon acorn nuts (0.64 cm diameter thread) and secure them with epoxy.
    2. Cut four door panels from acrylic and rubber sheets, and create six holes (0.64 cm diameter) on the acrylic and rubber panels for the locking mechanism. Join the acrylic and rubber panels using silicone caulking.
    3. Install acrylic hinges to join the door panels with the door frames.
    4. Mount swinging arms on servomotors, and install them on the top of the door frames (see Figure 1C). Make loops with cable ties to link the swinging arms to the door panels.
    5. Position the gate assemblies on the gaps created between the curved wall sections, and secure them using silicone caulking.
    6. Connect all servomotors to a servo controller, and connect it to a power source and a computer via an active USB extension cable. Test the gates using control software supplied with the servo controller.
    7. After the silicone hardens, check for watertightness by locking all gates with nylon screws and filling one compartment at a time.
  6. Isolation chamber. Construct an isolation chamber to surround the aquarium and block external sources of light, sound and electrical noise (see Figure 1D).
    1. Make three wall panels (2 m x 2 m x 5 cm) and four door panels (1.9 m x 0.95 m x 5 cm). For each panel, join aluminum moldings (5 cm x 2.5 cm) to create a rectangular frame; and rivet a white corrugated plastic panel on the aluminum frame. Fill acoustic fiberglass batts in the panels, and close with a black corrugated plastic panel.
    2. Install three wall panels on the anti-vibration floor, and install piano hinges to join the four door panels on the wall panels.
    3. Surround the isolation chamber with aluminum meshes, and ground meshes on all sides to create a Faraday cage.
  7. Humidity control. Install a low-noise exhaust fan (Figure 1F top) to remove excess humidity build-up from heating. Place the exhaust fan at least 2 m away from the recording site, and install an air duct between the isolation chamber and the exhaust fan.
  8. Routinely monitor and maintain the conditions of the tank water and animals.
    1. Maintain constant water conditions at 10 cm depth, 100 µS/cm conductivity and pH 7.0 by adding water or salt stock solution (refer to Knudsen33 for the recipe). Add a bag of crushed coral if the pH drops below 6.5.
    2. Install vertical aquarium filters which can operate from shallow water for cleaning and aerating purposes (Figure 1F bottom). Disconnect the filters and take them out of the central arena during recording sessions.
    3. Deliver live mealworms on the bottom of the tank by attaching them on suction cups with elastics. Avoid free-floating preys such as blackworms to prevent uncontrolled feeding of stray preys during recording.

2. EOD Tracking

  1. Electrodes installation. Assemble eight graphite electrodes, and space them equally on the curved wall of the central arena.
    1. Obtain drawing leads (15 cm in length; Mars Carbon 2 mm type HB) and shave off the outer coating of the leads.
    2. Cut eight 10 cm segments of coaxial cable (RG-174), wrap the cable core around one end of the graphite rods, and apply heat-shrink tubing over them for strong and stable electrical connection. Attach BNC jack connectors on the opposite ends (Figure 2A left).
    3. Position the electrodes on the wall by taping, and apply thin strips of masking tape on the electrode surfaces to protect from silicone. Apply silicone caulking to permanently hold the electrodes, and remove all tape before the silicone hardens (Figure 2A right).
  2. Build eight cable assemblies by measuring the distance from each electrode to the amplifier unit, and cutting coaxial cables (RG-54) in lengths. Attach BNC plug connectors on both ends of the cables.
  3. Use the cable assemblies to wire all electrodes to the amplifier unit. Differentially amplify by pairing two 90° oriented electrodes (see Figure 2B), and ground all coaxial shielding wires by connecting them to the Faraday cage.
  4. Set the amplifier gain below the signal saturation limit, and apply a band-pass filter (200 Hz-5 kHz) to remove noise. Digitize the four recording electrode pairs at 40 kS/sec.
  5. Online signal processing. The instructions are written for the Spike2 software, and the parameter settings are optimized for Gymnotus sp. (see Figure 2C for summary).
    1. Add a DC remove process (τ = 0.1 sec) to all recording channels.
    2. Add a rectify process to all recordings channels.
    3. Create a virtual channel by summing all four recording channels.
    4. Extract a unimodal envelope per EOD pulse by adding a RMS (root-mean-squared, ) process (τ = 0.25 msec) to the virtual channel, for generating a single peak per EOD cycle to unambiguously determine the pulse timing.
    5. Create a realmark channel from the virtual channel and record the time and values of the peak amplitudes, after setting an appropriate threshold to capture all EOD pulses without missing a pulse, while avoiding false positives.
    6. Monitor the instantaneous EOD rate in real-time by setting the channel display option of the realmark channel to an instantaneous frequency mode.
    7. Monitor the fish movement in real-time by duplicating the realmark channel, and set the display option to a waveform mode.
    8. Quantify an activity level from the RMS of the EOD amplitude slope by creating a virtual channel from the realmark channel (0.01 sec sampling period), and add slope (τ = 0.25 msec) and RMS (τ = 0.5 msec) processes.
    9. Export the realmark channel in the Spike2 software to the MATLAB format.

3. Synchronized Video Tracking

  1. Create a background scene.
    1. Hide any object that casts a reflection on the water surface by covering with matte white countertop film.
    2. Install a matte white corrugated plastic panel 15 cm below the ceiling to hide the camera and the air vent.
    3. Print grid patterns on a large sheet of white paper for calibrating a camera, and lay it underneath the tank to provide a high-contrast background.
  2. Install light sources.
    1. Obtain IR LED lights and, remove built-in fans to reduce noise. Drive the LED with a current-regulated DC power supply placed outside of the Faraday cage.
    2. Install IR LED lights for imaging in darkness, and white LED lights for driving a diurnal light cycle in the test fish. Direct all light sources toward the ceiling to achieve indirect and uniform illumination (Figure 3A).
    3. Regulate the diurnal light cycle by driving the white LED lights with a timer-controlled switch (e.g. 12 hr on/12 hr off).
  3. Install a camera directly above the aquarium.
    1. Obtain a NIR-sensitive camera, or remove an IR blocking filter by breaking a thin sheet of tinted glass at the back of the lens assembly. Make sure the viewing angle is wide enough to image the whole central arena.
    2. Make a small viewing hole in the middle of the ceiling panel, and place the camera directly above the hole.
    3. Install a white ring guard around the lens if the light sources generate glares.
  4. Make a time-synchronized video recording.
    1. Place an IR LED at one of the four tank corners to generate time synchronization pulses (1 msec duration, 10 sec period). Add a load-limiting resistor (1 kΩ) in series, and drive the IR LED from a digital output port of the digitizer hardware.
    2. Use video recording software bundled with the camera if available. Select the highest recording quality (e.g. lossless compression) and the highest resolutions supported.
    3. Start the video recording immediately before starting the EOD recording, and stop the video recording immediately after the EOD recording.
    4. After the recording, convert the image frame numbers to the digitizer time unit by linearly interpolating between the first and the last light pulses captured by the signal digitizer and the video recording.
  5. Automated image tracking
    The instructions are written for the MATLAB Image processing toolbox, and make use of its functions. A custom MATLAB script is provided with this submission for automated image tracking. 
    1. Import video. Import a video recording file directly to the MATLAB workspace using "Videoreader.read" function.
    2. Create a composite background image by combining two image frames. Replace the image region occupied by an animal with an unoccupied image of the same region from another frame (see Figure 3B).
    3. Specify an image region to track by drawing a circular mask around the central arena to exclude the area outside (Figure 3B bottom), and multiply by a constant (rint) to set a minimum threshold for intensity difference. For example, setting rint = 0.85 will suppress the intensity fluctuations 15% = (1 - rint) below the background.
    4. Image subtraction. Subtract an image frame (=IMk) from the background image (=IM­0) to obtain the difference image (=ΔIMk). Use unsigned integer numerical precision to store the image intensity values as non-negative integers.
    5. Segment the difference image by applying an intensity threshold determined from the graythresh function. Clean the binary image using the bwmorph function, and select the largest blob corresponding to an animal after calculating all blob areas using the regionprops function.
    6. Determine the centroid and major orientation axis of the largest blob by applying the regionprops function, and rotate the image to align the major axis with the x-axis. Divide the image to the head and tail parts at the centroid (Figure 3D top).
    7. Determine the major axis of the head part, and rotate the entire image to align with the x-axis (Figure 3D bottom left). Fit bounding-boxes around the head and tail parts parallel to their major axes using the regionprops function.
    8. Determine the median y-coordinates of the blob at the left, center and right vertical edges of the bounding boxes (green dots in Figure 3D bottom); and assign them to five feature points (head-tip, mid-head, mid-body, mid-tail, tail-tip).
    9. Process successive frames after cropping an image frame centered at the animal's centroid determined from its previous frame.
    10. Manually assign the head orientation for the first frame, and use a dot-product between the orientation vectors from two successive frames to automatically determine the head orientation. Inspect the result, and manually flip the head orientation if incorrectly assigned.
  6. Plot an animal trajectory by joining the head-tips, and smooth using median and average filters (n=3) if it has a jittery appearance. Superimpose the trajectory with a background image, and interpolate fish midlines using the five feature points (see Figure 2E).
  7. Compute the average EOD rate at each image capture time by resampling the instantaneous EOD rate (100 Hz sampling rate) and averaging (0.0625 sec time window). Plot the trajectory in pseudo-colors determined from the time-matched EOD rate, and superimpose with a background image (see Figure 2F).

Subscription Required. Please recommend JoVE to your librarian.

Representative Results

EOD tracking results

The recorded EOD waveforms from different electrode pairs varied in amplitudes and shapes as expected from their unique positions and orientations (Figure 2C top). The use of multiple electrode pairs ensured strong signal reception at all possible positions and orientations of WEF within the tank. The envelope waveform (Figure 2C bottom, green trace) always contained a single peak per EOD cycle, which served as a reliable time marker for precisely determining the inter-pulse intervals and the instantaneous EOD rate (=IPI-1). The successive EOD peaks were joined and linearly interpolated at constant time intervals (Figure 2D top, black trace), and the instantaneous EOD rate was similarly interpolated at constant time intervals (Figure 2D bottom, pink trace). The constant-time resampling procedure facilitates the time synchronization between the motion trajectory and the EOD signal, and allows to leverage from a greater number of analytic tools for constantly sampled time-series data. The EOD amplitudes recorded at external electrodes remained constant while an animal was at rest (Figure 2E top), but it varied over time while the animal moved due to changing dipole location and orientation (Figure 2F top). Thus, the fish movement could be inferred from observing the change of EOD amplitudes over time. The baseline EOD rate remained low while fish was at rest (Figure 2E bottom), but the EOD rate became significantly higher while the fish actively swam (Figure 2F top). Our observation is consistent with the positive correlation between the EOD rate and the fish movement as previously reported8,9,34,35.

Video tracking results

The animal's trajectory and midlines are shown in Figure 3E with the first and last image frames superimposed. The time-course of posture change was captured while fish was abruptly turning for two seconds, and the fish midlines are plotted every 200 msec. The fish midline correctly started at the head-tip and terminated at the tail-tip of fish. The fish images closely agreed with the automatically tracked midlines despite of the shadows casted by the animal. Figure 3F illustrates the time-varying average EOD rate (τ=0.0625 sec) in color, which is superimposed with the time-matched trajectory of fish's head-tip. During the 2 sec turning duration, the average EOD rate reached its peak while the animal was in the middle of the turning phase, and the rate decreased toward the end of the turning. This representative result illustrates that our method can be successfully applied to study the relationship between self-guided movements and the EOD rate modulation during free-swimming.

Figure 1
Figure 1. Aquarium tank and isolation chamber setup. A) The experimental chamber consists of an anti-vibration floor, aquarium tank, and an isolation chamber. B) The aquarium tank was divided into the central arena for running experiments, and four corner compartments for housing individual fish. Each compartment was built watertight to prevent electrical communication between animals. C) The motorized gate is illustrated at multiple perspective angles. The gate becomes watertight when locked by six wing nuts which compress the rubber gasket (the light brown sheet). Once unlocked, the gate can be remotely operated by the servo motor on the top. D) The isolation chamber was assembled by joining three wall panels and four door panels, which provide access to the aquarium tank from two sides. The bottom panel illustrates the wooden rails for supporting the tank edges, and the floor heater placement. A layer of aluminum mesh covers the heater to shield its electrical noise. E) The walls and door panels of the isolation chamber were constructed from aluminum frames for structural support (3). The interior surfaces of the chamber are covered by white plastic panels (5) to reflect internal light sources, and the exteriors are covered by black plastic panels (2) to block external light sources. An aluminum mesh (1) covers the exterior walls to block external electrical noise. The wall is filled with acoustic fiberglass batts (4). F) The top photo shows the air ventilation setup for removing excess humidity generated from heating; and the bottom photo shows the water filtration setup for cleaning, diffusing, and aerating the tank water between experimental sessions. Click here to view larger image.

Figure 2
Figure 2. EOD recording setup and representative results. A) The left panel illustrates the electrode assembly consisting of a thin graphite electrode, a short segment of coaxial cable, and a BNC Jack. The right panel demonstrates electrode attachment instructions. Masking tape is used to temporarily position the electrode assembly, and silicone caulking was applied to permanently hold the electrode. B) The wiring diagram. Two 90° oriented electrodes are paired up, differentially amplified and filtered. Four recording channels were digitized outside of the Faraday cage. C) Illustration of the EOD signal processing steps. The top traces show raw waveforms from four electrodes pairs, which are rectified and summed to produce the gray trace below. Unimodal envelopes are extracted from the grey waveform using the “Root-Mean-Square” (RMS) filter (green trace). The EOD amplitudes and IPIs are determined from the envelope peaks. D) The time-varying EOD amplitudes (top) and the instantaneous EOD rate (bottom) are shown on a longer time scale than C). The EOD amplitudes and the instantaneous rate (=IPI-1) are interpolated at regular time intervals by joining the envelope peaks (black traces). E) Same as D) but plotted on a longer time scale while fish was at rest. F) Same as E) while fish was actively swimming. Click here to view larger image.

Figure 3
Figure 3. Video tracking setup and representative results. A) The lighting and camera setup is illustrated. The infrared (IR) and visible light sources are attached on the walls and pointed toward the ceiling, such that the ceiling surface reflects and diffuses the light for projecting uniform illumination over the entire tank. The camera is hidden above the ceiling panel to prevent reflection on the water surface. An IR LED is positioned at one of the four tank corners to generate time synchronization pulses. B) Generating a composite background image is illustrated. Two image frames (images on top) are combined to form the composite background image (bottom left) by replacing the region containing the animal (solid red square) with the region without the animal (dashed red square). Area outside of the central arena is masked out in black (bottom right). C) Isolating the fish outline. An image frame (top left) is subtracted from the background image (top right) to produce the difference image (bottom left), and converted to the binary image (bottom right) by applying an intensity threshold. D) Measurements of the body position and posture are illustrated. The binary image of the animal (blob) was rotated to align its major axis with the x-axis (top right), and centered at its centroid. The blob was separated to the head (red) and tail (blue) parts, and each part was separately rotated for determining its bounding-box. The blob was oriented to the animal's frame of reference (bottom left), and five feature points (head-end, mid-head, mid-body, mid-tail, tail-end) were determined from the midpoints of the bounding-box edges. E) Time-lapse image of the fish midlines plotted every 200 msec. The first and last image frames are superimposed during the 2 sec turning duration. F) The average EOD rate is represented in pseudo-color and superimposed with the trajectory of the fish head. The same images are used as in E). Click here to view larger image.

Subscription Required. Please recommend JoVE to your librarian.


Significance of our techniques. In summary, we first described the construction of a large aquarium tank and an isolation chamber to observe spontaneous exploratory behaviors produced by WEF. Next, we demonstrated the technique of recording and tracking the EOD rate and the movement states from unrestrained fish in real-time using multiple electrode pairs. Finally, we described the infrared video recording technique through water in a time-synchronized manner, and the image tracking algorithm to measure the body position and posture. As an experimental preparation, WEF offers an important advantage for investigating active sensory-guided behaviors by demonstrating readily quantifiable EOD rate, which equals to the active electrosensory sampling rate. Combination of these techniques can enable precise and reliable long-term observation8 of spontaneous behaviors from unrestrained WEF. Furthermore, the majority of our setup can be constructed from widely available building materials and easily obtainable electronic components. The techniques described here have been developed and tested to meet our experimental requirements over recent years. Therefore, we recommend these techniques for future studies of spontaneous exploratory behaviors from free-swimming WEF.

Isolation chamber. The isolation chamber provides well-controlled experimental conditions by blocking external sources of light, vibration, sound, and electrical noise with varying degrees of effectiveness. The light blocking performance was tested by placing a motorized camera inside of the dark isolation chamber, and no external light leakage was observed from the camera after scanning all locations using remote pan control. The vibration damping surface installed under the tank provided attenuation against external vibrations channeled from the floor, and stacking of multiple rubber and foam layers was effective for blocking most external vibration events. However, intermittent vibration events such as loud door closing at nearby locations did trigger novelty responses in rare occasions. Although an anti-vibration air table could deliver superior isolation performance from background vibrations, it would be prohibitively expensive to purchase an air table large enough for our aquarium tank. Therefore, we placed a hydrophone underwater to detect and exclude events when large external vibrations triggered novelty responses. To further minimize the influence of noise outside of the laboratory, our experiments were conducted during off-peak hours (after 6 pm). Similarly, external airborne acoustic noise was attenuated via the isolation chamber walls filled with fiberglass batts insulation. Although we did not objectively quantify the sound attenuation performance, most of the background sound in a lab environment did not trigger the novelty responses. In rare occasions, a sudden loud sound from the outside triggered a novelty response; but such an event was detected by the hydrophone recording, and they rarely occurred during off-peak hours. The aquarium tank provided sufficiently large area for our animals to freely swim and explore. The tank size was chosen in proportion to the length of species we used (up to 30 cm), but the tank size can be scaled down if smaller animals were used. We chose Gymnotus sp. among different pulse-type species for their large skull size to facilitate electrophysiological recordings during free-swimming36. The electrical recording quality may improve from using more costly copper meshes, and shielding the exhaust fan used for the humidity control.

EOD measurement technique. Our multi-channel EOD recording technique permitted accurate and reliable EOD timing measurement from freely swimming fish. Using our technique, all EOD pulses generated by freely swimming WEF were detected without missing or adding a single pulse for a six-hour long recording duration (see Figure 12 in Jun et al.8). The EOD recording measures not only the EOD rate, but also the activity level from the time varying EOD peak amplitudes recorded at external electrodes. The recorded EOD amplitudes are determined by the relative geometry between an animal and the recording electrodes, thus animal movements induce changes in the EOD amplitudes (Figure 2F). The activity level was computed from the variability (RMS) of the EOD amplitude slope within a moving window (0.5 sec). Using this method, video recording would not be required for measuring the activity level over a long time period, and the EOD recording alone may be suffice. Instead of using a video recording, the body position and posture of WEF can be inferred from the EOD recording alone based on the electrodes locations, the geometry of a tank, and a theoretical model of a current dipole. Using a similar recording setup, Jun et al.20 proposed a real-time electrical tracking method for tracking multiple WEFs in presence of an object, which compares measured signal intensities at multiple recording electrode pairs with lookup table entries containing predicted signal intensities at known current dipole locations. The electrical tracking method offers improved tracking reliability in a visually cluttered environment where animals often get obstructed from view, or during tracking multiple animals. WEF's naturalistic habitats contain many visual obstacles such as aquatic plants and roots, where the electrical tracking method could provide more reliable tracking with simpler setup requirements than visual tracking. In principal, our method is directly applicable to the wave-type WEF species after changing filter time constants. The rectification step will introduce two modes per EOD cycle, since the EOD waveform is approximately sinusoidal in wave-type species. In this case, the instantaneous EOD rate can be determined by skipping every other EOD time markers to ignore the negative EOD phase. WEF can detect the recording electrodes when they swim nearby; thus we avoided using large or metallic electrodes which can be sensed from farther away37, and instead used thin graphite electrodes (2 mm diameter). Thinner coaxial cables (RG-174) were used with the electrode assemblies for flexibility; but thicker coaxial cables (RG-54) were used for wiring over extended distances for superior electrical shielding. Longer EOD recording duration can be achieved by lowering the sampling rate, but at a lower temporal resolution as a trade-off. The mean and variability of the EOD rate varies between species, thus the time window for smoothing the instantaneous EOD rate needs to be adjusted appropriately. A shorter time window is recommended for species having shorter mean and smaller variability in the IPIs (e.g. Gymnotiforms), and a longer time window is recommended for species having longer mean and higher variability in the IPIs (e.g. Mormyrids).

Lighting and camera setup. Video recordings provide quantitative and qualitative behavioral observations, and here we described the procedures for setting up, recording, and processing the image data. Lighting setup plays an important role in producing high quality images, and the light projection angle is an important factor for imaging underwater animals. Under suboptimal lighting conditions, the water surface can form glares and reflections, which can interfere with the image tracking especially when animals generate surface waves. The glare and reflection problems can be eliminated by projecting light sources from the bottom of a tank. For a small tank, arrays of LED can be placed directly underneath the tank and shine through a diffuser panel to generate uniform light intensity38. Similarly for a larger tank, a light source can be placed below the tank, and uniform light intensity can be achieved by allowing sufficient distance for light to diffuse39. In our setup, we were forced to project the light from above the tank due to space constraints, structural stability, and the heater placement underneath the tank. We avoided the glare and reflection problems by using indirect lighting, such that the light sources were projected toward the ceiling. By rendering the top portion of the chamber featureless and matt white, no reflections were visible on the water surface. To image the whole central arena, a wide angle lens can be mounted on the camera, but some lenses (fish-eye lens) may cause significant barrel distortion. The barrel distortion can be corrected by using a calibration grid sheet underneath the tank to measure the pixel coordinates of the grid locations viewed at the tank center. Together with the corresponding grid locations in centimeters, a transformation matrix can be computed to correct the barrel distortion40. We recommend high resolution cameras if an animal size is much smaller than the tank size, so that sufficient number of pixels can be obtained from the animal to correctly measure its body posture.

Image tracking and time synchronization. The image tracking algorithm described here makes use of the region-of-interest (ROI) operation to quickly measure the body position and posture. The ROI operation reduces the image size to be processed, and constrains the tracking range near the animal location from the previous frame. We extracted the body posture (midline) by using the image rotation and bounding-box operations instead of the usual image skeletonization operation, which sometimes failed to produce a well-defined single midline. The animal's frame of reference was located at the middle of the head bounding-box, which permits egocentric behavioral analysis. The major source of error in the image tracking was due to the optical projection effect at a wide angle. Ideally, animal's vertical movements should not affect the 2D position measurement; but the further away from the central imaging axis, the greater portion of the vertical dimension is projected to the camera. The refraction at the water surface reduced the optical projection effect by 28% in our imaging setup (camera height = 1.8 m, water depth = 10 cm, tank radius = 75 cm); and the worst position error was ±1.4 cm at the circular fence. The timing between the EOD and video recordings were synchronized using infrared LED pulses to account for the time drift between the video and the signal digitizer clocks, and different recording startup times. The expected uncertainty in the time synchronization between the video and EOD recordings is proportional to the frame capture interval; for example, 15 frames per sec (fps) frame capture rate will result in the time alignment uncertainty of ±33 msec. Such degree of time precision is adequate for tracking slower moving fish, but a high-speed camera may be required for tracking faster moving animals. We recommend brighter light intensity with an increased frame rate, since the sensor exposure time is inversely proportional to the frame rate.

Future work. Social interactions between multiple WEFs can be studied by tracking their EOD signals and body locations, and the tracking system must correctly associate the EOD with the location of the same individual. According to the dipole localization method described by Jun et al.20 a using similar setup, the animal locations inferred by their EOD signals received at multiple electrodes can be matched to the visual tracking output for correctly identifying the EOD pulses from different individuals. Image tracking of multiple animals can be performed one individual at a time using the ROI operation. A ROI can be initially defined around an individual to be tracked, and the ROI will be repositioned at every frame with an updated body position. The other fish will be excluded from the image tracking analysis when it appears outside of the ROI; and if appeared inside, the other fish's image can be automatically removed by checking whether its image touches the ROI boundary. Sometimes, two animals contact each other and their images merge; and if so, a mask can be manually drawn to separate the other fish's image. Another interesting future work is the three-dimensional video tracking to reveal intricate movement sequences during prey capture22 or social interactions. MacIver et al.22 used two cameras to view a rectangular aquarium tank from the top and the side for reconstructing a three-dimensional body model. However, this approach would not work in our case, since there are partitioning walls that block side views and the aquarium has much greater width than depth. Instead, it would be more applicable to install multiple cameras on the ceiling at different perspective angles similar to the setup used by Hedrick41. For greater accuracy, the refractive effect introduced by the water and the oblique camera angle would have to be corrected by calibrating images in three dimensions. Our visual tracking method could be applied to study the electric image flow on fish's body surface42,43 when fish swims nearby an object. As studied by Hofmann et al.26, it would be interesting to investigate the object's electric image flow during free-swimming depending on the object distance, shape, size, and material. Ultimately, our methods combined with neural recordings from freely swimming fish44-46 may reveal novel insights by observations of changes in neural activity and EOD rate while the fish engages in object exploration or social interactions.

Subscription Required. Please recommend JoVE to your librarian.


The authors have nothing to disclose.


This work was generously supported by the Natural Sciences and Engineering Research Council of Canada (NSERC) and the Canadian Institutes of Health Research (CIHR).


Name Company Catalog Number Comments
Aquarium Construction
Electrically shielded floor heater ThermoSoft Corp., IL, USA ThermoTile www.thermosoft.com
Tempered glass panel generic 0.5 in thick, used for the aquarium construction
Aquarium grade silicone generic  
Acrylic sheet generic 0.25 in thick, matte white
Natural rubber sheet generic 0.25 in thick
Servomotor HTECHRCD Inc., Korea HS-325HB, 180deg rotation www.servocity.com
Servomotor arm mount HITECHRCD Inc., Korea 56362 Large Spline www.servocity.com
Servomotor controller (6 channels) Sparkfun ROB-09664 Micro Maestro 6-channel USB Servo Controller
Active USB extension cable C2G 38990 12 m USB 2.0 A Male to A Female 4-Port Active Extension Cable
Exhaust fan Nutone ILFK120 www.homedepot.com
Vertical aquarium filter Tetra, Germany Whisper Internal Power Filter - 40i  
Crushed coral Used to increase the pH of the tank water
EOD Recording Setup
Graphite Electrodes Staedtler, Germany Mars Carbon 2-mm type HB Shave the outer coating
Physiological Amplifier/Filter Intronix, Canada 2015F  
Coaxial Cable generic RG174 For electrodes assembly
Coaxial Cable generic RG54 For wiring use
BNC jack connector for RG-174 Amphenol Connex 112160 For electrodes assembly
BNC plug connector for RG-54 Amphenol Connex 112116 For wiring use
Signal digitizer hardware Cambridge Electronic Design, UK Power MKII 1401  
Signal digitizer software Cambridge Electronic Design, UK Spike 2. ver 7  
Visual Tracking Setup
White LED light IKEA, Sweden DIODER 201.194.18 www.ikea.com
Infrared LED light (850 nm) Scene Electronics, China S8100-60-B/C-IR Remove built-in fan
USB webcam Logitech Inc., CA, USA C910 Remove Infrared blocking filter
Motorized camera Logitech Inc., CA, USA Quickcam Orbit Remove Infrared blocking filter
Video recording software Logitech Inc., CA, USA Logitech Quickcam Software Download from www.logitech.com
MATLAB Mathworks, MA, USA 2012a Image processing toolbox



  1. Miyawaki, A., et al. Fluorescent indicators for Ca2+ based on green fluorescent proteins and calmodulin. Nature. 388, (6645), 882-887 (1997).
  2. Boyden, E. S., Zhang, F., Bamberg, E., Nagel, G., Deisseroth, K. Millisecond-timescale, genetically targeted optical control of neural activity. Nat. Neurosci. 8, (9), 1263-1268 (2005).
  3. Adamantidis, A. R., Zhang, F., Aravanis, A. M., Deisseroth, K., De Lecea, L. Neural substrates of awakening probed with optogenetic control of hypocretin neurons. Nature. 450, (7168), 420-424 (2007).
  4. Naumann, E. A., Kampff, A. R., Prober, D. A., Schier, A. F., Engert, F. Monitoring neural activity with bioluminescence during natural behavior. Nat. Neurosci. 13, (4), 513-520 (2010).
  5. Leifer, A. M., Fang-Yen, C., Gershow, M., Alkema, M. J., Samuel, A. D. Optogenetic manipulation of neural activity in freely moving Caenorhabditis elegans. Nat. Methods. 8, (2), 147-152 (2011).
  6. Mavoori, J., Millard, B., Longnion, J., Daniel, T., Diorio, C. A miniature implantable computer for functional electrical stimulation and recording of neuromuscular activity. In IEEE international workshop on biomedical circuits and systems (BioCAS) 2004; Session: Functional Electrical Stimulators and Related Sensing Techniques. (2004).
  7. Harrison, R. R., Fotowat, H., Chan, R., Kier, R. J., Olberg, R., Leonardo, A., Gabbiani, F. Wireless neural/EMG telemetry systems for small freely moving animals. IEEE TBioCAS. 5, (2), 103-111 (2011).
  8. Jun, J. J., Longtin, A., Maler, L. Precision measurement of electric organ discharge timing from freely moving weakly electric fish. J. Neurophys. 107, (7), 1996-2007 (2012).
  9. Forlim, C. G., Pinto, R. D. Noninvasive Realistic Stimulation/Recording of Freely Swimming Weakly Electric Fish: Movement Detection and Discharge Entropy to Infer Fish Behavior. (2012).
  10. Caputi, A. A., Aguilera, P. A., Castelló, M. E. Probability and amplitude of novelty responses as a function of the change in contrast of the reafferent image in G. carapo. J. Exp. Biol. 206, (6), 999-1010 (2003).
  11. Pluta, S. R., Kawasaki, M. Multisensory enhancement of electromotor responses to a single moving object. J. Exp. Biol. 211, (18), 2919-2930 (2008).
  12. Heiligenberg, W. Electrolocation and jamming avoidance in a Hypopygus (Rhamphichthyidae, Gymnotoidei), an electric fish with pulse-type discharges. J. Comp. Phys. A. 91, (3), 223-240 (1974).
  13. Capurro, A., Malta, C. P. Noise autocorrelation and jamming avoidance performance in pulse type electric fish. Bull. Math. Biol. 66, (4), 885-905 (2004).
  14. Post, N., von der Emde, G. The "novelty response" in an electric fish: response properties and habituation. Phys. Behav. 68, (1), 115-128 (1999).
  15. Toerring, M. J., Serrier, J. Influence of water temperature on the electric organ discharge (EOD) of the weakly electric fish Marcusenius cyprinoides (Mormyridae). J. Exp. Biol. 74, (1), 133-150 (1978).
  16. Ardanaz, J. L., Silva, A., Macadar, O. Temperature sensitivity of the electric organ discharge waveform in Gymnotus carapo. J. Comp. Phys. A. 187, (11), 853-864 (2001).
  17. Rodríguez-Cattaneo, A., Pereira, A. C., Aguilera, P. A., Crampton, W. G., Caputi, A. A. Species-specific diversity of a fixed motor pattern: the electric organ discharge of Gymnotus. PLoS One. 3, (5), (2008).
  18. Bennett, M. V. L. Fish physiology. Hoar, W. S., Randall, D. J. Academic Press. NY. 493-574 (1971).
  19. Wong, C. J. Afferent and efferent connections of the diencephalic prepacemaker nucleus in the weakly electric fish, Eigenmannia virescens: interactions between the electromotor system and the neuroendocrine axis. J. Comp. Neurol. 383, (1), 18-41 (1997).
  20. Jun, J. J., Longtin, A., Maler, L. Real-time localization of moving dipole sources for tracking multiple free-swimming weakly electric fish. PLoS One. 8, (6), (2013).
  21. Rasnow, B., Assad, C., Hartmann, M. J., Bower, J. M. Applications of multimedia computers and video mixing to neuroethology. J. Neuro. Methods. 76, (1), 83-91 (1997).
  22. MacIver, M. A., Nelson, M. E. Body modeling and model-based tracking for neuroethology. J. Neuro. Methods. 95, (2), 133-143 (2000).
  23. Douglas, R. H., Hawryshyn, C. W. Behavioral studies of fish vision: an analysis of visual capabilities. In The Visual System of Fish. Douglas, R., Djamgoz, M. Chapman & Hall. London. 373-418 (1990).
  24. Ciali, S., Gordon, J., Moller, P. Spectral sensitivity of the weakly discharging electric fish Gnathonemus petersi using its electric organ discharges as the response measure. J. Fish Biol. 50, (5), 1074-1087 (1997).
  25. Ratledge, D. An Introduction to Webcam Imaging. Digital Astrophotography: The State of the Art. 31-44 (2005).
  26. Hofmann, V., Sanguinetti-Scheck, J. I., Gómez-Sena, L., Engelmann, J. From static electric images to electric flow: Towards dynamic perceptual cues in active electroreception. J. Phys. Paris. 107, 95-106 (2013).
  27. Castelló, M. E., Aguilera, P. A., Trujillo-Cenóz, O., Caputi, A. A. Electroreception in Gymnotus carapo: pre-receptor processing and the distribution of electroreceptor types. J. Exp. Biol. 203, (21), 3279-3287 (2000).
  28. Caputi, A. A., Castelló, M. E., Aguilera, P., Trujillo-Cenóz, O. Electrolocation and electrocommunication in pulse gymnotids: signal carriers, pre-receptor mechanisms and the electrosensory mosaic. J. Phys. 96, (5), 493-505 (2002).
  29. Pusch, R., et al. Active sensing in a mormyrid fish: electric images and peripheral modifications of the signal carrier. J. Exp. Biol. 211, (6), 921-934 (2008).
  30. Harder, W. Die beziehungen zwischen elektrorezeptoren, elektrischem organ, seitenlinienorganen und nervensystem bei den Mormyridae (Teleostei, Pisces). Z. Vgl. Physiol. 59, (3), 272-318 (1968).
  31. Bacelo, J., Engelmann, J., Hollmann, M., Gvonder Emde,, Grant, K. Functional foveae in an electrosensory system. J. Comp. Neurol. 511, (3), 342-359 (2008).
  32. Hollmann, M., Engelmann, J., Von Der Emde, G. Distribution, density and morphology of electroreceptor organs in mormyrid weakly electric fish: anatomical investigations of a receptor mosaic. J. Zool. 276, (2), 1469-7998 (2008).
  33. Knudsen, E. I. Spatial aspects of electric fields generated by weakly electric fish. J. Comp. Phys. 99, (2), 103-118 (1975).
  34. Kramer, B. Spontaneous discharge rhythms and social signalling in the weakly electric fish Pollimyrus isidori (Cuvier et Valenciennes) (Mormyridae, Teleostei). Behav. Ecol. Sociobiol. 4, (1), 66-74 (1978).
  35. Stoddard, P. K., Markham, M. R., Salazar, V. L., Allee, S. Circadian rhythms in electric waveform structure and rate in the electric fish Brachyhypopomus pinnicaudatus. Physiol. Behav. 90, (1), 11-20 (2007).
  36. Canfield, J. G. Methods for chronic neural recording in the telencephalon of freely behaving fish. J. Neurosci. Methods. 133, (1-2), 127-134 (2004).
  37. Chen, L., House, J. L., Krahe, R., Nelson, M. E. Modeling signal and background components of electrosensory scenes. J. Comp. Physiol. A. 191, (4), 331-345 (2005).
  38. Emran, F., Rihel, J., Dowling, J. E. A Behavioral Assay to Measure Responsiveness of Zebrafish to Changes in Light Intensities. J. Vis. Exp. (20), (2008).
  39. Windsor, S. P., Tan, D., Montgomery, J. C. Swimming kinematics and hydrodynamic imaging in the blind Mexican cave fish (Astyanax fasciatus). J. Exp. Biol. 211, (18), 2950-2959 (2008).
  40. Shapiro, L. G., Stockman, G. C. Computer vision. Prentice Hall. Upper Saddle River, NJ. 367-368 (2001).
  41. Hedrick, T. L. Software techniques for two- and three-dimensional kinematic measurements of biological and biomimetic systems. Bioinsp. Biomim. 3, (3), 034001 (2001).
  42. Babineau, D., Lewis, J. E., Longtin, A. Spatial acuity and prey detection in weakly electric fish. PLoS Comp. Biol. 3, (3), (2007).
  43. Sanguinetti-Scheck, J. I., Pedraja, E. F., Cilleruelo, E., Migliaro, A., Aguilera, P., Caputi, A. A., Budelli, R. Fish geometry and electric organ discharge determine functional organization of the electrosensory epithelium. PLoS One. 6, (11), (2011).
  44. Castello, M. E., Caputi, A., Trujillo‐Cenóz, O. Structural and functional aspects of the fast electrosensory pathway in the electrosensory lateral line lobe of the pulse fish Gymnotus carapo. J. Comp. Neurol. 401, (4), 549-563 (1998).
  45. Canfield, J. G., Mizumori, S. J. Y. Methods for chronic neural recording in the telencephalon of freely behaving fish. J. Neurosci. Methods. 133, (1), 127-134 (2004).
  46. Pereira, A. C., Centurión, V., Caputi, A. A. Contextual effects of small environments on the electric images of objects and their brain evoked responses in weakly electric fish. J. Exp. Biol. 208, (5), 961-972 (2005).



    Post a Question / Comment / Request

    You must be signed in to post a comment. Please or create an account.

    Usage Statistics