def gen_img_ptn(img,ap):
    """generate img_ptn from given image and average photon number

    Args:
        img : image
        ap :average photon number, img_ptn will have #ap photons per pixel

    Returns:
        img_ptn will have #ap photons per pixel
    """
    img_ptn = img/img.mean()*ap
    return img_ptn