Anaropia
This module provides functions to import and preprocess data collected from the Anaropia virtual reality software package.
- balancepy.anaropia.getdata_anaropia(filename, body_height=0, resample=True, samplingrate_Hz=90, stimulus='Screen', direction='ap', cut_to_cycles=True, end_time=260, cycle_start_samples=1800, cycle_length_samples=1800)
Access and format data from balance experiments recorded with Anaropia.
Reads data recorded using the Anaropia virtual-reality application for balance experiments. Calculates stimulus and center of mass (COM) data.
- Parameters:
filename (str) – Path and filename to be analyzed.
body_height (float, optional) – Height of subject in meters.
resample (bool, optional) – If True, resample data to samplingrate_Hz.
samplingrate_Hz (int, optional) – Desired sampling rate in Hz.
stimulus (str, optional) – Name of the stimulus column in the data file.
cut_to_cycles (bool, optional) – If True, cut data to cycles.
end_time (float, optional) – End time of the experiment in seconds for resampling.
cycle_start_samples (int, optional) – Start of the first cycle in samples.
cycle_length_samples (int, optional) – Cycle length in samples.
- Return type:
ndarray
[tuple
[int
,...
],dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]- Returns:
com (NDArray) – Experimental center of mass sway in anterior-posterior direction.
stim (NDArray) – Stimulus data.
time (NDArray) – Time data.
- balancepy.anaropia.getdata_legacy(filename, body_height, resample=True, cut_to_cycles=True, sampling_rate=90, end_time=220, cycle_start_samples=1800, cycle_length_samples=1800, stimulus='stim_pitch')
Access and format data from balance experiments recorded with Anaropia legacy.
Reads data recorded using the legacy software version of Anaropia for balance experiments. Calculates stimulus and center of mass (COM) data.
- Parameters:
filename (str) – Path and filename to be analyzed.
body_height (float) – Height of subject in meters.
resample (bool, optional) – If True, resample data to sampling_rate.
cut_to_cycles (bool, optional) – If True, cut data to cycles.
sampling_rate (int, optional) – Desired sampling rate in Hz.
end_time (float, optional) – End time of the experiment in seconds for resampling.
cycle_start_samples (int, optional) – Start of the first cycle in samples.
cycle_length_samples (int, optional) – Cycle length in samples.
stimulus (str, optional) – Name of the stimulus column in the data file.
- Return type:
ndarray
[tuple
[int
,...
],dtype
[TypeVar
(_ScalarType_co
, bound=generic
, covariant=True)]]- Returns:
com (NDArray) – Experimental center of mass sway in anterior-posterior direction.
stim (NDArray) – Stimulus data.
time (NDArray) – Time data.
- balancepy.biomechanics.get_com(shoulder_t, shoulder_marker_height, hip_t, hip_marker_height, height_m, rotation=True)
Calculate center of mass (COM) from hip and shoulder movement.
The function uses a 2-segment model and anthropometric tables.
- Parameters:
shoulder_t (NDArray[np.number]) – 1D array of shoulder translation in meters.
shoulder_marker_height (np.number) – Shoulder marker height above support surface in meters. Can be a single value or an array.
hip_t (NDArray[np.number]) – 1D array of hip anterior-posterior translation in meters.
hip_marker_height (np.number) – Hip marker height above support surface in meters. Can be a single value or an array.
height_m (float) – Height of subject in meters.
rotation (bool, optional) – If False, returns COM translation in meters. If True, returns COM rotation about ankle joints in degrees.
- Returns:
1D array of center of mass (COM) values.
- Return type:
NDArray