Get list of zero-valued numpy arrays for
    specified list of numpy arrays

    :param array_list: list of numpy arrays
    :return: list of zeros of same shape as input
337423
def get_neutral(array_list):
    
    res = []
    for x in array_list:
        res.append(np.zeros_like(x))
    return res
715515
def get_array(array, **kw):
    
    for name, value in kw.items():
        array = array[array[name] == value]
    return array
450536
def _fill_array_from_list(the_list, the_array):
        """"""
        for i, val in enumerate(the_list):
            the_array[i] = val
        return the_array
820722
def _mk_uninit_array(self, bounds):
        
        if len(bounds) == 0:
            raise For2PyError("Zero-length arrays current not handled!.")

        this_dim = bounds[0]
        lo,hi = this_dim[0],this_dim[1]
        sz = hi-lo+1

        if len(bounds) == 1:
            return [None] * sz

        sub_array = self._mk_uninit_array(bounds[1:])
        this_array = [copy.deepcopy(sub_array) for i in range(sz)]

        return this_array
534195
def _collect_arrays(self):
        """"""
        # convenient data structures
        self.data_arrays = [[(self.slices[i], e.arg_dict[name]) for i, e in enumerate(self.execs)]
                            for name, _ in self.data_shapes]

        self.state_arrays = [[e.arg_dict[name] for e in self.execs]
                             for name in self.state_names]

        if self.label_shapes is not None:
            self.label_arrays = [[(self.slices[i], e.arg_dict[name])
                                  for i, e in enumerate(self.execs)]
                                 for name, _ in self.label_shapes]
        else:
            self.label_arrays = None

        self.param_arrays = [[exec_.arg_arrays[i] for exec_ in self.execs]
                             for i, name in enumerate(self.arg_names)
                             if name in self.param_names]
        if self.for_training:
            self.grad_arrays = [[exec_.grad_arrays[i] for exec_ in self.execs]
                                for i, name in enumerate(self.arg_names)
                                if name in self.param_names]
        else:
            self.grad_arrays = None

        data_names = [x[0] for x in self.data_shapes]
        if self.inputs_need_grad:
            self.input_grad_arrays = [[exec_.grad_arrays[self.arg_names.index(name)]
                                       for exec_ in self.execs]
                                      for name in data_names if name in self.arg_names]
        else:
            self.input_grad_arrays = None

        self.aux_arrays = [[exec_.aux_arrays[i] for exec_ in self.execs]
                           for i in range(len(self.aux_names))]
482145
def array(self, dimensions=None):
        
        if dimensions is None:
            dims = [d for d in self.kdims + self.vdims]
        else:
            dims = [self.get_dimension(d, strict=True) for d in dimensions]

        columns, types = [], []
        for dim in dims:
            column = self.dimension_values(dim)
            columns.append(column)
            types.append(column.dtype.kind)
        if len(set(types)) > 1:
            columns = [c.astype('object') for c in columns]
        return np.column_stack(columns)
964181
def inverable_group_multi_list(item_lists):
    
    #unique_list1, inverse1 = np.unique(item1_list, return_index=True, return_inverse=True)
    import vtool as vt
    import utool as ut
    # Find uniques and groups in each individual list
    unique_lists = []
    groupx_lists = []
    for item_list in item_lists:
        unique_items, groupxs = vt.group_indices(item_list)
        unique_lists.append(unique_items)
        groupx_lists.append(groupxs)
    # Merge all indexes into a signle long list
    groups_stacked = ut.flatten(groupx_lists)
    flat_stacked, cumsum = ut.invertible_flatten2(unique_lists)
    # Find uniques in those lists
    flat_unique, stack_groups = vt.group_indices(np.array(flat_stacked))
    # Get a list of corresonding group indicies from each input list
    flat_groupx_multilist = [ut.take(groups_stacked, groupx) for groupx in stack_groups]
    # flat_unique corresponds with the aids (hence chips) the flag_groupxs
    # multilist is a list where each item is a tuple who's nth item indexes
    # into the nth input list. Ie (1, 0) is a list of indexes into the 1st chip
    # the 0th keypoint list
    return flat_unique, flat_groupx_multilist
451941
def _indexes(arr):
    
    myarr = np.array(arr)
    if myarr.ndim == 1:
        return list(range(len(myarr)))
    elif myarr.ndim == 2:
        return tuple(itertools.product(list(range(arr.shape[0])),
                                       list(range(arr.shape[1]))))
    else:
        raise NotImplementedError('Only supporting arrays of dimension 1 and 2 as yet.')
617621
def array_values(expr):
    """"""
    if isinstance(expr, Array):
        return expr.get_elems(all_subs(expr._bounds))
    elif isinstance(expr, list):
        vals = [array_values(x) for x in expr]
        return flatten(vals)
    else:
        return [expr]
1279136
def getArrays(self, attr=None, sort=False, reverse=False,
                  selector=None, defaultValue=None, report='lfq'):
        
        selector = (lambda fgi: fgi.isValid) if selector is None else selector
        attr = attr if attr is not None else []
        attr = set(['id', 'intensities'] + aux.toList(attr))
        items = self.getItems(sort, reverse, selector)
        arrays = _getArrays(items, attr, defaultValue)

        for specfile in self._matrixTemplate:
            arrays[specfile] = list()
        for intensities in arrays['intensities']:
            for specfile, intensitiy in zip(self._matrixTemplate, intensities):
                arrays[specfile].append(intensitiy)
        for specfile in self._matrixTemplate:
            arrays[specfile] = numpy.array(arrays[specfile],
                                           dtype=numpy.float64
                                           )
        del arrays['intensities']

        return arrays
435922
def check_array_struct(array):
    

    #If a list is transformed into a numpy array and the sub elements
    #of this array are still lists, then numpy failed to fully convert
    #the list, meaning it is not symmetrical.
    try:
        arr = np.array(array)
    except:
        raise HydraError("Array %s is not valid."%(array,))
    if type(arr[0]) is list:
        raise HydraError("Array %s is not valid."%(array,))
1192703
def _int_array_hash(input_list):
        

        list_len = len(input_list)
        arr_len = len(input_list[0])
        mult_arr = np.full(arr_len, 1000003, dtype=np.long)
        value_arr = np.full(arr_len, 0x345678, dtype=np.long)

        for i, current_arr in enumerate(input_list):
            index = list_len - i - 1
            value_arr ^= current_arr
            value_arr *= mult_arr
            mult_arr += (82520 + index + index)

        value_arr += 97531
        result_carray = bcolz.carray(value_arr)
        del value_arr
        return result_carray
857380
def toList(value):
        
        if type(value) == list:
            return value
        elif type(value) in [np.ndarray, tuple, xrange, array.array]:
            return list(value)
        elif isinstance(value, Vector):
            return list(value.toArray())
        else:
            raise TypeError("Could not convert %s to list" % value)
5906
def zstack_array(self, s=0, c=0, t=0):
        
        return np.dstack([x.image for x in self.zstack_proxy_iterator(s=s, c=c, t=t)])
662919
def list_all_eq_to(list_, val, strict=True):
    
    if util_type.HAVE_NUMPY and isinstance(val, np.ndarray):
        return all([np.all(item == val) for item in list_])
    try:
        # FUTURE WARNING
        # FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.
        with warnings.catch_warnings():
            warnings.filterwarnings('ignore', category=FutureWarning)
            flags = [item == val for item in list_]
            return all([np.all(flag) if hasattr(flag, '__array__') else flag
                        for flag in flags])
        #return all([item == val for item in list_])
    except ValueError:
        if not strict:
            return all([repr(item) == repr(val) for item in list_])
        else:
            raise
1109718
def arrays(self):
        
        return [x for x in self[self.current_scope].values() if x.class_ == CLASS.array]
1291793
def select_from_array(cls, array, identifier):
        

        base_array = np.zeros(array.shape)
        array_coords = np.where(array == identifier)
        base_array[array_coords] = 1

        return cls(base_array)