more flexible padding code to accomodate oversized MIRI LRS pupil