Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]

python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -29,3 +28,4 @@ jobs:
- name: Testing
run: |
poetry run python -m unittest discover .

12 changes: 6 additions & 6 deletions c3d/c3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ def first_frame(self):
# ACTUAL_START_FIELD is encoded in two 16 byte words...
# return param.uint32_value
words = param.uint16_array
return words[0] + words[1] * 65535
return int(words[0]) + int(words[1]) * 65535
return self.header.first_frame

@property
Expand All @@ -1529,7 +1529,7 @@ def last_frame(self) -> int:
# Manual refer to parsing the parameter as 2 16-bit words, generally equivalent to an uint32
# end_frame = param.uint32_value
words = param.uint16_array
end_frame = words[0] + words[1] * 65536
end_frame = int(words[0]) + int(words[1]) * 65536
if hlf <= end_frame:
return end_frame
param = self.get('POINT:LONG_FRAMES')
Expand Down Expand Up @@ -2205,11 +2205,11 @@ def add_frames(self, frames, index=None):
index : int or None
Insert the frame or sequence at the index (the first sequence frame will be inserted at give index).
Note that the index should be relative to 0 rather then the frame number provided by read_frames()!
'''
'''
sh = np.array(frames, dtype=object).shape
# Single frame
if len(sh) != 2:
frames = [frames]
frames = np.array([frames], dtype=object)
sh = np.shape(frames)
# Sequence of invalid shape
if sh[1] != 2:
Expand Down Expand Up @@ -2424,7 +2424,7 @@ def _write_metadata(self, handle):

# Padding
self._pad_block(handle)
while handle.tell() != 512 * (self.header.data_block - 1):
while handle.tell() != 512 * (int(self.header.data_block) - 1):
handle.write(b'\x00' * 512)

def _write_frames(self, handle):
Expand All @@ -2436,7 +2436,7 @@ def _write_frames(self, handle):
Write metadata and C3D motion frames to the given file handle. The
writer does not close the handle.
'''
assert handle.tell() == 512 * (self._header.data_block - 1)
assert handle.tell() == 512 * (int(self._header.data_block) - 1)
scale_mag = abs(self.point_scale)
is_float = self.point_scale < 0
if is_float:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ c3d-metatdata = 'c3d.scripts.c3d_metatdata:main'
c3d-viewer = 'c3d.scripts.c3d_viewer:main'

[tool.poetry.dependencies]
python = "^3.7"
numpy = "^1"
python = "^3.9"
numpy = ">=1.0.0"
pyglet = {version = "^1.5.21", optional = true}

[tool.poetry.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion test/test_frame_count_encodings.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Sample19(FrameCountEncodingTest, AnalogSampleCountEncodingTest, verify.Rea

frame_count = [34672]
sample_count = [624096]
zip_files = ['sample19/sample19.c3d']
zip_files = ['sample19.c3d']


class Sample31(FrameCountEncodingTest, AnalogSampleCountEncodingTest, verify.ReadTest, Base):
Expand Down
4 changes: 2 additions & 2 deletions test/test_proc_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class Sample02(FormatTest, Base):
ZIP = 'sample02.zip'
INTEL_INT = 'pc_int.c3d'
INTEL_REAL = 'pc_real.c3d'
DEC_INT = 'DEC_INT.C3D'
DEC_REAL = 'Dec_real.c3d'
DEC_INT = 'dec_int.c3d'
DEC_REAL = 'dec_real.c3d'
MIPS_INT = 'sgi_int.c3d'
MIPS_REAL = 'sgi_real.c3d'

Expand Down
4 changes: 2 additions & 2 deletions test/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def check_zipfile(file_path):
# Allow self.zipfiles on form:
# ['FILE', ..]
# [('FOLDER', ['FILE', ..])]
if len(np.shape(self.zip_files)) == 1:
if len(np.array(self.zip_files, dtype=object).shape) == 1:
for file in self.zip_files:
check_zipfile(file)
else:
Expand Down Expand Up @@ -130,7 +130,7 @@ def check_zipfile(file_path):
print('----------------------------')
print(type(self))
print('----------------------------')
if len(np.shape(self.zip_files)) == 1:
if len(np.array(self.zip_files, dtype=object).shape) == 1:
for file in self.zip_files:
check_zipfile(file)
else:
Expand Down
12 changes: 6 additions & 6 deletions test/zipload.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
TEMP = os.path.join(tempfile.gettempdir(), 'c3d-test')
ZIPS = (
('https://www.c3d.org/data/Sample00.zip', 'sample00.zip'),
('https://www.c3d.org/data/sample01.zip', 'sample01.zip'),
('https://www.c3d.org/data/sample02.zip', 'sample02.zip'),
('https://www.c3d.org/data/sample07.zip', 'sample07.zip'),
('https://www.c3d.org/data/sample08.zip', 'sample08.zip'),
('https://www.c3d.org/data/sample19.zip', 'sample19.zip'),
('https://www.c3d.org/data/sample31.zip', 'sample31.zip'),
('https://www.c3d.org/data/Sample01.zip', 'sample01.zip'),
('https://www.c3d.org/data/Sample02.zip', 'sample02.zip'),
('https://www.c3d.org/data/Sample07.zip', 'sample07.zip'),
('https://www.c3d.org/data/Sample08.zip', 'sample08.zip'),
('https://www.c3d.org/data/Sample19.zip', 'sample19.zip'),
('https://www.c3d.org/data/Sample31.zip', 'sample31.zip'),
('https://www.c3d.org/data/Sample36.zip', 'sample36.zip'),
)

Expand Down