Skip to content

Commit

Permalink
Merge pull request #211 from Jammy2211/feature/disable_noise
Browse files Browse the repository at this point in the history
Feature/disable noise
  • Loading branch information
Jammy2211 authored Nov 18, 2024
2 parents 0ad6c4a + f77390d commit 9602c16
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
20 changes: 15 additions & 5 deletions autogalaxy/imaging/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,29 @@ def via_galaxies_from(
self, galaxies: List[Galaxy], grid: aa.type.Grid2DLike
) -> aa.Imaging:
"""
Simulate an `Imaging` dataset from an input plane and grid.
Simulate an `Imaging` dataset from an input list of `Galaxy` objects and a 2D grid of (y,x) coordinates.
The planbe is used to generate the image of the galaxies which is simulated.
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.
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
The galaxies whose light is simulated.
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
The image-plane grid which the image of the strong lens is generated on.
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.
"""

galaxies = Galaxies(galaxies=galaxies)
Expand Down
2 changes: 1 addition & 1 deletion autogalaxy/interferometer/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def via_galaxies_from(self, galaxies: List[Galaxy], grid: aa.type.Grid2DLike):
An arrays representing the effective exposure time of each pixel.
psf: PSF
An arrays describing the PSF the simulated image is blurred with.
add_poisson_noise: Bool
add_poisson_noise_to_data: 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
Expand Down
2 changes: 1 addition & 1 deletion docs/overview/overview_1_start_here.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ object.
exposure_time=300.0,
background_sky_level=1.0,
psf=ag.Kernel2D.from_gaussian(shape_native=(11, 11), sigma=0.1, pixel_scales=0.05),
add_poisson_noise=True,
add_poisson_noise_to_data=True,
)
Expand Down
4 changes: 2 additions & 2 deletions test_autogalaxy/imaging/test_simulate_and_fit_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test__perfect_fit__chi_squared_0():
)

simulator = ag.SimulatorImaging(
exposure_time=300.0, psf=psf, add_poisson_noise=False
exposure_time=300.0, psf=psf, add_poisson_noise_to_data=False
)

dataset = simulator.via_galaxies_from(galaxies=[galaxy_0, galaxy_1], grid=grid)
Expand Down Expand Up @@ -146,7 +146,7 @@ def test__simulate_imaging_data_and_fit__linear_light_profiles_agree_with_standa
)

simulator = ag.SimulatorImaging(
exposure_time=300.0, psf=psf, add_poisson_noise=False
exposure_time=300.0, psf=psf, add_poisson_noise_to_data=False
)

dataset = simulator.via_galaxies_from(galaxies=[galaxy], grid=grid)
Expand Down
5 changes: 3 additions & 2 deletions test_autogalaxy/imaging/test_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def test__simulator__via_galaxies_from():
psf=psf,
exposure_time=10000.0,
background_sky_level=100.0,
add_poisson_noise=False,
add_poisson_noise_to_data=False,
include_poisson_noise_in_noise_map=False,
)

dataset = simulator.via_galaxies_from(galaxies=[galaxy_0, galaxy_1], grid=grid)
Expand Down Expand Up @@ -130,7 +131,7 @@ def test__simulator__simulate_imaging_from_galaxy__source_galaxy__compare_to_ima
psf=psf,
exposure_time=10000.0,
background_sky_level=100.0,
add_poisson_noise=True,
add_poisson_noise_to_data=True,
noise_seed=1,
)

Expand Down

0 comments on commit 9602c16

Please sign in to comment.