Skip to content

Commit 0154da1

Browse files
authored
Merge branch 'main' into ome-ngff
2 parents 3628830 + 0b67093 commit 0154da1

File tree

7 files changed

+25
-15
lines changed

7 files changed

+25
-15
lines changed

.github/workflows/black.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python Black
1+
name: black
22

33
on: [push, pull_request]
44

.github/workflows/mypy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python mypy
1+
name: mypy
22

33
on: [push, pull_request]
44

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish
1+
name: pypi
22

33
on:
44
push:

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: tests
22

33
on:
44
push:

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
[![tests](https://github.com/funkelab/funlib.persistence/actions/workflows/tests.yaml/badge.svg)](https://github.com/funkelab/funlib.persistence/actions/workflows/tests.yaml)
22
[![black](https://github.com/funkelab/funlib.persistence/actions/workflows/black.yaml/badge.svg)](https://github.com/funkelab/funlib.persistence/actions/workflows/black.yaml)
33
[![mypy](https://github.com/funkelab/funlib.persistence/actions/workflows/mypy.yaml/badge.svg)](https://github.com/funkelab/funlib.persistence/actions/workflows/mypy.yaml)
4+
[![pypi](https://github.com/funkelab/funlib.persistence/actions/workflows/publish.yaml/badge.svg)](https://pypi.org/project/funlib.persistence/)
45

56
# funlib.persistence
67
Interfaces for data (arrays and graphs) and storage formats (databases and file formats)
78

89
# installation
9-
regular installation for usage:
10-
`pip install .`
11-
developer installation including pytest etc.:
12-
`pip install ".[dev]"`
10+
Regular installation for usage:
11+
`pip install funlib.persistence`
12+
13+
Developer installation including pytest etc.:
14+
`pip install funlib.persistence[dev]`
1315

funlib/persistence/arrays/array.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,13 @@ def __setitem__(self, key, value: np.ndarray):
323323

324324
self._source_data[region_slices] = value
325325

326+
# If the source data is an in-memory numpy array, writing to the numpy
327+
# array does not always result in the dask array reading the new data.
328+
# It seems to be a caching issue. To work around this, we create a new
329+
# dask array from the source data.
330+
if isinstance(self._source_data, np.ndarray):
331+
self.data = da.from_array(self._source_data)
332+
326333
else:
327334
raise RuntimeError(
328335
"This array is not writeable since you have applied a custom callable "

tests/test_array.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,14 @@ def test_setitem():
7373

7474
a = Array(np.zeros((2, 5)), (0, 0), (1, 1))
7575

76-
a[Roi((0, 0), (2, 5))] = np.arange(0, 10).reshape(2, 5)
77-
assert a[Coordinate((0, 0))] == 0
78-
assert a[Coordinate((0, 1))] == 1
79-
assert a[Coordinate((0, 2))] == 2
80-
assert a[Coordinate((1, 0))] == 5
81-
assert a[Coordinate((1, 1))] == 6
82-
assert a[Coordinate((1, 4))] == 9
76+
data = np.arange(0, 10).reshape(2, 5)
77+
a[Roi((0, 0), (2, 5))] = data
78+
assert a[Coordinate((0, 0))] == a._source_data[0, 0] == 0
79+
assert a[Coordinate((0, 1))] == a._source_data[0, 1] == 1
80+
assert a[Coordinate((0, 2))] == a._source_data[0, 2] == 2
81+
assert a[Coordinate((1, 0))] == a._source_data[1, 0] == 5
82+
assert a[Coordinate((1, 1))] == a._source_data[1, 1] == 6
83+
assert a[Coordinate((1, 4))] == a._source_data[1, 4] == 9
8384

8485
# set entirely with numpy array and channels
8586

0 commit comments

Comments
 (0)