Skip to content
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

support for dask_awkward.mean() needed #489

Open
green-cabbage opened this issue Mar 27, 2024 · 6 comments
Open

support for dask_awkward.mean() needed #489

green-cabbage opened this issue Mar 27, 2024 · 6 comments

Comments

@green-cabbage
Copy link

Dear Developers.

Hello, I am one of the graduate students working with dask_awkward within coffea 2023 pacakage, and it seems like support for dask_awkward,mean() function is missing. What I need for my workflow is dask_awkward implementation of mean() function onto a 1 dimensional array, which means support for dask_awkward,mean() either in the axis=None or axis=0, such that something like this is possible:

njet_selection = dak.num(jets, axis=1)
qgl_nom = (qgl1*qgl2) # this is 1 dimensional dak array
qgl_mean = dak.mean(qgl_nom[njet_selection])
qgl_nom = qgl_nom/ qgl_mean

Please let me know if you have any questions or issues!

@green-cabbage green-cabbage changed the title support for dask_awkward,mean() support support for dask_awkward,mean() needed Mar 27, 2024
@green-cabbage green-cabbage changed the title support for dask_awkward,mean() needed support for dask_awkward.mean() needed Mar 27, 2024
@lgray
Copy link
Collaborator

lgray commented Mar 27, 2024

@lgray
Copy link
Collaborator

lgray commented Mar 27, 2024

and it has been in the top level package for some time.

https://github.com/dask-contrib/dask-awkward/blob/main/src/dask_awkward/__init__.py#L56

@green-cabbage
Copy link
Author

green-cabbage commented Mar 27, 2024

https://github.com/dask-contrib/dask-awkward/blob/main/src/dask_awkward/lib/reducers.py#L329

So this only supports axis that is not None or zero. What I am looking for (at least for now) is a mean functionality that that reduces over those axis.
Edit: sorry for the weird closing and opening. I am getting used to this github issue gimmick :/

@martindurant
Copy link
Collaborator

To get the mean, you of course need the sum and a count. I believe both of those are supported, so for axis=None/0, it could call those.

@green-cabbage
Copy link
Author

green-cabbage commented Mar 27, 2024

Just confirmed with a small test code that dak.count() and dak.sum() supports axis=None and axis=0, so this issue is solved. I will reopen this issue if further testing leads to issues. Thanks!

Edit: With request from Nick Manganelli. I won't close this issue as others would also come to the same issue and quit, assuming dak.count() and dak.sum() wouldn't support axis=0 or None if dak.mean() doesn't support it

@martindurant
Copy link
Collaborator

Agree, this is a two-line fix when someone has the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants