def get_model_data(subjects): """Collect dynamic kinematic/kinetic data""" files = list() for subject in subjects: logger.info('processing subject %s' % subject) files.extend(get_files(subject, 'normal')) data, nc = stats.collect_trial_data(files, collect_types={'emg': False, 'model': True}) return data, nc
def get_timedist_average(subjects): """Get grand average timedist for subjects (normal trials only). Returns tuple of timedist (mean, std)""" ans = list() for j, subject in enumerate(subjects): logger.info('processing subject %s' % subject) Nfiles = get_files(subject, 'normal') ans.extend([analysis.get_analysis(c3dfile) for c3dfile in Nfiles]) return (analysis.group_analysis(ans), analysis.group_analysis(ans, fun=np.std))
def get_emg_data(subjects, analog_len=None, newer_than=None): """Collect EMG data""" if analog_len is None: analog_len = 1001 files = list() for subject in subjects: logger.info('processing subject %s' % subject) files.extend(get_files(subject, 'normal', newer_than=newer_than)) data = stats.collect_trial_data(files, collect_types={'emg': True, 'model': False}, analog_len=analog_len) return data
from gaitutils import GaitDataError from cp_common import write_workbook, get_subjects, get_timestr, get_files N = 100 trial_types = ['normal', 'cognitive'] timestr_ = get_timestr() # results shall be entered into this workbook xls_filename = 'K:/CP_projekti_analyysit/cp_autoproc_check_%s.xlsx' % timestr_ trials = list() subjects = get_subjects() for subj in subjects: trials += get_files(subj, trial_types) shuffle(trials) print 'Got trials' trials_ = trials[:N] write_workbook([trials_], xls_filename) vicon = gaitutils.nexus.viconnexus() evs = list() for trial in trials_: trialbase = op.splitext(trial)[0] print 'Opening %s' % trial vicon.OpenTrial(trialbase, 200) print 'Plotting kinematics, close window after review...' sys.stdout.flush()
@author: Jussi ([email protected]) """ import gaitutils from cp_common import get_files def _onpick(ev): a = ev.artist print '%s: cycle %s/%d' % (a._trialname, a._cycle.context, a._cycle.index) subject = 'TD26' cond = 'normal' files = get_files(subject, cond) pl = gaitutils.Plotter() vars = [['HipAnglesX', 'KneeAnglesX', 'AnkleAnglesX'], ['PelvisAnglesX', 'PelvisAnglesY', 'PelvisAnglesZ'], ['ThoraxAnglesX', 'ThoraxAnglesY', 'ThoraxAnglesZ'], ['ShoulderAnglesX', 'ShoulderAnglesY', 'ShoulderAnglesZ']] pl.layout = vars cant_read = list() for fn in files[:5]: pl.open_trial(fn) # check if model vars can be read try: