autogalaxy.SimulatorImaging#

class SimulatorImaging[source]#

Bases: SimulatorImaging

Simulates observations of Imaging data, including simulating the image, noise, blurring due to the telescope optics via the Point Spread Function (PSF) and the background sky.

The simulation of an Imaging dataset uses the following steps:

  1. Receive as input a raw image of what the data looks like before any simulation process is applied.

  2. Include diffraction due to the telescope optics by convolving the image with an input Point Spread Function (PSF).

  3. Use input values of the background sky level in every pixel of the image to add the background sky to the PSF convolved image.

  4. Add Poisson noise to the image, which represents noise due to whether photons hits the CCD and are converted to photo-electrons which are successfully detected by the CCD and converted to counts.

  5. Subtract the background sky from the image, so that the returned simulated dataset is background sky subtracted.

The inputs of the SimulatorImaging object can toggle these steps on and off, for example if psf=None the PSF convolution step is omitted.

The inputs add_poisson_noise_to_data and include_poisson_noise_in_noise_map provide flexibility in handling Poisson noise during simulations:

  • add_poisson_noise_to_data determines whether Poisson noise is added to the simulated data.

  • include_poisson_noise_in_noise_map decides if Poisson noise is included in the noise_map of the dataset.

These options allow you to create a dataset without adding Poisson noise to the data while still using a noise_map that represents the noise levels expected if Poisson noise had been included.

This approach is particularly useful for diagnostic purposes. By simulating noise-free data but retaining realistic noise levels in the noise_map, you can test whether the model-fitting process accurately recovers the input parameters. Unlike noisy data, where random Poisson noise introduces offsets in each simulation, this method ensures the posterior peaks precisely around the input values. This is a powerful way to identify potential systematic biases in a model-fitting analysis.

Parameters:
  • exposure_time (float) – The exposure time of the simulated imaging.

  • background_sky_level (float) – The level of the background sky of the simulated imaging.

  • subtract_background_sky (bool) – If True, the background sky level is subtracted from the simulated dataset, otherwise it is left in.

  • psf (Convolver) – An array describing the PSF kernel of the image, if None no PSF convolution is applied.

  • use_real_space_convolution (bool) – If True, the PSF convolution is performed in real space, if False it is performed in Fourier space. Real space convolution avoids aliasing effects that can occur in Fourier space convolution, but is slower. If the PSF kernel is small (e.g. 11x11) then real space convolution is recommended, whereas if the PSF kernel is large (e.g. 51x51) then Fourier space convolution with care to pad the image to avoid aliasing is recommended.

  • normalize_psf (bool) – If True, the PSF kernel is normalized so all values sum to 1.0.

  • add_poisson_noise_to_data (bool) – Whether Poisson noise corresponding to photon count statistics on the imaging observation is added.

  • include_poisson_noise_in_noise_map (bool) – Whether Poisson noise is included in the noise-map of the dataset. If False the noise-map is filled with the value noise_if_add_noise_false.

  • noise_if_add_noise_false (float) – If noise is not added to the simulated dataset a noise_map must still be returned. This value gives the value of noise assigned to every pixel in the noise-map.

  • noise_seed (int) – The random seed used to add random noise, where -1 corresponds to a random seed every run.

  • use_jax (bool) – If True, via_image_from defaults xp to jax.numpy and the simulator’s internal noise generation routes through jax.random. The returned Imaging carries jax.Array data — useful for JAX-eager batched simulation (parameter sweeps, mock-data studies). Defaults to False.

Methods

via_galaxies_from

Simulate an Imaging dataset from an input list of Galaxy objects and a 2D grid of (y,x) coordinates.

via_image_from

Simulate an Imaging dataset from an input image.

via_galaxies_from(galaxies, grid, xp=None)[source]#

Simulate an Imaging dataset from an input list of Galaxy objects and a 2D grid of (y,x) coordinates.

The light profiles of each galaxy are used to generate the image of the galaxies which is simulated.

The steps of the SimulatorImaging simulation process (e.g. PSF convolution, noise addition) are described in the SimulatorImaging __init__ method docstring, found in the PyAutoArray project.

If one of more galaxy light profiles are a LightProfileSNR object, the intensity of the light profile is automatically set such that the signal-to-noise ratio of the light profile is equal to its input signal_to_noise_ratio value.

For example, if a LightProfileSNR object has a signal_to_noise_ratio of 5.0, the intensity of the light profile is set such that the peak surface brightness of the profile is 5.0 times the background noise level of the image.

Parameters:
  • galaxies (List[Galaxy]) – The galaxies whose light profiles are evaluated using the input 2D grid of (y,x) coordinates in order to generate the image of the galaxies which is then simulated.

  • grid (Union[ndarray, Grid2D, Grid2DIrregular]) – The 2D grid of (y,x) coordinates which the light profiles of the galaxies are evaluated using in order to generate the image of the galaxies.