fastremap 1.14.0__tar.gz → 1.14.2__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 (35) hide show
  1. {fastremap-1.14.0 → fastremap-1.14.2}/.github/workflows/build_wheel.yml +6 -6
  2. {fastremap-1.14.0 → fastremap-1.14.2}/ChangeLog +25 -0
  3. {fastremap-1.14.0 → fastremap-1.14.2}/PKG-INFO +2 -2
  4. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.egg-info/PKG-INFO +2 -2
  5. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.egg-info/SOURCES.txt +0 -3
  6. fastremap-1.14.2/fastremap.egg-info/pbr.json +1 -0
  7. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.pyx +25 -24
  8. {fastremap-1.14.0 → fastremap-1.14.2}/setup.py +2 -2
  9. fastremap-1.14.2/test.py +21 -0
  10. {fastremap-1.14.0 → fastremap-1.14.2}/tox.ini +3 -1
  11. fastremap-1.14.0/.travis.yml +0 -17
  12. fastremap-1.14.0/appveyor.yml +0 -41
  13. fastremap-1.14.0/fastremap.cpp +0 -213867
  14. fastremap-1.14.0/fastremap.egg-info/pbr.json +0 -1
  15. fastremap-1.14.0/test.py +0 -51
  16. {fastremap-1.14.0 → fastremap-1.14.2}/.dockerignore +0 -0
  17. {fastremap-1.14.0 → fastremap-1.14.2}/AUTHORS +0 -0
  18. {fastremap-1.14.0 → fastremap-1.14.2}/LICENSE +0 -0
  19. {fastremap-1.14.0 → fastremap-1.14.2}/README.md +0 -0
  20. {fastremap-1.14.0 → fastremap-1.14.2}/automated_test.py +0 -0
  21. {fastremap-1.14.0 → fastremap-1.14.2}/build_linux.sh +0 -0
  22. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.egg-info/dependency_links.txt +0 -0
  23. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.egg-info/not-zip-safe +0 -0
  24. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.egg-info/requires.txt +0 -0
  25. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.egg-info/top_level.txt +0 -0
  26. {fastremap-1.14.0 → fastremap-1.14.2}/fastremap.pxd +0 -0
  27. {fastremap-1.14.0 → fastremap-1.14.2}/ipt.hpp +0 -0
  28. {fastremap-1.14.0 → fastremap-1.14.2}/manylinux1.Dockerfile +0 -0
  29. {fastremap-1.14.0 → fastremap-1.14.2}/manylinux2010.Dockerfile +0 -0
  30. {fastremap-1.14.0 → fastremap-1.14.2}/manylinux2014.Dockerfile +0 -0
  31. {fastremap-1.14.0 → fastremap-1.14.2}/requirements.txt +0 -0
  32. {fastremap-1.14.0 → fastremap-1.14.2}/requirements_dev.txt +0 -0
  33. {fastremap-1.14.0 → fastremap-1.14.2}/setup.cfg +0 -0
  34. {fastremap-1.14.0 → fastremap-1.14.2}/ska_flat_hash_map.hpp +0 -0
  35. {fastremap-1.14.0 → fastremap-1.14.2}/test.cpp +0 -0
@@ -6,7 +6,7 @@ on:
6
6
  tags:
7
7
  - '*'
8
8
  env:
9
- CIBW_SKIP: cp27-* cp33-* cp34-* cp35-* pp27* pp36* pp37* pp38* pp39* pp310* *-musllinux*
9
+ CIBW_SKIP: cp27-* cp33-* cp34-* cp35-* cp36-* cp37-* pp* *-musllinux* cp312-manylinux_i686
10
10
 
11
11
  jobs:
12
12
  build_wheels:
@@ -14,25 +14,25 @@ jobs:
14
14
  runs-on: ${{ matrix.os }}
15
15
  strategy:
16
16
  matrix:
17
- os: [ubuntu-20.04, windows-2019, macos-latest]
17
+ os: [ubuntu-latest, macos-latest, windows-2019]
18
18
  arch: [auto]
19
19
  include:
20
- - os: ubuntu-20.04
20
+ - os: ubuntu-latest
21
21
  arch: aarch64
22
22
 
23
23
  steps:
24
- - uses: actions/checkout@v2
24
+ - uses: actions/checkout@v4
25
25
 
26
26
  - name: Set up QEMU
27
27
  if: ${{ matrix.arch == 'aarch64' }}
28
28
  uses: docker/setup-qemu-action@v1
29
29
 
30
30
  - name: Build wheels
31
- uses: pypa/cibuildwheel@v2.12.3
31
+ uses: pypa/cibuildwheel@v2.19.1
32
32
  # to supply options, put them in 'env', like:
33
33
  env:
34
34
  CIBW_ARCHS_LINUX: ${{matrix.arch}}
35
- CIBW_BEFORE_BUILD: pip install oldest-supported-numpy
35
+ CIBW_BEFORE_BUILD: pip install numpy setuptools wheel cython
36
36
 
37
37
  - uses: actions/upload-artifact@v2
38
38
  with:
@@ -1,6 +1,31 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ 1.14.2
5
+ ------
6
+
7
+ * install: bump python to 3.8, add cnp.import\_array()
8
+ * ci: re-add macos, remove travis, appveyor
9
+ * ci: use numpy without qualification
10
+ * ci: properly specify numpy 2.0 and use working artifact uploader
11
+ * ci: switch to compiling with numpy 2.0
12
+ * ci: use non-buggy version of cibuildwheel
13
+ * refactor: remove COUNT\_T
14
+ * redesign: remove \_\_version\_\_ attribute
15
+ * perf: reduce memory usage during finaly copy for unique\_via\_sort
16
+ * fix: unique supports large arrays for the counts
17
+ * fix: accurate unique counts for large arrays
18
+ * build: more modernizations
19
+
20
+ 1.14.1
21
+ ------
22
+
23
+ * build: temporarily exclude macos until ecosystem fixes itself
24
+ * chore: ignore fastremap.cpp
25
+ * chore: ignore fastremap.cpp
26
+ * build: update for py312
27
+ * build: update build
28
+
4
29
  1.14.0
5
30
  ------
6
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastremap
3
- Version: 1.14.0
3
+ Version: 1.14.2
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
@@ -214,5 +214,5 @@ Classifier: Programming Language :: Python :: 3.9
214
214
  Classifier: Programming Language :: Python :: 3.10
215
215
  Classifier: Programming Language :: Python :: 3.11
216
216
  Classifier: Topic :: Utilities
217
- Requires-Python: >=3.7,<4.0
217
+ Requires-Python: >=3.8,<4.0
218
218
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastremap
3
- Version: 1.14.0
3
+ Version: 1.14.2
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
@@ -214,5 +214,5 @@ Classifier: Programming Language :: Python :: 3.9
214
214
  Classifier: Programming Language :: Python :: 3.10
215
215
  Classifier: Programming Language :: Python :: 3.11
216
216
  Classifier: Topic :: Utilities
217
- Requires-Python: >=3.7,<4.0
217
+ Requires-Python: >=3.8,<4.0
218
218
  Description-Content-Type: text/markdown
@@ -1,13 +1,10 @@
1
1
  .dockerignore
2
- .travis.yml
3
2
  AUTHORS
4
3
  ChangeLog
5
4
  LICENSE
6
5
  README.md
7
- appveyor.yml
8
6
  automated_test.py
9
7
  build_linux.sh
10
- fastremap.cpp
11
8
  fastremap.pxd
12
9
  fastremap.pyx
13
10
  ipt.hpp
@@ -0,0 +1 @@
1
+ {"git_version": "9b0e91f", "is_release": true}
@@ -29,9 +29,9 @@ import operator
29
29
 
30
30
  import numpy as np
31
31
  cimport numpy as cnp
32
+ cnp.import_array()
32
33
 
33
- __version__ = '1.14.0'
34
- __VERSION__ = __version__
34
+ from libcpp.vector cimport vector
35
35
 
36
36
  ctypedef fused UINT:
37
37
  uint8_t
@@ -746,6 +746,7 @@ def _pixel_pairs(cnp.ndarray[ALLINT, ndim=1] labels):
746
746
 
747
747
  return pairs
748
748
 
749
+ @cython.binding(True)
749
750
  def unique(labels, return_index=False, return_inverse=False, return_counts=False, axis=None):
750
751
  """
751
752
  Compute the sorted set of unique labels in the input array.
@@ -853,42 +854,42 @@ def unique_via_sort(cnp.ndarray[ALLINT, ndim=1] labels):
853
854
 
854
855
  cdef size_t voxels = labels.size
855
856
 
856
- cdef cnp.ndarray[ALLINT, ndim=1] uniq = np.zeros((voxels,), dtype=labels.dtype)
857
- cdef cnp.ndarray[uint32_t, ndim=1] counts = np.zeros((voxels,), dtype=np.uint32)
857
+ cdef vector[ALLINT] uniq
858
+ uniq.reserve(100)
859
+
860
+ cdef vector[uint64_t] counts
861
+ counts.reserve(100)
858
862
 
859
863
  cdef size_t i = 0
860
- cdef size_t j = 0
861
864
 
862
865
  cdef ALLINT cur = labels[0]
863
- cdef size_t accum = 1
866
+ cdef uint64_t accum = 1
864
867
  for i in range(1, voxels):
865
868
  if cur == labels[i]:
866
869
  accum += 1
867
870
  else:
868
- uniq[j] = cur
869
- counts[j] = accum
871
+ uniq.push_back(cur)
872
+ counts.push_back(accum)
870
873
  accum = 1
871
874
  cur = labels[i]
872
- j += 1
873
875
 
874
- uniq[j] = cur
875
- counts[j] = accum
876
+ uniq.push_back(cur)
877
+ counts.push_back(accum)
878
+
879
+ del labels
876
880
 
877
- return uniq[:j+1], counts[:j+1]
881
+ return np.array(uniq), np.array(counts)
878
882
 
879
883
  @cython.boundscheck(False)
880
884
  @cython.wraparound(False) # turn off negative index wrapping for entire function
881
885
  @cython.nonecheck(False)
882
- def unique_via_array(cnp.ndarray[ALLINT, ndim=1] labels, size_t max_label, return_index=False):
883
- """
884
- unique(cnp.ndarray[ALLINT, ndim=1] labels, return_counts=False)
885
-
886
- Faster implementation of np.unique that depends
887
- on the maximum label in the array being less than
888
- the size of the array.
889
- """
890
- cdef cnp.ndarray[uint32_t, ndim=1] counts = np.zeros(
891
- (max_label+1,), dtype=np.uint32
886
+ def unique_via_array(
887
+ cnp.ndarray[ALLINT, ndim=1] labels,
888
+ size_t max_label,
889
+ return_index
890
+ ):
891
+ cdef cnp.ndarray[uint64_t, ndim=1] counts = np.zeros(
892
+ (max_label+1,), dtype=np.uint64
892
893
  )
893
894
  cdef cnp.ndarray[uintptr_t, ndim=1] index
894
895
 
@@ -916,8 +917,8 @@ def unique_via_array(cnp.ndarray[ALLINT, ndim=1] labels, size_t max_label, retur
916
917
  cdef cnp.ndarray[ALLINT, ndim=1] segids = np.zeros(
917
918
  (real_size,), dtype=labels.dtype
918
919
  )
919
- cdef cnp.ndarray[uint32_t, ndim=1] cts = np.zeros(
920
- (real_size,), dtype=np.uint32
920
+ cdef cnp.ndarray[uint64_t, ndim=1] cts = np.zeros(
921
+ (real_size,), dtype=np.uint64
921
922
  )
922
923
  cdef cnp.ndarray[uintptr_t, ndim=1] idx
923
924
 
@@ -22,8 +22,8 @@ if sys.platform == 'darwin':
22
22
  extra_compile_args += ['-stdlib=libc++', '-mmacosx-version-min=10.9']
23
23
 
24
24
  setuptools.setup(
25
- setup_requires=['pbr', 'numpy'],
26
- python_requires=">=3.7,<4.0",
25
+ setup_requires=['pbr', 'cython', 'numpy'],
26
+ python_requires=">=3.8,<4.0",
27
27
  pbr=True,
28
28
  ext_modules=[
29
29
  setuptools.Extension(
@@ -0,0 +1,21 @@
1
+ import fastremap
2
+ import numpy as np
3
+
4
+ x = np.ones((1700,1700,1700), dtype=np.uint8)
5
+ uniq, cts = fastremap.unique(x, return_counts=True)
6
+ print(uniq, cts)
7
+
8
+ print(cts[0] / 2**32)
9
+
10
+
11
+ # @profile
12
+ # def run():
13
+ # x = np.ones( (512,512,512), dtype=np.uint32, order='C')
14
+ # x += 1
15
+ # print(x.strides, x.flags)
16
+ # y = np.asfortranarray(x)
17
+ # print(x.strides, x.flags)
18
+
19
+ # print("done.")
20
+
21
+ # run()
@@ -1,10 +1,12 @@
1
1
  [tox]
2
- envlist = py38,py38,py310,py311
2
+ envlist = py38,py39,py310,py311,py312
3
3
 
4
4
  [testenv]
5
5
  platform = darwin
6
6
  deps =
7
7
  oldest-supported-numpy
8
+ setuptools
9
+ wheel
8
10
  -rrequirements.txt
9
11
  -rrequirements_dev.txt
10
12
 
@@ -1,17 +0,0 @@
1
- language: python
2
- python:
3
- - '3.6'
4
- - '3.7'
5
- - '3.8'
6
- - '3.9'
7
- before_install:
8
- - sudo apt-get install python3-pip
9
- install:
10
- - virtualenv -p python3 venv
11
- - source venv/bin/activate
12
- - pip3 install -r requirements.txt -r requirements_dev.txt
13
- - pip3 install -e .
14
- - python3 setup.py sdist bdist_wheel --universal
15
- script:
16
- - python3 -m pytest -v -x automated_test.py
17
-
@@ -1,41 +0,0 @@
1
- image: Visual Studio 2019
2
-
3
- environment:
4
- matrix:
5
- - PYTHON: "C:\\Python37"
6
- - PYTHON: "C:\\Python38"
7
- - PYTHON: "C:\\Python39"
8
- - PYTHON: "C:\\Python310-x64"
9
- - PYTHON: "C:\\Python37-x64"
10
- - PYTHON: "C:\\Python38-x64"
11
- - PYTHON: "C:\\Python39-x64"
12
- - PYTHON: "C:\\Python310-x64"
13
-
14
- install:
15
- # We need wheel installed to build wheels
16
- - "%PYTHON%\\python.exe -m pip install wheel"
17
-
18
- build: off
19
-
20
- test_script:
21
- # Put your test command here.
22
- # If you don't need to build C extensions on 64-bit Python 3.3 or 3.4,
23
- # you can remove "build.cmd" from the front of the command, as it's
24
- # only needed to support those cases.
25
- # Note that you must use the environment variable %PYTHON% to refer to
26
- # the interpreter you're using - Appveyor does not do anything special
27
- # to put the Python version you want to use on PATH.
28
- - "%PYTHON%\\python.exe -m pip install -r requirements.txt pytest"
29
- - "%PYTHON%\\python.exe -m pip install -e ."
30
- - "%PYTHON%\\python.exe -m pytest -v -x automated_test.py"
31
-
32
- after_test:
33
- # This step builds your wheels.
34
- # Again, you only need build.cmd if you're building C extensions for
35
- # 64-bit Python 3.3/3.4. And you need to use %PYTHON% to get the correct
36
- # interpreter
37
- - "%PYTHON%\\python.exe setup.py bdist_wheel"
38
-
39
- artifacts:
40
- # bdist_wheel puts your built wheel in the dist directory
41
- - path: dist\*