You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
that is, it's a dask array that, whenever you try to call compute or np.asarray, will re-open the underlying file (with self.wrapped.ctx is essentially just with ND2File()....)
It looks a tad bit risky at first, but I haven't run into any issues with it yet. In any case, I suspect the issue of trying to use a dask array after closing the file is far more common than whatever hidden issues there are with this proxy. I'm inclined to try it
The hidden issues are coming out of hiding.
Where the NEP-18 mechanism would dispatch the dask array method corresponding to a numpy method when passing a dask array to the numpy method, this no longer works with the DaskArrayProxy. This triggers a compute() on the array underlying the proxy where no compute() would have happened on a non-proxied array. In my case (large array) that kills the Linux kernel.
For me, the convenience of using NEP-18 dispatch almost outweighs the problem of a few open file handles without the array proxy.
I guess the chances to get numpy to support ObjectProxies with NEP18 as well are fairly slim.
The text was updated successfully, but these errors were encountered:
Challenge accepted! :). Thanks this is exactly what I was looking to find. Your tests are very helpful. Worse case scenario I can make returning the proxy an optional parameter
Description
In this #19 (comment), @tlambert03 wrote:
The hidden issues are coming out of hiding.
Where the NEP-18 mechanism would dispatch the dask array method corresponding to a numpy method when passing a dask array to the numpy method, this no longer works with the
DaskArrayProxy
. This triggers acompute()
on the array underlying the proxy where nocompute()
would have happened on a non-proxied array. In my case (large array) that kills the Linux kernel.To reproduce (here I use a 4d nd2-file):
test_nd2.py
Running these tests shows the problem
For me, the convenience of using NEP-18 dispatch almost outweighs the problem of a few open file handles without the array proxy.
I guess the chances to get numpy to support ObjectProxies with NEP18 as well are fairly slim.
The text was updated successfully, but these errors were encountered: