MATLAB pipeline that turns raw Vicon .c3d motion-capture files into the
position data needed for beam-pattern analysis: microphone positions,
maze geometry, and the bat flight trajectory, all in the Vicon
global coordinate frame (mm).
This is the position half of the Vicon + Avisoft pipeline. Its two data
outputs — the per-session mic position file and the per-trial bat_pos file — are later used in Beam pattern analysis.
Entry point: run_position_processing.m or master_position_processing.mlx (run either one). Set the config block
at the top, then run:
date_data = '20260623'; % capture date, yyyyMMdd
batID = 'batA125'; % which bat
Mic_marker_distance = 35; % mm from base marker to actual mic
floating_mic_ids = [5 8 10 11 13 16]; % mic numbers that are movable, not wall-mountedPath requirement: both this folder and position_processing\landmark
must be on the MATLAB path (Home → Set Path → Add Folder).
The 5 steps:
- Mic positions —
mic_landmarks()builds (or reuses) the per-session mic landmark file from raw.c3dcaptures, thenextract_mic_location()extrapolates the actual mic position and pointing vector. - Maze structure —
extract_maze_structure()readsy-maze_layout.json. - Bat trajectory —
extract_bat_pos()pulls the bat marker track from the selected trial.c3d. - Save
bat_pos—save_bat_pos()writes a Beampattern_analysis-ready.mat(see Outputs). - Plot —
plot_bat_trajectory()draws 3D / top / side / time / speed figures. Plotting only; it writes no data.
| Folder | What's in it |
|---|---|
Mic_positions\ |
Final computed mic files only: extract_mic_location.m writes mic_pos_<date>.csv/.mat (actual mic position + pointing vector, plus mic_loc/mic_vec aliases for Beampattern_analysis). The raw <date>_mic_loc landmark files live in landmark\mic_landmark_output\. |
Bat_Position\ |
Per-trial bat_pos files: <batID>_<date>_<trial>_bat_pos.mat. |
plot\ |
Saved figures / trajectory images only. No data files. |
landmark\ |
Step-1 mic-landmark sub-pipeline (fixed + floating passes). Writes its raw <date>_mic_loc.csv/.mat into landmark\mic_landmark_output\. Has its own README.md. |
y-maze_layout.json |
Maze landmark coordinates (walls, start line, take-off perch). |
archive\, ezc3d_matlab\, legacy\ |
Superseded material and the ezc3d .c3d reader dependency. |
bat_pos (1×1 cell → [n_frames × 3], NaNs preserved), markers,
frame_rate, maze, tp_position, lp_position, bat_marker_idx,
selection_method, source_file.
run_position_processing.m— top-level driver (steps 1–5 above).extract_mic_location.m— mic landmark file → actual mic position + pointing vector; writes toMic_positions\.extract_maze_structure.m— parsesy-maze_layout.json.extract_bat_pos.m— bat marker trajectory from a trial.c3d.save_bat_pos.m— writes thebat_pos.mattoBat_Position\.plot_bat_trajectory.m— all diagnostic figures.landmark\— the mic-landmark sub-pipeline (see its README).
Beampattern_analysis's bp_proc.m loads the Bat_Position\*.mat track and
the Mic_positions\ mic file (via the mic_loc / mic_vec aliases). Not
produced here on purpose: mic_gain and mic_vh (recorder/calibration
values) — merge those in on the audio side.