nirspipe.qc.metrics.imu#
Motion measured by the IMU: its summary over a stretch, per window, and its agreement with GVTD.
The IMU is the one record of movement not taken from the optical data, and its numbers
mirror the GVTD family (mean and p95, per run, per condition and per window). The traces come from
imu_traces(); nothing here reads a file.
Module Contents#
Functions#
Mean and 95th percentile of each IMU magnitude between |
|
Mean and p95 of each IMU magnitude per window, on the grid the GVTD series use. |
|
Spearman rho between GVTD and each IMU magnitude, frame by frame. |
|
The run’s |
Data#
API#
- nirspipe.qc.metrics.imu.IMU_QUANTITIES = None#
- nirspipe.qc.metrics.imu.IMU_STAT_KEYS = ('gyro_speed_mean', 'gyro_speed_p95', 'accel_jerk_mean', 'accel_jerk_p95')#
- nirspipe.qc.metrics.imu.AGREEMENT_HALF_WINDOW_S = 1.0#
- nirspipe.qc.metrics.imu.imu_scalars(imu: dict, t0: float, t1: float) dict[str, float]#
Mean and 95th percentile of each IMU magnitude between
t0andt1.{"gyro": ImuTrace(t, |omega|, "°/s")}, 0.0, 300.0 -> {"gyro_speed_mean": 1.4, "gyro_speed_p95": 5.2, "accel_jerk_mean": None, "accel_jerk_p95": None}
A sensor the recording lacks, or one with no sample in the stretch, stays None.
- nirspipe.qc.metrics.imu.imu_windowed(imu: dict, times: numpy.ndarray, sfreq: float, window_s: float) dict[str, list[float]]#
Mean and p95 of each IMU magnitude per window, on the grid the GVTD series use.
timesandsfreqare the optical recording’s, so windowihere is windowiofgvtd_per_windowand both read offgvtd_window_times_s:{"gyro": ...}, 400 s at 10 Hz, 10 s windows -> {"gyro_speed_per_window": [40 values], "gyro_speed_p95_per_window": [40 values]}
A window the sensor has no sample in is NaN rather than dropped, which would shift every later window onto the wrong time.
- nirspipe.qc.metrics.imu.imu_gvtd_agreement(imu: dict, gvtd: numpy.ndarray, gvtd_times: numpy.ndarray) dict[str, float]#
Spearman rho between GVTD and each IMU magnitude, frame by frame.
Each GVTD frame is paired with the IMU averaged over
AGREEMENT_HALF_WINDOW_Seither side of it, about the smear the motion band puts on a movement; frames the IMU does not cover are left out. A sensor with fewer than three paired frames, or a side that never varies, has no rank order and stays None.
- nirspipe.qc.metrics.imu.imu_section(imu: dict, raw: mne.io.Raw, sep_bands=None) dict[str, Any]#
The run’s
imurecord section: the summaries, their units and the agreement.Summarised over the optical recording’s span, and ranked against the motion-band GVTD of the channel set a run is judged on, so the number reads beside
gvtd_filt_mean.rawis intensity or optical density.