split misc/arraytools.py