Repository navigation
Conversation
GenevieveBuckley
left a comment
There was a problem hiding this comment.
This is great! All the explanatory detail at each step is really nice, and all the shapely diagrams are very helpful for understanding what's happening at each step.
I have some comments for you on the DaskFusion_Example.ipynb notebook. I've also looked at the diffs for the non-notebook code, and that all looks reasonable, no comments there.
- chardet should added to requirements.txt (see #2)
- It's difficult to notice the (0,0) point coordinate in the shapely drawing (code cell 10). You might want to add a sentence describing where to look for it, eg:
Let's create shapely objects from the numpy arrays that hold the corner points. If we also include the a shapely Point at (0,0) we can visualize where the tiles are with respect to the origin of the joint coordinate system. You can see this point at the bottom left corner of the next diagram."
and/or
"As we can see above, the image tiles are a fair way away from the origin in the bottom left corner."
- I get a shapely deprecation warning (code cell 21). I think you need to set custom attributes on the geometry object, so if it's not easy to update the code, then we should add an upper bound to the shapely version specified in requirements.txt. We don't want the notebook to have an error in the future.
/tmp/ipykernel_77756/2267014653.py:4: ShapelyDeprecationWarning: Setting custom attributes on geometry objects is deprecated, and will raise an AttributeError in Shapely 2.0 tile_shifted_shapely.fuse_info = {'file':file, 'transform':transform} - Newer versions of napari should not need
%gui qtin the notebook. We should be able to remove this cell, and the sleep cell after it.
|
Thanks, very useful comments. What a shame that shapely will deprecate setting custom attributes. I just thought that would be a neat thing to do (and my version doesn't throw a deprecation warning). I think I might just pin the requirements to a version that doesn't raise this warning for the purposes of this demo. One question I forgot to ask: Some of the core action happens in the Also, one of the peculiar things about functions that get passed to |
How about including a markdown cell with a copy of the function text, plus the explanation detail you want to draw attention to? That way you can keep |
|
Re: your stackoverflow question
I don't think you have to include this check. I'm struggling to see when it would prevent an error in practice. There's two steps with Dask: building the task graph, then computing the result. import dask.array as da
def func(array_chunk, block_info=None):
print(f"Is block_info None?: {block_info is None}")
print(f"block_info: {block_info} \n")
return array_chunk
arr = da.random.random((100,100), chunks=(50,50))
# Construct Dask task graph
out = arr.map_blocks(func, dtype=arr.dtype)# Compute Dask task graph
# we're using the single-threaded scheduler for easier reasoning about what happens in which order
out.compute(scheduler='single-threaded')
I don't quite understand what you are asking in this part of your question. Leave it out from where? |
|
tbh one thing I don't fully understand is why the |
|
FYI, Ian is starting a new dask discourse forum here: https://dask.discourse.group/ |
Was wondering about that too at first and then figured out that |
Ooooh, ok! |
|
I implemented your suggestions, @GenevieveBuckley
I also expanded the explanations for Will merge this now. |
Tidying up code for dask blog post