numexpr
numexpr copied to clipboard
multidimensional output
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
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?
I am not sure, but probably this could be done, yes. Do you want to have it a try and send a pull request?
Message to comment on stale issues. If none provided, will not mark issues stale