PyC3DSample
Interface to easily deal with a C3D file, including some helpful methods for dealing with gait analysis (e.g. detecting heel strike)
Installation
pip install pyc3dsample
Basic usage
Initialize PyC3DSample object and get general information about C3D file by just printing the object
from pyc3dsample import PyC3DSample
Test = PyC3DSample(<path_to_c3dfile>)
print(Test)
ID : <path_to_c3dfile>
FrameRate : 100.0
TimeStep : 0.01
FirstFrame : 0
LastFrame : 203
TotalFrames : 204
To get the progression of the left hip angles with respect to the X-axis.
Test.get_TimeProgress("LHipAngles_X")
To get events (e.g. left or right foot strike, or a general event added by the user)
# Get events -> List of (<label>, <time [s]>)
print(Test.Events)
[('Event', 0.99)]
Get progression of the left knee angles with respect to the X-axis from 100 ms before an event, until the event itself.
EventEvent = round(
[e for e in Test.Events if e[0] == 'Event'][0][1], 2
)
print(
Test.get_TimeProgressRange("LKneeAngles_X", EventEvent-0.1, EventEvent)
)
[[ 0.89 38.35063553]
[ 0.9 34.10266495]
[ 0.91 29.63624573]
[ 0.92 25.12419128]
[ 0.93 20.75816917]
[ 0.94 16.72034645]
[ 0.95 13.15703011]
[ 0.96 10.16346359]
[ 0.97 7.78041172]
[ 0.98 5.99653673]
[ 0.99 4.75045919]]
Get and plot position and velocity of the RHEE marker along the global z-axis.
RHEE_Z = Test.get_TimeProgress("RHEE_Z")
RHEE_Zd = Test.get_TimeProgress1D("RHEE_Z")
# Plot
fig, axs = plt.subplots(2, 1, sharex=True)
# Position
axs[0].plot(RHEE_Z[:,0], RHEE_Z[:,1])
axs[0].set_ylabel("Position [mm]")
axs[0].set_title("RHEE Marker Position (z)", loc="left", fontsize="large")
# Velocity
axs[1].plot(RHEE_Zd[:,0], RHEE_Zd[:,1])
axs[1].set_ylabel("Velocity [mm/s]")
axs[1].set_xlabel("Time [s]")
axs[1].set_title("RHEE Marker Velocity (z)", loc="left", fontsize="large")
axs[0].grid()
axs[1].grid()
fig.tight_layout()
plt.show()
To identify heel strikes.
rHeelStrike_Time = Test.get_HeelStrike('R', _method='yHeelSnap')
lHeelStrike_Time = Test.get_HeelStrike('L', _method='yHeelSnap')
print(f"Right heel strike at : {rHeelStrike_Time}")
print(f"Left heel strike at : {lHeelStrike_Time}")
Right heel strike at : [0.6, 1.61]
Left heel strike at : [0.1, 1.09]
Metadata
Release files for pyc3dsample 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyc3dsample-0.0.5.tar.gz | 1.5 MB | Without provenance | Details for pyc3dsample-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyc3dsample-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for pyc3dsample-0.0.5-py3-none-any.whl |
Total release size: 1.5 MB
Release files / pyc3dsample-0.0.5.tar.gz
| Download URL | pyc3dsample-0.0.5.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bfe5d3d7ece5b7ec1cf92190979f03dbfb131a36c0f6330c1adeb8aded1cfe4b
|
|
BLAKE2b-256 checksum How to use checksums |
22e4a720225c1be38f7849726e757e40cd472cfc2415bfd596be01bbf87e481a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pyc3dsample-0.0.5-py3-none-any.whl
| Download URL | pyc3dsample-0.0.5-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94e161c5e0e6ef7662e96ad5e301691e9938bca2ce2ac2807344e17f6be8166d
|
|
BLAKE2b-256 checksum How to use checksums |
02016386c6cfbc9855ce8b10c7c92863e2fae2d15230e9421d66bb904facbff5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pyc3dsample 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.