bemobil_mne.preproc.process_rigid_body#
- bemobil_mne.preproc.process_rigid_body(raw, rb_names=None, lowpass_orient=8.0, lowpass_pos=8.0, lowpass_deriv=24.0, compute_velocity=True, compute_acceleration=True, sfreq_target=None)[source]#
Process rigid body motion capture streams.
For each rigid body found in raw:
Optionally low-pass filter the orientation (and position) signals.
Convert quaternions to Euler angles (ZYX convention = yaw-pitch-roll) if quaternion channels are present. The source quaternion channels are dropped and replaced by Euler angle channels.
Compute the first derivative (velocity) via finite differences, with an optional low-pass filter applied after differentiation.
Compute the second derivative (acceleration) in the same way.
Derivative channels are appended to the returned raw object with the naming scheme
<rb>_<type>_vel_<axis>and<rb>_<type>_acc_<axis>, where type iseulorposso that orientation and position derivatives always have distinct names (e.g.head_eul_vel_x,head_pos_vel_x).- Parameters:
- raw
mne.io.BaseRaw Source recording. Motion channels should be of type
"misc"(which is the default when XDFLoader imports non-EEG streams).- rb_names
listofstr|None Rigid body identifiers to process. If
None, all identifiers found byfind_rigid_bodies()are processed.- lowpass_orient
float|None Low-pass cutoff (Hz) applied to orientation channels.
Noneskips this filter.- lowpass_pos
float|None Low-pass cutoff (Hz) applied to position channels.
Noneskips.- lowpass_deriv
float|None Low-pass cutoff (Hz) applied to velocity and acceleration channels after differentiation.
Noneskips.- compute_velocitybool
Whether to compute and append velocity channels.
- compute_accelerationbool
Whether to compute and append acceleration channels.
- sfreq_target
float|None If not
None, resample motion channels to this rate before differentiation. Useful to match the EEG sample rate.
- raw
- Returns:
- raw_out
mne.io.Raw Copy of raw with quaternion channels replaced by Euler channels and velocity / acceleration channels appended.
- rb_info
dict Per-rigid-body processing summary:
{rb_name: {"mode": "quat"|"euler", "channels": list[str]}}.
- raw_out