Observation#

class silmaril.imaging.Observation(detector, lens, galaxy)#

Bases: object

Class representing an observation of a lensed galaxy using a detector

Parameters:
  • detector (Detector) – detector used to take the observation

  • lens (Lens) – lensing cluster

  • galaxy (Galaxy) – source galaxy

detector#

detector used to take the observation

lens#

lensing cluster

galaxy#

source galaxy

traced_pixel_corners#

grid of source plane coordinates of the corners of each pixel on the image plane

__init__(detector, lens, galaxy)#

Methods

__init__(detector, lens, galaxy)

plot(background, noise, source_resolution[, ...])

Plot the lensed galaxy as seen by the detector.

save_to_fits(filename, background, noise, ...)

Simulates an observation of the lensed galaxy and saves it to a fits file with WCS information.

simulate_observation(background, noise, ...)

Simulates an observation of the lensed galaxy.

trace_pixels(source_resolution[, ...])

Performs ray tracing and computes luminosities for lensed image.

plot(background, noise, source_resolution, source_center=(0, 0), source_rotation=0, zoom_factor=1, filter_name=None, star_by_star=False, norm=None)#

Plot the lensed galaxy as seen by the detector.

Parameters:
  • background (float) – background level of the image

  • noise (float) – standard deviation of the noise

  • source_resolution (int) – number of pixels on each side of the source image

  • source_center (tuple, optional) – coordinate offset in arcseconds of the center of the source image, defaults to (0,0)

  • source_rotation (float, optional) – rotation in degrees of the source image, defaults to 0

  • zoom_factor (float, optional) – zoom factor of the source image, defaults to 1

  • filter_name (str) – name of the JWST filter to use (uses luminosity lookup table if set to None)

  • star_by_star (boolean) – Lenses galaxy from position data of individual stars if set to true, otherwise creates a source image of the given resolution

  • norm (matplotlib.colors.Normalize, optional) – normalization of the image, defaults to None

Returns:

matplotlib figure and axes objects

Return type:

tuple(matplotlib.figure.Figure,matplotlib.axes.Axes)

save_to_fits(filename, background, noise, source_resolution, source_center=(0, 0), source_rotation=0, zoom_factor=1, filter_name=None, star_by_star=False)#

Simulates an observation of the lensed galaxy and saves it to a fits file with WCS information.

Parameters:
  • filename (str) – name of the file to save the observation to

  • background (float) – background level of the image

  • noise (float) – standard deviation of the noise

  • source_resolution (int) – number of pixels on each side of the source image

  • source_center (tuple, optional) – coordinate offset in arcseconds of the center of the source image, defaults to (0,0)

  • source_rotation (float, optional) – rotation in degrees of the source image, defaults to 0

  • zoom_factor (float, optional) – zoom factor of the source image, defaults to 1

  • filter_name (str) – name of the JWST filter to use (uses luminosity lookup table if set to None)

  • star_by_star (boolean) – Lenses galaxy from position data of individual stars if set to true, otherwise creates a source image of the given resolution

simulate_observation(background, noise, source_resolution, filter_name=None, source_center=(0, 0), source_rotation=0, zoom_factor=1, star_by_star=False)#

Simulates an observation of the lensed galaxy.

Parameters:
  • background (float) – background level of the image

  • noise (float) – standard deviation of the noise

  • source_resolution (int) – number of pixels on each side of the source image

  • filter_name (str) – name of the JWST filter to use (uses luminosity lookup table if set to None)

  • source_center (tuple, optional) – coordinate offset in arcseconds of the center of the source image, defaults to (0,0)

  • source_rotation (float, optional) – rotation in degrees of the source image, defaults to 0

  • zoom_factor (float, optional) – zoom factor of the source image, defaults to 1

  • star_by_star (boolean) – Lenses galaxy from position data of individual stars if set to true, otherwise creates a source image of the given resolution

Returns:

simulated observation as a 2d array of luminosity values

Return type:

numpy.ndarray

trace_pixels(source_resolution, source_center=(0, 0), source_rotation=0, zoom_factor=1, filter_name=None, star_by_star=False)#

Performs ray tracing and computes luminosities for lensed image.

Parameters:
  • source_resolution (int) – number of pixels on each side of the source image

  • source_center (tuple, optional) – coordinate offset in arcseconds of the center of the source image, defaults to (0,0)

  • source_rotation (float, optional) – rotation in degrees of the source image, defaults to 0

  • zoom_factor (float, optional) – zoom factor of the source image, defaults to 1

  • filter_name (str) – name of the JWST filter to use (uses luminosity lookup table if set to None)

  • star_by_star (boolean) – Lenses galaxy from position data of individual stars if set to true, otherwise creates a source image of the given resolution

Returns:

  • nonempty_pixels (numpy.ndarray) – list of pixel indices on the image plane corresponding to pixels that fall within the source image when traced back to the source plane

  • arc_pixels (numpy.ndarray) – list of coordinates on the image plane corresponding to pixels that fall within the source image when traced back to the source plane

  • polygons (numpy.ndarray) – list of polygons on the source plane as an array of shape (n,4,2)

  • luminosities (numpy.ndarray) – array of luminosity values in Jy/arcsec^2