def get_crop(params, shape):
    """
    Parses crop from params object.

    Parameters
    ----------
    params : object
        object holding configuration parameters
         
    shape : tuple
        shape of image array, i.e. the array to be cropped

    Returns
    -------
    crop : list
        crop in each dimension
    """
    crop = []
    for i in range(len(shape)):
        if params.crop is None:
            crop.append(shape[i])
        else:
            crop.append(params.crop[i])
            if isinstance(crop[i], float):
                crop[i] = int(crop[i]*shape[i])
    return crop