import torch

def crop_based_on_fixation(
    img, x_center, y_center, img_h, img_w, flip=False, padding=200
):
    x_center += padding
    y_center += padding
    if padding != 0:
        img = img[
              x_center - int(img_w / 2): x_center + int(img_w / 2),
              y_center - int(img_h / 2): y_center + int(img_h / 2),
              ]
    if flip:
        img = torch.fliplr(img)
    assert img.shape == (img_w, img_h)

    return img




