slsim.Plots package

Submodules

slsim.Plots.lens_plots module

class slsim.Plots.lens_plots.LensingPlots(lens_pop, num_pix=64, observatory='LSST', **kwargs)[source]

Bases: object

A class to create and display simulated gravitational lensing images using the provided configurations for the source (blue) and lens (red) galaxies.

plot_montage(rgb_band_list, add_noise=True, n_horizont=1, n_vertical=1, kwargs_lens_cut=None, single_band=False, lens_class_list=None, **rgb_kwargs)[source]

Method to generate and display a grid of simulated gravitational lensing images with or without noise.

Parameters:
  • rgb_band_list – list of imaging band names corresponding to r-g-b color map

  • add_noise – boolean flag, set to True to add noise to the images, default is True

  • n_horizont – number of images to display horizontally, default is 1

  • n_vertical – number of images to display vertically, default is 1

  • kwargs_lens_cut – lens selection cuts for Lens.validity_test() function

  • single_band – boolean flag, set to True to only show the first band in the rgb_band_list, default is False

  • lens_class_list – list of lens() class objects to be plotted.

  • rgb_kwargs – additional keyword arguments for rgb_image function.

rgb_image(lens_class, rgb_band_list, add_noise=True, minimum=0, stretch=0.5, Q=8)[source]

Method to generate a rgb-image with lupton_rgb color scale.

Parameters:
  • lens_class – class object containing all information of the lensing system (e.g., Lens())

  • rgb_band_list – list of imaging band names corresponding to r-g-b color map

  • add_noise – boolean flag, set to True to add noise to the image, default is True

  • minimum – minimum value for the color scale, default is 0

  • kwargs – additional keyword arguments for make_lupton_rgb

slsim.Plots.plot_functions module

slsim.Plots.plot_functions.create_image_montage_from_image_list(num_rows, num_cols, images, time=None, band=None, image_type='other', image_center=None)[source]

Creates an image montage from an image list.

Parameters:
  • num_rows – number of images to display horizontally

  • num_cols – number of images to display vertically

  • images – list of images

  • time – array of observation time for point source images. If None, considers static case.

  • band – array of bands corresponding to the observations. If None, does not display any information regarding the band.

  • image_type – type of the provided image. It could be ‘dp0’ or any other name.

  • image_center (array. eg: for two image, it should be like np.array([[13.71649063, 13.09556121], [16.69249276, 17.78106655]])) – center of the source images.

Returns:

image montage of given images.

slsim.Plots.plot_functions.create_montage(images_band, grid_size=None)[source]

Creates a montage from a list of images, limited to the first 3 images, with consistent scaling. This function is a helper function for plot_lightcurves() function.

Parameters:
  • images_band – List of 2D NumPy arrays representing images.

  • grid_size – Tuple specifying the grid dimensions (rows, cols). If None, calculates the grid size to be approximately square.

Returns:

2D NumPy array representing the montage.

slsim.Plots.plot_functions.plot_lightcurves(lightcurve_dict)[source]

Plots lightcurves dynamically for all available images across different bands.

Parameters:

lightcurve_dict – Dictionary of lightcurves. The format of this dictionary should be following: lightcurve_dict = { “obs_time”: {“i”: [63105.42, 63107.41], “r”: [63107.39, 63118.22]}, “magnitudes”: { “mag_image_1”: {“i”: [21.21, 20.42], “r”: [20.87, 19.31]}, “mag_image_2”: {“i”: [23.82, 22.87], “r”: [23.45, 23.16]}, “mag_image_3”: {“i”: [], “r”: []}, “mag_image_4”: {“i”: [], “r”: []}}, “errors_low”: { “mag_error_image_1_low”: {“i”: [0.04, 0.03], “r”: [0.03, 0.02]}, “mag_error_image_2_low”: {“i”: [0.06, 0.05], “r”: [0.04, 0.03]}}, “errors_high”: { “mag_error_image_1_high”: {“i”: [0.05, 0.04], “r”: [0.03, 0.02]}, “mag_error_image_2_high”: {“i”: [0.07, 0.06], “r”: [0.05, 0.04]}}}

Returns:

lightcurve plots.

slsim.Plots.plot_functions.plot_lightcurves_and_magmap(convolved_map, lightcurves, time_duration_observer_frame, tracks, magmap_instance: MagnificationMap, lightcurve_type='magnitude')[source]

Plot the lightcurves and the magnification map.

Parameters:
  • convolved_map – convolved magnification map 2D numpy array. This is the map that is used to generate the lightcurves.

  • lightcurves – list of lightcurves to plot

  • time_duration_observer_frame – time duration in observer frame in days

  • tracks – list of tracks to plot

  • magmap_instance – instance of the MagnificationMap class. Must be the same as the one used to generate the lightcurves.

  • lightcurve_type – type of lightcurve to plot. Can be ‘magnitude’ or ‘magnification’.

Returns:

ax: the axis of the plot

slsim.Plots.plot_functions.plot_magnification_map(magmap_instance, ax=None, plot_magnitude=True, **kwargs)[source]

Plot the magnification map on the given axis.

Parameters:
  • magmap_instance – instance of the MagnificationMap class.

  • ax – axis to plot on. If None, a new figure and axis will be created.

  • plot_magnitude – if True, plot the magnitudes. If False, plot the magnifications.

  • kwargs – additional keyword arguments to pass to the imshow function.

Returns:

ax: the axis of the plot

slsim.Plots.plot_functions.plot_montage_of_random_injected_lens(image_list, num, n_horizont=1, n_vertical=1)[source]

Creates an image montage of random lenses from the catalog of injected lens.

Parameters:
  • images_list – list of catalog images

  • n_horizont – number of images to display horizontally

  • n_vertical – number of images to display vertically

  • num – length of the injected lens catalog

Returns:

image montage of random injected lenses.

Module contents