-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify FunctionSource in Map and Reduce #1540
Conversation
36dbc07
to
5fbdb1d
Compare
Codecov Report
@@ Coverage Diff @@
## master #1540 +/- ##
==========================================
+ Coverage 87.48% 87.49% +<.01%
==========================================
Files 145 146 +1
Lines 5058 5036 -22
==========================================
- Hits 4425 4406 -19
+ Misses 633 630 -3
Continue to review full report at Codecov.
|
5fbdb1d
to
a485f7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
general question, and sorry if this has already been discussed. But what's the advantage of having the function source logic over just have a function parameter passed into reduce? Like func=np.max
beaad60
to
95bd2d1
Compare
95bd2d1
to
ab3545d
Compare
ab3545d
to
079358f
Compare
as discussed offline, allowing arbitrary callables to be passed in makes provenance tracking extremely challenging. However, we could plausibly use code inspection to solve that problem. |
e1857ac
to
947124f
Compare
If you see a path where this is achievable, I believe usability benefits strongly from just passing in the function. |
It's somewhat achievable. I'll look into it. |
After PR is merged is OK with me, if this blocks. |
ed418fe
to
eb15634
Compare
|
14d935b
to
1b51899
Compare
67a6870
to
849058e
Compare
bdb0129
to
c647b6d
Compare
93cbd18
to
1cd0b80
Compare
bc1c1ec
to
c193ef5
Compare
Note that this is not entirely for free. The function aliases (example: where we alias 'max' to 'amax' for `FunctionSource.np`) now come from one source, which may or may not be desirable.
c193ef5
to
b042e2d
Compare
In #1540, I missed a conversion from Reduce.FunctionSource to types.FunctionSource.
In #1540, I missed a conversion from Reduce.FunctionSource to types.FunctionSource.
This is syntactic sugar to simplify single map / reduce operations. Right now, we would need to instantiate the filter and then run it against the stack, e.g., ``` max_projector = Filter.Reduce((Axes.CH, Axes.ROUND, Axes.ZPLANE)) max_projected = max_projector.run(stack) ``` With this, it simplifies to: ``` max_projected = stack.reduce((Axes.CH, Axes.ROUND, Axes.ZPLANE), "max") ``` Test plan: Converted imagestack/test/test_max_proj.py to use this idiom. Depends on #1540
This is needed to enable #1539, as that imports
FunctionSource
fromImageStack
(andMap
/Reduce
importImageStack
).Note that this is not entirely for free. The function aliases (example: where we alias 'max' to 'amax' for
FunctionSource.np
) now come from one source, which may or may not be desirable.Test plan: travis yo