BUG : changed logic on converting to scalar

Instead of checking on size == 1 check on ndim == 0.  This
matters for `tt.sum()` (should covert to scalar) vs
`tt.sum(keepdims=True)` (should not convert to scalar).
TST : added tests of to-scalar casting
Merge pull request #50 from tacaswell/frame_tweak

BUG : changed logic on converting to scalar