Skip to main content

A library for manipulating C3D binary files

Project description

This is a small library for reading and writing C3D binary files. C3D files are a standard format for recording 3-dimensional time sequence data, especially data recorded by a 3D motion tracking apparatus.

Installing

Install with pip:

pip install c3d

Or if you’d like to use the bleeding-edge version, just clone the github repository and build and install using the normal Python setup process:

pip install git+https://github.com/EmbodiedCognition/py-c3d

Usage

Tools

This package includes a script for converting C3D motion data to CSV format (c3d2csv) and an OpenGL-based visualization tool for observing the motion described by a C3D file (c3d-viewer).

Note for the viewer you need to install pyglet. This can be done by installing the gui extra of py-c3d:

pip install "c3d[gui]"

Library

To use the C3D library, just import the package and create a Reader or Writer depending on your intended usage

import c3d

with open('data.c3d', 'rb') as handle:
    reader = c3d.Reader(handle)
    for i, (points, analog) in enumerate(reader.read_frames()):
        print('Frame {}: {}'.format(i, points.round(2)))

You can also get and set metadata fields using the library; see the package documentation for more details.

Developer Install

To work on c3d, first install poetry and then run:

git clone https://github.com/EmbodiedCognition/py-c3d
cd py-c3d
poetry install

This will create a new virtual environment with all the required dependency and c3d in develop mode.

Tests

To run tests available in the test folder, following command can be run from the root of the package directory:

python -m unittest discover .

Test scripts will automatically download test files from c3d.org.

Caveats

This library is minimally effective, in the sense that the only motion tracking system I have access to (for testing) is a Phasespace system. If you try out the library and find that it doesn’t work with your motion tracking system, let me know. Pull requests are also welcome!

Also, if you’re looking for more functionality than just reading and writing C3D files, there are a lot of better toolkits out there that support a lot more file formats and provide more functionality, perhaps at the cost of increased complexity. The biomechanical toolkit is a good package for analyzing motion data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

c3d-0.6.0.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

c3d-0.6.0-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file c3d-0.6.0.tar.gz.

File metadata

  • Download URL: c3d-0.6.0.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for c3d-0.6.0.tar.gz
Algorithm Hash digest
SHA256 59f94bc243bfe811683abf9d2d2831bf3749a2fe056bbc6a8a5461054eb6c2e5
MD5 2dca5b215679aaf9a43116c755b81b21
BLAKE2b-256 4352e292175e9b252daaa5d9533ab88bf56f25ed6401dd16bb1e3bf5cb17c53e

See more details on using hashes here.

Provenance

The following attestation bundles were made for c3d-0.6.0.tar.gz:

Publisher: publish.yml on EmbodiedCognition/py-c3d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file c3d-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: c3d-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for c3d-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86928e4bd46aac107b1288981e4fee0daaca7ca24524bef6e890a99b7d1421a4
MD5 4bbd128c9915d352f1cae88e479d0086
BLAKE2b-256 66f490cbc0ae74ad59b00ca163732fa0fe9dad7979f65938f171990653829529

See more details on using hashes here.

Provenance

The following attestation bundles were made for c3d-0.6.0-py3-none-any.whl:

Publisher: publish.yml on EmbodiedCognition/py-c3d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page