BUG: ensure percentile has same output structure as in 1.8

percentile returned scalars and lists of arrays in 1.8
adapt new percentile to return scalar and arrays with q dimension first
for compatibility.