numexpr icon indicating copy to clipboard operation
numexpr copied to clipboard

multidimensional output

Open FrancescAlted opened this issue 11 years ago • 2 comments

From [email protected] on June 05, 2012 22:59:55

This is an enhancement request.

I frequently need to create multidimensional histograms from data stored in PyTables, usually of variables computed from the various columns of the table. tables.Expr is a very natural way to do this, but it is a bit cumbersome for multiple dimensions and I expect could be more efficient. For instance:

histdata = array([
  tables.Expr("col1**2", vars(mytable.cols)),
  tables.Expr("col2 * (col3 + col4) * exp(col1*(3.84/400.))", vars(mytable.cols))
  tables.Expr("col5", vars(mytable.cols))])
hist, edges = histogramdd(histdata.T)

It would be really great, reducing either typing or code complexity, if I could instead generate a 2-dimensional array from just one numexpr call, like:

histdata = tables.Expr("[col1**2, col2 * (col3+col4), col5]", vars(mytable.cols))
hist, edges = histogramdd(histdata.T)

And I suspect that this would be more efficient as well. Regards, Jon

Original issue: http://code.google.com/p/numexpr/issues/detail?id=85

FrancescAlted avatar Jan 22 '14 10:01 FrancescAlted

I'd also like to see this, for performance reasons. Is there a technical reason (not just lack of developer time) this feature isn't yet implemented?

maedoc avatar Feb 27 '15 14:02 maedoc

I am not sure, but probably this could be done, yes. Do you want to have it a try and send a pull request?

FrancescAlted avatar Apr 14 '15 11:04 FrancescAlted

Message to comment on stale issues. If none provided, will not mark issues stale

github-actions[bot] avatar Feb 23 '24 01:02 github-actions[bot]