A two dimensional dataset is read in. After normalisation to unity, the dataset is summed to create a cumulative probability distribution. Each background photon has a random number generated between zero and one which defines a bin in the distribution - this becomes the photon's position.