Skip to content

Commit

Permalink
Fix black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel da Silva committed Jan 31, 2025
1 parent 98de833 commit e36a040
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ccsdspy/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def convert(self, field_array):
"""
converted = np.zeros(field_array.shape, dtype=np.float64)
field_array = field_array.astype(float)

for power, coeff in enumerate(reversed(self._coeffs)):
converted += coeff * field_array**power

Expand Down
1 change: 0 additions & 1 deletion ccsdspy/tests/test_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,4 +619,3 @@ def test_end_to_end(cls):
)

os.remove(TEST_FILENAME)

8 changes: 3 additions & 5 deletions ccsdspy/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,23 +229,21 @@ def test_non_byte_aligned_uint(pkt_class):
assert all(elem == 32 for elem in result1["param1"]), f"Got: repr(result1['param1'])"
assert all(elem == 31 for elem in result2["param2"]), f"Got: repr(result2['param2'])"


def test_numpy2_dtype_poly_and_linear():
"""Fixes compatability issue with converters and NumPy 2
See: https://github.com/CCSDSPy/ccsdspy/issues/132
"""
# Test this doesn't throw an exception

coeffs = np.array([-2, -1], np.int16)
field_array = np.array([50], dtype=np.uint16)

# test polyconverter (no exception)
converter = converters.PolyConverter(coeffs)
converted = converter.convert(field_array)

# test linearconverter (no exception)
converter = converters.LinearConverter(*coeffs)
converted = converter.convert(field_array)


0 comments on commit e36a040

Please sign in to comment.