fastremap 1.17.0__tar.gz → 1.17.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {fastremap-1.17.0 → fastremap-1.17.1}/ChangeLog +7 -0
  2. {fastremap-1.17.0/fastremap.egg-info → fastremap-1.17.1}/PKG-INFO +3 -2
  3. {fastremap-1.17.0 → fastremap-1.17.1}/automated_test.py +55 -55
  4. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap/__init__.py +2 -0
  5. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap/fastremap.pyi +7 -0
  6. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap/fastremap.pyx +2 -2
  7. {fastremap-1.17.0 → fastremap-1.17.1/fastremap.egg-info}/PKG-INFO +3 -2
  8. fastremap-1.17.1/fastremap.egg-info/pbr.json +1 -0
  9. fastremap-1.17.0/fastremap.egg-info/pbr.json +0 -1
  10. {fastremap-1.17.0 → fastremap-1.17.1}/.dockerignore +0 -0
  11. {fastremap-1.17.0 → fastremap-1.17.1}/.github/workflows/build_wheel.yml +0 -0
  12. {fastremap-1.17.0 → fastremap-1.17.1}/.github/workflows/lint.yml +0 -0
  13. {fastremap-1.17.0 → fastremap-1.17.1}/.github/workflows/test.yml +0 -0
  14. {fastremap-1.17.0 → fastremap-1.17.1}/.vscode/settings.json +0 -0
  15. {fastremap-1.17.0 → fastremap-1.17.1}/AUTHORS +0 -0
  16. {fastremap-1.17.0 → fastremap-1.17.1}/LICENSE +0 -0
  17. {fastremap-1.17.0 → fastremap-1.17.1}/MANIFEST.in +0 -0
  18. {fastremap-1.17.0 → fastremap-1.17.1}/README.md +0 -0
  19. {fastremap-1.17.0 → fastremap-1.17.1}/build_linux.sh +0 -0
  20. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap/fastremap.pxd +0 -0
  21. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap/ipt.hpp +0 -0
  22. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap/py.typed +0 -0
  23. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap/ska_flat_hash_map.hpp +0 -0
  24. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap.egg-info/SOURCES.txt +0 -0
  25. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap.egg-info/dependency_links.txt +0 -0
  26. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap.egg-info/not-zip-safe +0 -0
  27. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap.egg-info/requires.txt +0 -0
  28. {fastremap-1.17.0 → fastremap-1.17.1}/fastremap.egg-info/top_level.txt +0 -0
  29. {fastremap-1.17.0 → fastremap-1.17.1}/manylinux1.Dockerfile +0 -0
  30. {fastremap-1.17.0 → fastremap-1.17.1}/manylinux2010.Dockerfile +0 -0
  31. {fastremap-1.17.0 → fastremap-1.17.1}/manylinux2014.Dockerfile +0 -0
  32. {fastremap-1.17.0 → fastremap-1.17.1}/mypy.allowlist +0 -0
  33. {fastremap-1.17.0 → fastremap-1.17.1}/pyproject.toml +0 -0
  34. {fastremap-1.17.0 → fastremap-1.17.1}/requirements.txt +0 -0
  35. {fastremap-1.17.0 → fastremap-1.17.1}/requirements_dev.txt +0 -0
  36. {fastremap-1.17.0 → fastremap-1.17.1}/setup.cfg +0 -0
  37. {fastremap-1.17.0 → fastremap-1.17.1}/setup.py +0 -0
  38. {fastremap-1.17.0 → fastremap-1.17.1}/test.py +0 -0
  39. {fastremap-1.17.0 → fastremap-1.17.1}/tox.ini +0 -0
@@ -1,6 +1,13 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ 1.17.1
5
+ ------
6
+
7
+ * fixtest: promote fit\_dtype in testing
8
+ * fix: fit\_dtype is used externally
9
+ * docs: add collaborators
10
+
4
11
  1.17.0
5
12
  ------
6
13
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: fastremap
3
- Version: 1.17.0
3
+ Version: 1.17.1
4
4
  Summary: Remap, mask, renumber, unique, and in-place transposition of 3D labeled images. Point cloud too.
5
5
  Home-page: https://github.com/seung-lab/fastremap/
6
6
  Author: William Silversmith
@@ -26,6 +26,7 @@ Dynamic: classifier
26
26
  Dynamic: description
27
27
  Dynamic: description-content-type
28
28
  Dynamic: home-page
29
+ Dynamic: license-file
29
30
  Dynamic: requires-dist
30
31
  Dynamic: requires-python
31
32
  Dynamic: summary
@@ -302,94 +302,94 @@ def test_ascontiguousarray(dtype, dim):
302
302
 
303
303
  @pytest.mark.parametrize("dtype", [ np.uint8, np.uint16, np.uint32, np.uint64 ])
304
304
  def test_fit_dtype_uint(dtype):
305
- assert fastremap.fastremap._fit_dtype(dtype, 0) == np.uint8
306
- assert fastremap.fastremap._fit_dtype(dtype, 255) == np.uint8
307
- assert fastremap.fastremap._fit_dtype(dtype, 256) == np.uint16
308
- assert fastremap.fastremap._fit_dtype(dtype, 10000) == np.uint16
309
- assert fastremap.fastremap._fit_dtype(dtype, 2**16 - 1) == np.uint16
310
- assert fastremap.fastremap._fit_dtype(dtype, 2**16) == np.uint32
311
- assert fastremap.fastremap._fit_dtype(dtype, 2**32) == np.uint64
312
- assert fastremap.fastremap._fit_dtype(dtype, 2**64 - 1) == np.uint64
305
+ assert fastremap.fit_dtype(dtype, 0) == np.uint8
306
+ assert fastremap.fit_dtype(dtype, 255) == np.uint8
307
+ assert fastremap.fit_dtype(dtype, 256) == np.uint16
308
+ assert fastremap.fit_dtype(dtype, 10000) == np.uint16
309
+ assert fastremap.fit_dtype(dtype, 2**16 - 1) == np.uint16
310
+ assert fastremap.fit_dtype(dtype, 2**16) == np.uint32
311
+ assert fastremap.fit_dtype(dtype, 2**32) == np.uint64
312
+ assert fastremap.fit_dtype(dtype, 2**64 - 1) == np.uint64
313
313
 
314
314
  try:
315
- fastremap.fastremap._fit_dtype(dtype, -1)
315
+ fastremap.fit_dtype(dtype, -1)
316
316
  assert False
317
317
  except ValueError:
318
318
  pass
319
319
 
320
320
  try:
321
- fastremap.fastremap._fit_dtype(dtype, 2**64)
321
+ fastremap.fit_dtype(dtype, 2**64)
322
322
  except ValueError:
323
323
  pass
324
324
 
325
325
  @pytest.mark.parametrize("dtype", [ np.int8, np.int16, np.int32, np.int64 ])
326
326
  def test_fit_dtype_int(dtype):
327
- assert fastremap.fastremap._fit_dtype(dtype, 0) == np.int8
328
- assert fastremap.fastremap._fit_dtype(dtype, 127) == np.int8
329
- assert fastremap.fastremap._fit_dtype(dtype, -128) == np.int8
330
- assert fastremap.fastremap._fit_dtype(dtype, 128) == np.int16
331
- assert fastremap.fastremap._fit_dtype(dtype, 10000) == np.int16
332
- assert fastremap.fastremap._fit_dtype(dtype, 2**15 - 1) == np.int16
333
- assert fastremap.fastremap._fit_dtype(dtype, 2**15) == np.int32
334
- assert fastremap.fastremap._fit_dtype(dtype, 2**32) == np.int64
335
- assert fastremap.fastremap._fit_dtype(dtype, 2**63 - 1) == np.int64
327
+ assert fastremap.fit_dtype(dtype, 0) == np.int8
328
+ assert fastremap.fit_dtype(dtype, 127) == np.int8
329
+ assert fastremap.fit_dtype(dtype, -128) == np.int8
330
+ assert fastremap.fit_dtype(dtype, 128) == np.int16
331
+ assert fastremap.fit_dtype(dtype, 10000) == np.int16
332
+ assert fastremap.fit_dtype(dtype, 2**15 - 1) == np.int16
333
+ assert fastremap.fit_dtype(dtype, 2**15) == np.int32
334
+ assert fastremap.fit_dtype(dtype, 2**32) == np.int64
335
+ assert fastremap.fit_dtype(dtype, 2**63 - 1) == np.int64
336
336
 
337
337
  try:
338
- fastremap.fastremap._fit_dtype(dtype, 2**63)
338
+ fastremap.fit_dtype(dtype, 2**63)
339
339
  except ValueError:
340
340
  pass
341
341
 
342
342
  try:
343
- fastremap.fastremap._fit_dtype(dtype, -2**63)
343
+ fastremap.fit_dtype(dtype, -2**63)
344
344
  except ValueError:
345
345
  pass
346
346
 
347
347
  @pytest.mark.parametrize("dtype", [ np.float16, np.float32, np.float64 ])
348
348
  def test_fit_dtype_float(dtype):
349
- assert fastremap.fastremap._fit_dtype(dtype, 0) == np.float32
350
- assert fastremap.fastremap._fit_dtype(dtype, 127) == np.float32
351
- assert fastremap.fastremap._fit_dtype(dtype, 128) == np.float32
352
- assert fastremap.fastremap._fit_dtype(dtype, 10000) == np.float32
353
- assert fastremap.fastremap._fit_dtype(dtype, 2**15 - 1) == np.float32
354
- assert fastremap.fastremap._fit_dtype(dtype, 2**15) == np.float32
355
- assert fastremap.fastremap._fit_dtype(dtype, 2**32) == np.float32
356
- assert fastremap.fastremap._fit_dtype(dtype, 2**63 - 1) == np.float32
357
- assert fastremap.fastremap._fit_dtype(dtype, -2**63) == np.float32
358
- assert fastremap.fastremap._fit_dtype(dtype, 2**128) == np.float64
359
-
360
- assert fastremap.fastremap._fit_dtype(dtype, 0, exotics=True) == np.float16
361
- assert fastremap.fastremap._fit_dtype(dtype, 127, exotics=True) == np.float16
362
- assert fastremap.fastremap._fit_dtype(dtype, 128, exotics=True) == np.float16
363
- assert fastremap.fastremap._fit_dtype(dtype, 10000, exotics=True) == np.float16
364
- assert fastremap.fastremap._fit_dtype(dtype, 2**15 - 1, exotics=True) == np.float16
365
- assert fastremap.fastremap._fit_dtype(dtype, 2**15, exotics=True) == np.float16
366
- assert fastremap.fastremap._fit_dtype(dtype, 2**32, exotics=True) == np.float32
367
- assert fastremap.fastremap._fit_dtype(dtype, 2**63 - 1, exotics=True) == np.float32
368
- assert fastremap.fastremap._fit_dtype(dtype, -2**63, exotics=True) == np.float32
349
+ assert fastremap.fit_dtype(dtype, 0) == np.float32
350
+ assert fastremap.fit_dtype(dtype, 127) == np.float32
351
+ assert fastremap.fit_dtype(dtype, 128) == np.float32
352
+ assert fastremap.fit_dtype(dtype, 10000) == np.float32
353
+ assert fastremap.fit_dtype(dtype, 2**15 - 1) == np.float32
354
+ assert fastremap.fit_dtype(dtype, 2**15) == np.float32
355
+ assert fastremap.fit_dtype(dtype, 2**32) == np.float32
356
+ assert fastremap.fit_dtype(dtype, 2**63 - 1) == np.float32
357
+ assert fastremap.fit_dtype(dtype, -2**63) == np.float32
358
+ assert fastremap.fit_dtype(dtype, 2**128) == np.float64
359
+
360
+ assert fastremap.fit_dtype(dtype, 0, exotics=True) == np.float16
361
+ assert fastremap.fit_dtype(dtype, 127, exotics=True) == np.float16
362
+ assert fastremap.fit_dtype(dtype, 128, exotics=True) == np.float16
363
+ assert fastremap.fit_dtype(dtype, 10000, exotics=True) == np.float16
364
+ assert fastremap.fit_dtype(dtype, 2**15 - 1, exotics=True) == np.float16
365
+ assert fastremap.fit_dtype(dtype, 2**15, exotics=True) == np.float16
366
+ assert fastremap.fit_dtype(dtype, 2**32, exotics=True) == np.float32
367
+ assert fastremap.fit_dtype(dtype, 2**63 - 1, exotics=True) == np.float32
368
+ assert fastremap.fit_dtype(dtype, -2**63, exotics=True) == np.float32
369
369
 
370
370
  @pytest.mark.parametrize("dtype", [ np.csingle, np.cdouble ])
371
371
  @pytest.mark.parametrize("sign", [ 1, -1, 1j, -1j ])
372
372
  def test_fit_dtype_float(dtype, sign):
373
- assert fastremap.fastremap._fit_dtype(dtype, sign * 0+0j) == np.csingle
374
- assert fastremap.fastremap._fit_dtype(dtype, sign * 127) == np.csingle
375
- assert fastremap.fastremap._fit_dtype(dtype, sign * 127) == np.csingle
376
- assert fastremap.fastremap._fit_dtype(dtype, sign * 128) == np.csingle
377
- assert fastremap.fastremap._fit_dtype(dtype, sign * 128) == np.csingle
378
- assert fastremap.fastremap._fit_dtype(dtype, sign * 10000) == np.csingle
379
- assert fastremap.fastremap._fit_dtype(dtype, sign * 10000) == np.csingle
380
- assert fastremap.fastremap._fit_dtype(dtype, sign * 2**15 - 1) == np.csingle
381
- assert fastremap.fastremap._fit_dtype(dtype, sign * 2**15) == np.csingle
382
- assert fastremap.fastremap._fit_dtype(dtype, sign * 2**32) == np.csingle
383
- assert fastremap.fastremap._fit_dtype(dtype, sign * 2**63 - 1) == np.csingle
384
- assert fastremap.fastremap._fit_dtype(dtype, -2**63) == np.csingle
373
+ assert fastremap.fit_dtype(dtype, sign * 0+0j) == np.csingle
374
+ assert fastremap.fit_dtype(dtype, sign * 127) == np.csingle
375
+ assert fastremap.fit_dtype(dtype, sign * 127) == np.csingle
376
+ assert fastremap.fit_dtype(dtype, sign * 128) == np.csingle
377
+ assert fastremap.fit_dtype(dtype, sign * 128) == np.csingle
378
+ assert fastremap.fit_dtype(dtype, sign * 10000) == np.csingle
379
+ assert fastremap.fit_dtype(dtype, sign * 10000) == np.csingle
380
+ assert fastremap.fit_dtype(dtype, sign * 2**15 - 1) == np.csingle
381
+ assert fastremap.fit_dtype(dtype, sign * 2**15) == np.csingle
382
+ assert fastremap.fit_dtype(dtype, sign * 2**32) == np.csingle
383
+ assert fastremap.fit_dtype(dtype, sign * 2**63 - 1) == np.csingle
384
+ assert fastremap.fit_dtype(dtype, -2**63) == np.csingle
385
385
 
386
386
  try:
387
- fastremap.fastremap._fit_dtype(dtype, sign * 2**128)
387
+ fastremap.fit_dtype(dtype, sign * 2**128)
388
388
  assert False
389
389
  except ValueError:
390
390
  pass
391
391
 
392
- assert fastremap.fastremap._fit_dtype(dtype, sign * 2**128, exotics=True) == np.cdouble
392
+ assert fastremap.fit_dtype(dtype, sign * 2**128, exotics=True) == np.cdouble
393
393
 
394
394
  def test_minmax():
395
395
  volume = np.random.randint(-500, 500, size=(128,128,128))
@@ -2,6 +2,7 @@ from .fastremap import (
2
2
  ascontiguousarray,
3
3
  asfortranarray,
4
4
  component_map,
5
+ fit_dtype,
5
6
  foreground,
6
7
  indices,
7
8
  inverse_component_map,
@@ -26,6 +27,7 @@ __all__ = [
26
27
  "ascontiguousarray",
27
28
  "asfortranarray",
28
29
  "component_map",
30
+ "fit_dtype",
29
31
  "foreground",
30
32
  "indices",
31
33
  "inverse_component_map",
@@ -441,6 +441,13 @@ def ascontiguousarray(arr: NDArray[Any]) -> NDArray[Any]:
441
441
  """
442
442
  ...
443
443
 
444
+ def fit_dtype(
445
+ dtype:DTypeLike,
446
+ value:Union[int, float, np.integer, np.unsignedinteger, np.complexfloating, np.floating],
447
+ exotics:bool = False,
448
+ ) -> DTypeLike:
449
+ ...
450
+
444
451
  def minmax(
445
452
  arr: NDArray[Any],
446
453
  ) -> tuple[Union[int, float, None], Union[int, float, None]]:
@@ -292,7 +292,7 @@ def refit(arr, value=None, increase_only=False, exotics=False):
292
292
  else:
293
293
  value = min_value
294
294
 
295
- dtype = _fit_dtype(arr.dtype, value, exotics=exotics)
295
+ dtype = fit_dtype(arr.dtype, value, exotics=exotics)
296
296
 
297
297
  if increase_only and np.dtype(dtype).itemsize <= np.dtype(arr.dtype).itemsize:
298
298
  return arr
@@ -300,7 +300,7 @@ def refit(arr, value=None, increase_only=False, exotics=False):
300
300
  return arr
301
301
  return arr.astype(dtype)
302
302
 
303
- def _fit_dtype(dtype, value, exotics=False):
303
+ def fit_dtype(dtype, value, exotics=False):
304
304
  """
305
305
  Find the smallest dtype of the
306
306
  same kind that will fit a given value.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: fastremap
3
- Version: 1.17.0
3
+ Version: 1.17.1
4
4
  Summary: Remap, mask, renumber, unique, and in-place transposition of 3D labeled images. Point cloud too.
5
5
  Home-page: https://github.com/seung-lab/fastremap/
6
6
  Author: William Silversmith
@@ -26,6 +26,7 @@ Dynamic: classifier
26
26
  Dynamic: description
27
27
  Dynamic: description-content-type
28
28
  Dynamic: home-page
29
+ Dynamic: license-file
29
30
  Dynamic: requires-dist
30
31
  Dynamic: requires-python
31
32
  Dynamic: summary
@@ -0,0 +1 @@
1
+ {"git_version": "d754c45", "is_release": true}
@@ -1 +0,0 @@
1
- {"git_version": "1b389a3", "is_release": true}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes