adapt the numpy code for copy and 1-D array conversion