Skip to content

What's_happened_to_my_shape_field?

Gijs Molenaar edited this page Feb 12, 2014 · 1 revision

I thought that if a vellset plane had only a scalar number, then a corresponding shape field would be provided so that I can 'relate' the scalar to its 'domain'. Has the shape field gone by the wayside in such cases?

No, if a VellSet is purely scalar, then the shape field is optional. A function that is constant from -inf to +inf along all axes is represented by a scalar w/o a 'shape'. On rare occasions, a node may return create a scalar with a shape, this indicates a function that is constant over the associated domain but not necessarily over all domains. (Note that the former may be cached and reused for any domain, while the latter will have to be recalculated if the domain changes).

So the cells.grid takes absolute precedence, and that's where you should get the shape. Vellsets within the result are guaranteed to have a "conformant" shape, in the sense that each axis i will have either 1 element or len(cells.grid[i]) elements.

Any axis (or set of axes) may be "collapsed" to a size of 1 when a particular Vells is not variable along that axis. This is not just an "information minimizer", it keeps the number of actual computations down throughout a tree -- i.e. you may have a time-variable branch computing 19x1 Vells, and a freq-variable branch computing 1x200 Vells, and only when the two come together in a node does the result become a full 19x200. Above that point, calculations are kept to the minimum necessary. A scalar is an extreme case of this -- e.g. if you have a 5D Cells, you may also think of a scalar as a 1x1x1x1x1 array.

Clone this wiki locally