@classmethod<EOL><INDENT>def simulate_variable_arrays(cls, array, pixel_scale, exposure_time_map, psf=None, background_sky_map=None,<EOL>add_noise=True, noise_if_add_noise_false=<NUM_LIT:0.1>, noise_seed=-<NUM_LIT:1>, name=None):<DEDENT>
if background_sky_map is not None:<EOL><INDENT>array += background_sky_map<EOL><DEDENT>if psf is not None:<EOL><INDENT>array = psf.convolve(array)<EOL>array = cls.trim_psf_edges(array, psf)<EOL>exposure_time_map = cls.trim_psf_edges(exposure_time_map, psf)<EOL>if background_sky_map is not None:<EOL><INDENT>background_sky_map = cls.trim_psf_edges(background_sky_map, psf)<EOL><DEDENT><DEDENT>if add_noise is True:<EOL><INDENT>array += generate_poisson_noise(array, exposure_time_map, noise_seed)<EOL>array_counts = np.multiply(array, exposure_time_map)<EOL>noise_map = np.divide(np.sqrt(array_counts), exposure_time_map)<EOL><DEDENT>else:<EOL><INDENT>noise_map = noise_if_add_noise_false * np.ones(array.shape)<EOL><DEDENT>if np.isnan(noise_map).any():<EOL><INDENT>raise exc.DataException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if background_sky_map is not None:<EOL><INDENT>array -= background_sky_map<EOL><DEDENT>if background_sky_map is not None:<EOL><INDENT>background_noise_map_counts = np.sqrt(np.multiply(background_sky_map, exposure_time_map))<EOL>background_noise_map = np.divide(background_noise_map_counts, exposure_time_map)<EOL><DEDENT>else:<EOL><INDENT>background_noise_map = None<EOL><DEDENT>array_counts = np.multiply(array, exposure_time_map)<EOL>poisson_noise_map = np.divide(np.sqrt(np.abs(array_counts)), exposure_time_map)<EOL>array = ScaledSquarePixelArray(array=array, pixel_scale=pixel_scale)<EOL>noise_map = NoiseMap(array=noise_map, pixel_scale=pixel_scale)<EOL>if background_noise_map is not None:<EOL><INDENT>background_noise_map = NoiseMap(array=background_noise_map, pixel_scale=pixel_scale)<EOL><DEDENT>if poisson_noise_map is not None:<EOL><INDENT>poisson_noise_map = PoissonNoiseMap(array=poisson_noise_map, pixel_scale=pixel_scale)<EOL><DEDENT>return CCDData(array, pixel_scale=pixel_scale, psf=psf, noise_map=noise_map,<EOL>background_noise_map=background_noise_map, poisson_noise_map=poisson_noise_map,<EOL>exposure_time_map=exposure_time_map, background_sky_map=background_sky_map, name=name)<EOL>
Create a realistic simulated image by applying effects to a plain simulated image.

Parameters
----------
name
array : ndarray
    The image before simulating (e.g. the lens and source galaxies before optics blurring and CCD read-out).
pixel_scale: float
    The scale of each pixel in arc seconds
exposure_time_map : ndarray
    An array representing the effective exposure time of each pixel.
psf: PSF
    An array describing the PSF the simulated image is blurred with.
background_sky_map : ndarray
    The value of background sky in every image pixel (electrons per second).
add_noise: Bool
    If True poisson noise_maps is simulated and added to the image, based on the total counts in each image
    pixel
noise_seed: int
    A seed for random noise_maps generation