tgt_log_path = os.path.splitext(__file__)[0] + '_result.log' itf = c3d.c3dserver() c3d.init_logger(logger_lvl='DEBUG', c_hdlr_lvl='WARNING', f_hdlr_lvl='DEBUG', f_hdlr_f_path=tgt_log_path) ret = c3d.open_c3d(itf, src_c3d_path, log=True) c3d_f_type = c3d.get_file_type(itf) c3d_data_type = c3d.get_data_type(itf) # Change a marker's name from 'pv4' to 'PV4' ret = c3d.change_marker_name(itf, 'pv4', 'PV4', log=True) # dict_header = c3d.get_dict_header(itf) # dict_groups = c3d.get_dict_groups(itf) # dict_markers = c3d.get_dict_markers(itf, blocked_nan=True, resid=True, mask=False, time=True) # dict_mkr_pos = dict_markers['DATA']['POS'] # Try to test different gap filling functions # c3d.fill_marker_gap_rbt(itf, 'PV2', ['PV1', 'PV3', 'PV4'], log=True) c3d.fill_marker_gap_pattern(itf, tgt_mkr_name='PV2', dnr_mkr_name='PV4', log=True) # c3d.fill_marker_gap_interp(itf, 'PV2', log=True) ret = c3d.save_c3d(itf, tgt_c3d_path, log=True) ret = c3d.close_c3d(itf, log=True)
import os import sys if sys.path[0] != os.getcwd(): sys.path.insert(0, os.getcwd()) lib_local_path = os.path.normpath(r'C:\WORKSPACE\DEV\pyc3dserver') if os.path.exists(lib_local_path): if sys.path[1] != lib_local_path: sys.path.insert(1, lib_local_path) import pyc3dserver as c3d import numpy as np #%% current_f_dir_path = os.path.dirname(__file__) c3d_sample_dir_path = os.path.join(current_f_dir_path, r'..\Samples_C3D\Sample01') src_c3d_path = os.path.join(c3d_sample_dir_path, 'Eb015pi.c3d') tgt_c3d_path = os.path.splitext(__file__)[0] + '_result.c3d' itf = c3d.c3dserver(False) ret = c3d.open_c3d(itf, src_c3d_path) # dict_header = c3d.get_dict_header(itf) # dict_groups = c3d.get_dict_groups(itf) # dict_markers = c3d.get_dict_markers(itf, blocked_nan=True, resid=True, mask=True, desc=True) # dict_forces = c3d.get_dict_forces(itf, desc=True, frame=True, time=True) # dict_analogs = c3d.get_dict_analogs(itf, desc=True, frame=True, excl_forces=True, time=True) ret, n_frs_updated = c3d.recover_marker_rel(itf, 'LTH1', ['LTH2', 'LTH3', 'LTH4']) ret = c3d.save_c3d(itf, tgt_c3d_path) ret = c3d.close_c3d(itf)
import numpy as np #%% current_f_dir_path = os.path.dirname(__file__) c3d_sample_dir_path = os.path.join(current_f_dir_path, r'..\Samples_C3D\Sample05') src_c3d_path = os.path.join(c3d_sample_dir_path, 'vicon512.c3d') tgt_c3d_path = os.path.splitext(__file__)[0] + '_result.c3d' itf = c3d.c3dserver() ret = c3d.open_c3d(itf, src_c3d_path) av_ratio = c3d.get_analog_video_ratio(itf) first_fr = c3d.get_first_frame(itf) last_fr = c3d.get_last_frame(itf) new_val = np.array([100.0] * av_ratio * 1000, dtype=np.float32) ret = c3d.set_analog_data(itf, 'AUD1', new_val, start_frame=5000, end_frame=5999) ret = c3d.set_analog_subframe_data(itf, 'AUD1', 200.0, start_frame=last_fr, sub_frame=9) sig_data_unscaled = c3d.get_analog_data_unscaled(itf, 'AUD1') sig_data_scaled = c3d.get_analog_data_scaled2(itf, 'AUD1') ret = c3d.save_c3d(itf, tgt_c3d_path, compress_param_blocks=True) ret = c3d.close_c3d(itf)