dask-awkward
dask-awkward copied to clipboard
support for dask_awkward.mean() needed
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!
https://github.com/dask-contrib/dask-awkward/blob/main/src/dask_awkward/lib/reducers.py#L329
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
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 :/
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.
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
Agree, this is a two-line fix when someone has the time.