Communication (.com)
Communication (.com)#
Contains functions for reading data from any worklab device. If you abide by regular naming conventions you will only need the load function which will infer the correct function for you. You can also use device-specific load functions if needed.
- worklab.com.load(filename='')[source]#
Attempt to load a common data format.
Most important function in the module. Provides high level loading function to load common data formats. If no filename is given will try to load filename using a file dialog. Will try to infer data source from filename. Try to use a specific load function if load cannot infer the datatype.
- Parameters
filename (str) – name or path to file of interest
- Returns
data – raw data, format depends on source, but is usually a dict or pandas DataFrame
- Return type
pd.DataFrame
See also
load_bike
,load_esseda
,load_hsb
,load_n3d
,load_opti
,load_optitrack
,load_imu
,load_spiro
,load_spline
,load_sw
,load_opti_offset
- worklab.com.load_bike(filename)[source]#
Load bicycle ergometer data from LEM datafile.
Loads bicycle ergometer data from LEM to a pandas DataFrame containing time, load, rpm, and heart rate (HR).
- Parameters
filename (str) – full file path or file in existing path from LEM Excel sheet (.xls)
- Returns
data – DataFrame with time, load, rpm, and HR data
- Return type
pd.DataFrame
- worklab.com.load_drag_test(filename)[source]#
Loads a drag test file.
Loads drag test data (angle and force) from an ADA .txt file.
- Parameters
filename (str) –
- Returns
dragtest – DataFrame with angles and corresponding forces.
- Return type
pd.DataFrame
- worklab.com.load_esseda(filename)[source]#
Loads HSB ergometer data from LEM datafile.
Loads ergometer data measured with LEM and returns the data in a dictionary for the left and right module with a DataFrame each that contains time, force (on wheel), and speed.
- Parameters
filename (str) – full file path or file in existing path from LEM Excel sheet (.xls)
- Returns
data – dictionary with DataFrame for left and right module
- Return type
dict
See also
load_wheelchair
Load wheelchair information from LEM datafile.
load_spline
Load calibration splines from LEM datafile.
- worklab.com.load_hsb(filename)[source]#
Loads HSB ergometer data from HSB datafile.
Loads ergometer data measured with the HSBlogger2 and returns the data in a dictionary for the left and right module with a DataFrame each that contains time, force, and speed. HSB files are generally only for troubleshooting and testing that is beyond the scope of LEM.
- Parameters
filename (str) – full file path or file in existing path from HSB .csv file
- Returns
data – dictionary with DataFrame for left and right module
- Return type
dict
- worklab.com.load_imu(root_dir, filenames=None, inplace=False)[source]#
Import NGIMU session in nested dictionary with all devices with all sensors. Translated from xio-Technologies.
- Parameters
root_dir (str) – directory where session is located
filenames (list, optional) – list of sensor names or single sensor name that you would like to include, only loads sensor if not specified
inplace (bool, default False) – Whether to modify the DataFrame rather than creating a new one.
- Returns
sessiondata – returns nested object sensordata[device][dataframe]
- Return type
dict
References
https://github.com/xioTechnologies/NGIMU-MATLAB-Import-Logged-Data-Example
- worklab.com.load_movesense(root_dir, right=None, frame=None, left=None)[source]#
Imports MoveSense data in nested dictionary with all sensors.
- Parameters
root_dir (str) – directory where session is located
right (str) – 12 digit identity code of right sensor
frame (str) – 12 digit identity code of frame sensor
left (str) – 12 digit identity code of left sensor
- Returns
sessiondata – returns nested object sensordata[device][dataframe]
- Return type
dict
- worklab.com.load_n3d(filename, verbose=True)[source]#
Reads NDI-Optotrak data files
- Parameters
filename (str) – Optotrak data file (.n3d)
verbose (bool) – Print some information about the data from the file. If True (default) it prints the information.
- Returns
optodata – Multidimensional numpy array with marker positions (in m) in sample x xyz x marker dimensions.
- Return type
ndarray
- worklab.com.load_opti(filename, rotate=True)[source]#
Loads Optipush data from .data file.
Loads Optipush data to a pandas DataFrame, converts angle to radians, and flips torque (Tz). Returns a DataFrame with:
Column
Data
Unit
time
sample time
s
fx
force on local x-axis
N
fy
force on local y-axis
N
fz
force on local z-axis
N
mx
torque around x-axis
Nm
my
torque around y-axis
Nm
torque
torque around z-axis
Nm
angle
unwrapped wheel angle
rad
Note
Optipush uses a local coordinate system, option to rotate Fx and Fy available in >1.6
- Parameters
filename (str) – filename or path to Optipush .data (.csv) file
rotate (bool) – whether or not to rotate from a local rotating axis system to a global non-rotating one, default is True
- Returns
opti_df – Raw Optipush data in a pandas DataFrame
- Return type
pd.DataFrame
See also
load_sw
Load measurement wheel data from a SMARTwheel
- worklab.com.load_opti_offset(filename)[source]#
Loads Offset Optipush data from .xls file.
Loads Offset Optipush data to a pandas DataFrame, converts angle to radians, and flips torque (Tz). Returns a DataFrame with:
Column
Data
Unit
fx
force on local x-axis
N
fy
force on local y-axis
N
fz
force on local z-axis
N
mx
torque around x-axis
Nm
my
torque around y-axis
Nm
torque
torque around z-axis
Nm
angle
unwrapped wheel angle
rad
Note
Optipush uses a local coordinate system
- Parameters
filename (str) – filename or path to Optipush offset .xls (.csv) file
- Returns
offset_opti_df – Offset Optipush data in a pandas DataFrame
- Return type
pd.DataFrame
- worklab.com.load_optitrack(filename, include_header=False)[source]#
Loads Optitrack marker data.
- Parameters
filename (str) – full path to filename or filename in current path
include_header (bool) – include the header in the output, default is False
- Returns
marker_data – Marker data in dictionary, metadata in dictionary
- Return type
dict
- worklab.com.load_spiro(filename)[source]#
Loads COSMED spirometer data from Excel file.
Loads spirometer data to a pandas DataFrame, converts time to seconds (not datetime), computes energy expenditure, computes weights from the time difference between samples, if no heart rate data is available it fills the column with np.NaNs. Returns a DataFrame with:
Column
Data
Unit
time
time at breath
s
HR
heart rate
bpm
EE
energy expenditure
J/s
RER
exchange ratio
VCO2/VO2
VO2
oxygen
l/min
VCO2
carbon dioxide
l/min
VE
ventilation
l/min
VE/VO2
ratio VE/VO2| -
VE/VCO2
ratio VE/VCO2
O2pulse
oxygen pulse (VO2/HR)
PetO2
end expiratory O2 tension
mmHg
PetCO2
end expiratory CO2 tension
mmHg
VT
tidal volume
l
weights
sample weight
- Parameters
filename (str) – full file path or file in existing path from COSMED spirometer
- Returns
data – Spirometer data in pandas DataFrame
- Return type
pd.DataFrame
- worklab.com.load_spiro_metamax(filename)[source]#
Loads metamax 3B spirometer data from Excel file.
Loads spirometer data to a pandas DataFrame, converts time to seconds (not datetime), computes energy expenditure, computes weights from the time difference between samples, if no heart rate data is available it fills the column with np.NaNs. Returns a DataFrame with:
Column
Data | Unit
time
time at breath
s
HR
heart rate
bpm
EE
energy expenditure
J/s
RER
exchange ratio
VCO2/VO2
VO2
oxygen
l/min
VCO2
carbon dioxide
l/min
VE
ventilation
l/min
VE/VO2
ratio VE/VO2
VE/VCO2
ratio VE/VCO2
O2pulse
oxygen pulse (VO2/HR)
PetO2
end expiratory O2 tension
mmHg
PetCO2
end expiratory CO2 tension
mmHg
VT
tidal volume
l
weights
sample weight
- Parameters
filename (str) – full file path or file in existing path from metamax 3B spirometer
- Returns
data – Spirometer data in pandas DataFrame
- Return type
pd.DataFrame
- worklab.com.load_spline(filename)[source]#
Load wheelchair ergometer calibration spline from LEM datafile.
Loads Esseda calibration spline from LEM which includes all forces (at the roller) at the different calibration points (1:10:1 km/h).
- Parameters
filename (object) – full file path or file in existing path from LEM excel file
- Returns
data – left and right calibration values
- Return type
dict
- worklab.com.load_sw(filename, sfreq=200)[source]#
Loads SMARTwheel data from .txt file.
Loads SMARTwheel data to a pandas DataFrame, converts angle to radians and unwraps it. Returns a DataFrame with:
Column
Data
Unit
time
sample time
s
fx
force on global x-axis
N
fy
force on global y-axis
N
fz
force on global z-axis
N
mx
torque around x-axis
Nm
my
torque around y-axis
Nm
torque
torque around z-axis
Nm
angle
unwrapped wheel angle
rad
Note
SMARTwheel uses a global coordinate system
- Parameters
filename (str) – filename or path to SMARTwheel .data (.csv) file
sfreq (int) – sample frequency of SMARTwheel, default is 200Hz
- Returns
sw_df – Raw SMARTwheel data in a pandas DataFrame
- Return type
pd.DataFrame
See also
load_opti
Load measurement wheel data from an Optipush wheel.
- worklab.com.load_wheelchair(filename)[source]#
Loads wheelchair from LEM datafile.
Loads the wheelchair data from a LEM datafile. Returns:
Column
Data
Unit
name
chair name
rimsize
radius of handrim
m
wheelsize
radius of the wheel
m
wheelbase
width of the wheelchair
m
weight
weight of the chair
kg
- Parameters
filename (str) – full file path or file in existing path from LEM Excel sheet (.xls)
- Returns
wheelchair – dictionary with wheelchair information
- Return type
dict
- worklab.com.load_ximu3(root_dir, filenames=None, inplace=False)[source]#
Imports X-IMU3 session in nested dictionary with all devices with all sensors. Translated from xio-Technologies.
- Parameters
root_dir (str) – directory where session is located
filenames (list, optional) – list of sensor names or single sensor name that you would like to include, only loads Inertial if not specified
inplace (bool, default False) – Whether to modify the DataFrame rather than creating a new one.
- Returns
sessiondata – returns nested object sensordata[device][dataframe]
- Return type
dict
References
https://github.com/xioTechnologies/NGIMU-MATLAB-Import-Logged-Data-Example