How much of this function boils down to np.resize?