impy-array 2.4.1__py3-none-any.whl → 2.4.2__py3-none-any.whl

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.
impy/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "2.4.1"
1
+ __version__ = "2.4.2"
2
2
  __author__ = "Hanjin Liu"
3
3
  __email__ = "liuhanjin-sc@g.ecc.u-tokyo.ac.jp"
4
4
 
@@ -130,4 +130,4 @@ def check_glcm(self, bins, rescale_max):
130
130
  raise ValueError(f"`bins` must be a divisor of {imax+1} (max value of {self.dtype}).")
131
131
  self = self // ((imax+1) // bins)
132
132
 
133
- return self, bins, rescale_max
133
+ return self, bins, rescale_max
@@ -37,4 +37,4 @@ def ball_like_odd(radius, ndim):
37
37
  l = xc*2 + 1
38
38
  coords = xp.indices((l,)*ndim)
39
39
  s = xp.sum((a-xc)**2 for a in coords)
40
- return xp.array(s <= radius*radius, dtype=bool)
40
+ return xp.array(s <= radius*radius, dtype=bool)
impy/arrays/lazy.py CHANGED
@@ -281,6 +281,12 @@ class LazyImgArray(AxesMixin):
281
281
  chunk_info = ", ".join([f"{s}({o})" for s, o in zip(self.chunksize, self.axes)])
282
282
  return chunk_info
283
283
 
284
+ def astype(self, dtype: DTypeLike, copy: bool = True) -> LazyImgArray:
285
+ """Convert the array to the specified data type."""
286
+ out = self.__class__(self.value.astype(dtype, copy=copy))
287
+ out._set_info(self)
288
+ return out
289
+
284
290
  def _repr_dict_(self):
285
291
  return {
286
292
  "name": self.name,
@@ -555,9 +561,9 @@ class LazyImgArray(AxesMixin):
555
561
  dtype = self.dtype
556
562
  all_axes = str(self.axes)
557
563
  def _func(input: xp.ndarray, *args, **kwargs):
558
- out = xp.empty(input.shape, input.dtype)
564
+ out = xp.empty(input.shape, dtype=dtype)
559
565
  for sl in iter_slice(input.shape, c_axes, all_axes):
560
- out[sl] = func(input[sl], *args, **kwargs)
566
+ out[sl] = func(input[sl], *args, **kwargs).astype(dtype, copy=False)
561
567
  return out
562
568
  depth = switch_slice(c_axes, self.axes, 0, depth)
563
569
  return da.map_overlap(
impy/arrays/tiled.py CHANGED
@@ -94,9 +94,12 @@ class TiledImage(Generic[_T]):
94
94
  from dask import array as da
95
95
 
96
96
  input = da.from_array(img.value, chunks=self._chunks)
97
+
98
+ def _func(arr: np.ndarray, *args, **kwargs) -> np.ndarray:
99
+ return func(arr, *args, **kwargs).astype(arr.dtype, copy=False)
97
100
  out: np.ndarray = xp.asnumpy(
98
101
  da.map_overlap(
99
- func,
102
+ _func,
100
103
  input,
101
104
  *args,
102
105
  depth=self.depth,
@@ -114,6 +117,7 @@ class TiledImage(Generic[_T]):
114
117
  c_axes="",
115
118
  depth=self.depth,
116
119
  boundary=self.boundary,
120
+ dtype=img.dtype,
117
121
  args=args,
118
122
  kwargs=kwargs,
119
123
  )
impy/core.py CHANGED
@@ -121,8 +121,11 @@ def array(
121
121
  dtype = arr.dtype
122
122
 
123
123
  axes, name = _normalize_params(axes, name, like)
124
-
125
- _arr = np.array(arr, dtype=dtype, copy=copy)
124
+
125
+ if copy:
126
+ _arr = np.array(arr, dtype=dtype)
127
+ else:
128
+ _arr = np.asarray(arr, dtype=dtype)
126
129
 
127
130
  # Automatically determine axes
128
131
  if axes is None:
impy/utils/gauss.py CHANGED
@@ -156,4 +156,4 @@ class GaussianBackground(DiagonalGaussian):
156
156
  self.sg = np.array(data.shape, dtype="float32")
157
157
  self.b, p95 = np.percentile(data, [5, 95])
158
158
  self.a = p95 - self.b
159
- return None
159
+ return None
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: impy-array
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: Speed up coding/extending image analysis in Python.
5
5
  Project-URL: Download, https://github.com/hanjinliu/impy
6
6
  Author-email: Hanjin Liu <liuhanjin-sc@g.ecc.u-tokyo.ac.jp>
@@ -1,11 +1,11 @@
1
- impy/__init__.py,sha256=Dd8i53lTgoq40fXeqOhduClsprYXWdeDZM_0Ug7i5Ys,1156
1
+ impy/__init__.py,sha256=M7Oaq8B-E8YxJ8pV2_YZtQ9BJ-6TNAyFhtOp-lCu0m8,1156
2
2
  impy/__main__.py,sha256=BAQkQ4X8EFo42pbNx__EqpZ5KL4MTfTUWsVbJIQF0O0,4974
3
3
  impy/_const.py,sha256=XFkgkyqs_clQJDqr2vdh5rCyfM83iMFChOLJjwNWHtM,3736
4
4
  impy/_types.py,sha256=gO4l0hx9qxe6eI0PyC4ukW3k4IYxCEZ9gT-rQ3jj3zU,808
5
5
  impy/array_api.py,sha256=ADhMON5xTpjBG5MDOjUTthXzYSvm9zJNy8bL8RliI64,5843
6
6
  impy/binder.py,sha256=CTMb11g6uYDVVQV5Wtef865IO0G2V3vGXc8SiGYRD5k,9651
7
7
  impy/collections.py,sha256=2e55bLjZN7W4LFUCkyxekcDfLwZodMaU4JG5NQ3RS54,10946
8
- impy/core.py,sha256=q-9QZLKRqIKsI2knkxu5P4Tacq3FUIvFHjjUThZDuiM,25580
8
+ impy/core.py,sha256=k4l4DY-kYE_6Kr6cVoZ2OPDP16XJVyShE2i0vaHGBNM,25639
9
9
  impy/correlation.py,sha256=CoNboXiZjO1VYqA0rHe4Jp6gDYt6hyJtSgI3TWepxKk,28398
10
10
  impy/io.py,sha256=TFdGD3sGfmbkFI4FwfsemiTmk6cIgksbvhnFt7F24ac,22269
11
11
  impy/random.py,sha256=TqPL8oFYGtZlr4phWyMSgP7KLqsXLH9LM3Fx1LxQWjA,6973
@@ -17,22 +17,22 @@ impy/arrays/big.py,sha256=0KPG_V7yKiVYLFwzGfHRxyFD2kysIyVppsq6hh7TFPg,2809
17
17
  impy/arrays/imgarray.py,sha256=oqFXASNXJ2neVy3HWp8uaPdncojgvLNsc5UvaW4tbWE,155622
18
18
  impy/arrays/label.py,sha256=l0SZXcZxU8qwUgj0QZPZ32XsNaoBtenlrn6hNR03SPI,6406
19
19
  impy/arrays/labeledarray.py,sha256=4WBzorvLM9mmrkuytjMJb7ucqJqK62ioY6eTZlbNh3M,56540
20
- impy/arrays/lazy.py,sha256=r56r6_68BMopZoTG75L8JV3PA-vtR6l-jBzhDTaZLGY,55151
20
+ impy/arrays/lazy.py,sha256=kDQvH2dwLO5C6nXwrzWhUtkje2tMjy6T2Dnx7x7R8Fk,55436
21
21
  impy/arrays/phasearray.py,sha256=IojWaNs5sEujn6Lhgqe00H0xF-4CZEFWt5cVW6U_DWQ,13981
22
22
  impy/arrays/specials.py,sha256=4sNg_zeJUce_rwnasPoyL2eZ0-gx_4Z-KwitmLB4a5k,7896
23
- impy/arrays/tiled.py,sha256=eYbFOJ2sI9d6PqH83t1WdA8l2dmYb-1FMViGPl4_Lus,7565
23
+ impy/arrays/tiled.py,sha256=4uGQKmZ0w2ZHlZNB1kl_4XP4hU1AftO21k6DgyJ1cUw,7767
24
24
  impy/arrays/_utils/__init__.py,sha256=M5HogfyUBvV8kp-X1ZthS8vDLUP7-O2f9Gvsc1ZXdT8,271
25
25
  impy/arrays/_utils/_corr.py,sha256=8RM_OeaDsrewhiYhf6wFkDYRfl1gQ8Sg2TTK4CT22K4,10031
26
26
  impy/arrays/_utils/_deconv.py,sha256=dCFWDPY6pkJxmqec5H0i1wtJECACvnz5vv1YIVLbnSY,2985
27
27
  impy/arrays/_utils/_docs.py,sha256=AT6tRxXcX433FCfPXhE9wsaeduy_Um44KOqrYHYTFZE,4968
28
28
  impy/arrays/_utils/_filters.py,sha256=aigQnaURbUnmOXGDxkWksISWQbKAUdwtS8kzbaMzgoQ,7226
29
- impy/arrays/_utils/_glcm.py,sha256=X499c4QMwdQAZas8rQbfdEpt5moosxNkTgyayTRJMvU,4149
29
+ impy/arrays/_utils/_glcm.py,sha256=AoUP-p1MPtAzP0Eyt_DEE_wZYwezNICzdkXMBY-OEBo,4150
30
30
  impy/arrays/_utils/_linalg.py,sha256=06jnv-P6nwUjYVTHX2f9i-KDSYZ0bxwNfWWP8A8e_Vw,3233
31
31
  impy/arrays/_utils/_misc.py,sha256=jB16bZOYPEx_3JHGA-EIVziBjmaySPv66oyT_PZg_cI,2839
32
32
  impy/arrays/_utils/_plot.py,sha256=AzY33TBzQ97DaTZu_EIu5GpN-sUTLKY1tY2qu76Ro10,5077
33
33
  impy/arrays/_utils/_process_numba.py,sha256=1WjNRwqggSMYyKLeXo6W97lm93A47cAFvR6sBF086PI,3428
34
34
  impy/arrays/_utils/_skimage.py,sha256=p10aiqIgXvPH8j_7iy_fbWD08jMolHSd1WJZAemDAEk,808
35
- impy/arrays/_utils/_structures.py,sha256=GSwroP5CPP9MUuZHhrbJhO_Q9fc8u1hwBqiz-2koGJY,1300
35
+ impy/arrays/_utils/_structures.py,sha256=K0gHjv9lF90wizAvFZQyHF02l2TC-texdYJTfB5I2H8,1301
36
36
  impy/arrays/_utils/_transform.py,sha256=fdee-qTWbdnQec-o9f2Z9HPjfsJVaVNn5sDPcNeVyLg,12682
37
37
  impy/arrays/bases/__init__.py,sha256=aHsAYta5CQkEDlbFShEtEGYN89N2qYedg99SM6Oo7wk,99
38
38
  impy/arrays/bases/metaarray.py,sha256=2ob-t2bZqOgMYdt0AN02p3eAGtcQPhehuOLtoDs442k,29832
@@ -50,15 +50,15 @@ impy/lazy/random.py,sha256=2rwHRsHPOvi8tI9kTtGuZ5SzN0MA7yn-30bZSvHeLVc,7713
50
50
  impy/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  impy/utils/axesop.py,sha256=c86XdNlUBFLrwHhAT2j0eELxopNe2QEVaNeOQhXr2do,3076
52
52
  impy/utils/deco.py,sha256=lItN0UdadZsjI9eW3fI402k7DNR9jcnD6ZgjdkYsDdg,5946
53
- impy/utils/gauss.py,sha256=735vYhSVrgZGiZeHYrwjVkRsQ-Zx5dYghOSrtfD3s4o,4712
53
+ impy/utils/gauss.py,sha256=_jvmaUYSRB8KvX9Qp36rhNaNw9lllf68g_43wshpAMo,4713
54
54
  impy/utils/misc.py,sha256=zV_NeqEaiTW4Rki5fqWfspQjczRaoTJ5MxTOUx6qstY,622
55
55
  impy/utils/slicer.py,sha256=OR-PMILYBihY0jE38wIpS4QI30fk1c7D6LxaG_fDi_w,2423
56
56
  impy/utils/utilcls.py,sha256=3Td9G2ZkU4C0BiW2LH0sq7RBjdco_BtyxNr-s-seLhs,437
57
57
  impy/viewer/__init__.py,sha256=NTVonxd7HMfbRXHhjLBMG_07NjFia-O1QCv5IOKdbgw,286
58
58
  impy/viewer/utils.py,sha256=BUQ-hUN_j_hNON9F3B63670b-h6fIPxOB4fbAJnbSGg,12236
59
59
  impy/viewer/viewer.py,sha256=Sfq-obSLoHkBkIW0NDWCxEEaX7-YsC4ifAJ-nxpvJws,17632
60
- impy_array-2.4.1.dist-info/METADATA,sha256=5C3Nzq36x3irOWynCznvnNrSYu6lVEfDWtaw-ji0Y48,7526
61
- impy_array-2.4.1.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
62
- impy_array-2.4.1.dist-info/entry_points.txt,sha256=reyrgy4odXvi1CcPOIIyRYBmsNGG2tO7ZkFOdG5CBkU,44
63
- impy_array-2.4.1.dist-info/licenses/LICENSE,sha256=rpxKafH9r42sxLLYYB5VbZBHOdtYeLuYJjVU1LBwrxk,1546
64
- impy_array-2.4.1.dist-info/RECORD,,
60
+ impy_array-2.4.2.dist-info/METADATA,sha256=-EtubqJsd6j1ep3ncb6wBKMz17HV7YrXqD6qJSzgJQ8,7526
61
+ impy_array-2.4.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
62
+ impy_array-2.4.2.dist-info/entry_points.txt,sha256=reyrgy4odXvi1CcPOIIyRYBmsNGG2tO7ZkFOdG5CBkU,44
63
+ impy_array-2.4.2.dist-info/licenses/LICENSE,sha256=rpxKafH9r42sxLLYYB5VbZBHOdtYeLuYJjVU1LBwrxk,1546
64
+ impy_array-2.4.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.21.1
2
+ Generator: hatchling 1.24.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any